The magic of magic squares

T R Mani

Constructing magic squares has been a pastime of many eminent mathematicians. Srinivasa Ramanujan, in addition to a number of astonishing mathematical formulae, was interested in entertainment mathematics as well. The first chapter of his two volume book is all about magic squares. In this article we will see a few examples of magic squares.

Magic squares can be both odd and even, depending on the total number of squares. An odd magic square will have odd rows and columns and even magic square will have even number of rows and columns. In any magic square, the sum of all the rows, columns and the two diagonals will be the same. This is called the magic sum of that square.

The algorithm for constructing an odd magic square is simpler than that for an even magic square. In general, the same algorithm works for an odd magic square of any size. This is not so in the case of an even magic square.

Odd magic squares
The simplest magic square is a 3X3 square. The transformation is indicated below.

The algorithm can be summarized as – corner numbers move three boxes forward. Middle numbers move one box backwards. This method is applicable for any set of natural numbers, odd or even or any block of nine numbers from a calendar.

This magic square also has many super hidden identities
23 + 73 + 63 + (2+7)3 + (7+6)3 + (6+2)3 = 43 + 33 + 83 + (4+3)3 + (3+8)3 + (8+4)3

Novel method for 5X5 magic square
Diagonal starting with 1 to form the middle column. Maintain row order

Middle row to form the diagonal starting with 11. Maintain column order.

17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9

Magic sum=65. Method applicable to any odd magic square

Even magic squares
Even magic squares are more complex to construct and have many variations and levels of complexity. Let us see some examples.

Some of these can be constructed using the arithmetic series of numbers. They can also be constructed using a random selection of numbers.

Sri Rama Chakra
Sri Rama Chakra, found on the last page of certain versions of the Panchangam, is a magic square marvel. It is also called the pandiagonal magic square.

9 16 5 4
7 2 11 14
12 13 8 1
6 3 10 15

In a conventional magic square, the numbers in all the columns, rows and diagonals add up to the same total. In this magic square, 42 other formations of four numbers also add up to this total. Some examples are 9+4+15+6, 9+16+2+7, 9+5+8+12, 7+16+10+1, 9+16+6+3 and 16+5+10+3. There are more than 100 other interesting identities. This is the reason it is called a diabolic magic square as well.

Date magic square
Topping the innovations in magic squares is the use of random numbers as against the use of series numbers. In this magic square the top row contains a date in the dd/mm/yy/yy format. This automatically fixes the magic sum which is dd + mm + yy + yy.

It uses the two interesting identities already mentioned. The algorithm for making date magic squares can be learnt by any middle school student.

Here is a magic square where the first row represents Ramanujan’s date of birth – 22nd December 1887.

22 12 18 87
31 93 07 08
60 19 20 40
26 15 94 04

The magic sum is 22 + 12 + 18 + 87 = 139. The four numbers in the top row are given. By repeatedly applying the two identities already mentioned, we can fill three numbers in all the rows and columns.

12+18=30=26+04, 22+04=26=19+07, 26+87=113=93+20 & 22+26=48=08+40

Other empty cells are filled by adding the three numbers and subtracting from the magic sum.

Easiest magic square
One of the easiest algorithms for constructing an even magic square is given below.

The method is simple – reverse both the diagonals and retain the others.

This square also contains other interesting identities
162+22+32+132 = 42+142+152+12
(16+2)2+(2+3)2+(3+13)2+(13+16)2 = (4+14)2+(14+15)2+(15+1)2+(1+4)2
16X2+2X3+3X13+13X16 = 4X14+14X15+15X1+1X4

1-2-3 method for mega magic square – example 8X8

Starting with 1, alternate ascending numbers in alternate box. If RAJA comes, RANI with the next number. If NOT skip.

At LOC (Line of Condition) next number comes. Thereafter ascending to descending. Starting with 63 in the second box, alternate descending numbers in alternate box. If RAJA comes, RANI with next number. If NOT skip. At LOC, the next higher number. Thereafter descending to ascending.

Magic sum:

n(n+1)2 x 18 = 64x652 x 18 = 260

The method is applicable to magic squares in multiples of four and also suitable for a 100 X 100 mega magic square.

Magic product squares
Learning simple magic squares, R Adithya, a student from my math enrichment workshops, thought out-of-the-box and created a magic square using products instead of sums!

Magic squares offer a high degree of creativity apart from teaching arithmetic, instilling interest in numbers and a liking for mathematics, making it an easy subject to assimilate.

Constructing an even magic square

Even magic squares can be constructed using two important identities, which I will illustrate using the Sri Rama Chakra as an example.

  1. The sum of the middle two numbers of any extreme (top, bottom, left or right) row/column should be equal to the sum of the corner numbers at the other end.
    In the above case 16 + 5 = 6 + 15 or 7 + 12 = 4 + 15
  2. The sum of the numbers at the ends of any diagonal should be equal to the sum of the middle two numbers of the other diagonal.
    In the above case 4 + 6 = 2 + 8 and 9 + 15 = 13 + 11

Since there are many ways of choosing numbers to satisfy an identity, many variations of a magic square with the same magic sum are possible. However, it takes a lot of effort and many trials to get a magic square without repetition of numbers.

The author (born in 1934) is a mechanical engineer who retired in 1992 after a career with MICO Bengaluru. After retirement he developed an interest in mathematics and created many magic squares with new concepts. He has conducted math exhibitions and workshops for training students and teachers. For his work in mathematics, the Ramanujam Museum and Math Education Centre honored him in 2001 & 2019. He has a Facebook page Mathemagic Squares. He is available on WhatsApp, 9444901330. He can also be reached at

Leave a Reply