About Me

My photo
Science communication is important in today's technologically advanced society. A good part of the adult community is not science savvy and lacks the background to make sense of rapidly changing technology. My blog attempts to help by publishing articles of general interest in an easy to read and understand format without using mathematics. You can contact me at ektalks@yahoo.co.uk

Monday, 12 January 2026

Simple Templates to build 3X3 Sum and Product Magic Squares

 The history of the sum magic squares (SMS) goes back a long way.  There is something fascinating - almost magical - the way the numbers play out.  

In the following, I shall provide a template for building SMS and also introduce the product (aka multiplicative) magic squares (PMS).  PMS are not well known and few people are familiar with their properties and construction.  The methods described are rather straightforward and can also be enjoyed by those who find mathematics a difficult/confusing subject.  For clarity, I have restricted the discussion to 3X3 magic squares.

First we look at the much better known Sum Magic Squares.

3X3 SUM MAGIC SQUARES:  The SMS consists of 3 rows of numbers, each row having 3 numbers.  The square is an SMS if the sums of numbers in each row, each column, and both main diagonals are the same. 

An example is given in the following:  

                                2     7     6

                                9     5     1

                                4     3     8

The numbers in each row, each column and both diagonals sum to 15, called the magic sum.  What is not generally appreciated is that the sum of middle numbers (shown red below) is equal to the sum of the corner numbers (shown blue below) - it is 20 in this example (4 times the central number).           

                                2     7     6

                                   5     1                        eq.0

                                4     3     8

Another property of an SMS is that the central number (5 in our example) is always one-third of the sum of rows or columns or diagonals (15 in our example).  Also the sum of all the numbers is 45 that is 9 times the central number (true for all 3X3 SMS)

Template to build an SMSA 3X3 SMS has nine elements.  Let us call them a, b, c, d, e, f, g, h and i.  Let the magic sum be equal to S. Then we have:  

                               a    b    c

                               d    e    f

                               g    h    i

where            S =  a + b + c  =  d + e + f  = g + h + i   

or                 3S =  a + b + c + d + e + f + g + h + i            eq.1

We can also write the sum of the two diagonals, the middle row and the middle column as follows

           4S = a + e + i + g + e + c + d + e + f + b + e + h

               a + b + c + d + e + f + g + h + i + 3e

or       4S = 3S + 3e    (we have used eq.1 here)

Therefore,    S = 3e or e = S/3                                        eq.2

Eq.2 tells us that the centre number is always equal to one third of the the sum S (sum of rows, columns or diagonals).      Therefore, for integral numbers, S must be divisible by 3.

Now we can provide a template for building a 3X3 SMS. 

For this purpose, we chose e = 0, so that S is also equal to zero.  

A template is shown in the following:

                                  a      -a-b      b

                               -a+b      0       a-b                        eq.3

                                  -b     a+b      -a  

The way, I have built the template is by choosing centre number equal to zero and the top corner numbers as a and b.  Since the sum of the numbers in the top row is zero, the top middle number must be -a-b.  The rest follows. 

Now, if we wish to construct an SMS whose rows etc. sum to a number S = 3e then we simply add e to all the elements of the square - to obtain 

                               e+a      e-a-b      e+b

                               e-a+b      e       e+a-b                        eq.4

                                e-b     e+a+b     e-a  

This template also has the property that the sum of middle number of rows and columns is 4e - this is also true for the sum of numbers at the corners.

The SMS in eq.0 is obtained by choosing a = -3 and b = 1


3X3 Product Magic Squares (PMS): PMS are set of numbers arranged as a 3X3 square such that the product of numbers in any row, column or diagonal is the same.  An example is given below:

                                18      12

                                     6     9                          Eq.5

                                 3    36    2

It is easy to check that the product P of the numbers in any row, any column or any diagonal is 216 - this is equal to the central number raised to power 3. The product of the numbers at the middle of outer rows (shown red) and the outer columns (shown red) is 1296 - this is equal to the central number raised to the power 4.

Template to build an PMS: A 3X3 PMS has nine elements.  Let us call them                  a, b, c, d, e, f, g, h and i.  Let the magic product be equal to P

Then we have the PMS as:  

                               a    b    c

                               d    e    f

                               g    h    i

where the products of the numbers in the three rows are 

                    P =  a.b.c  =  d.e.f  = g.h.i  

or                P 3 =  a.b.c.d.e.f.g.h.i                     Eq.6

The product of numbers in each diagonal, middle row and middle column is P, therefore

                  P 4 =  a.e.i x c.e.g x d.e.f x b.e.h

or              P 4 =  a.b.c.d.e.f.g.h.i  x e  =   P x e 3     

Hence,     P  =  e 3                                       Eq.7

Therefore, the product of the numbers in each row, each column or a diagonal is equal to the cube of the central number. This also implies that for integer numbers a to i in a PMS, the product P must be a whole cube - equal to the cube of the central number e.

Following the procedure for the construction of an SMS  template, we shall first choose the central number e = 1 and two other numbers a and b to give us the following template:  


For a=3 and b=2, eq.9 reproduces the PMS described in eq.5.  We also notice that the product of numbers in the middle of the top and bottom rows and the middle of the 1st and 3rd columns is 
 P = a4b4  
Similarly, the product of numbers at the four corners is also a4b4      

Hope you have enjoyed this investigation into SMS and PMS.  
Now, it is possible to construct the magic squares so easily.

Thanks for reading.