The magic square
1win aviator game

The Magic Square

translating numbers in triangle squares

Learn about the magic square. During the 14th century, Europe was devastated by the plague. Since medicine in the Middle Ages was extremely basic, they had no power over this terrible disease. People were terrified because they believed that Black Death was punishment from God.


Image credit: Wikimedia Commons user Nicolas Poussin

They resorted to less verified sources and massively became superstitious. Here came the idea that mathematics can help prevent diseases and keep the devil at bay.

Some mathematicians created so-called magic square – a square table of order n containing numbers from 1 to n2 so that the sum of numbers in each row, column and both diagonals is the same. Soon enough, magic squares were everywhere.

square before

Image credit to Eve Andersson

How do you calculate a magic square?

We will show you how to calculate a magic square.

How to construct the magic squares of any order?

Order of the magic square represents the number of its rows or columns.

Construction of magic squares is divided into two different procedures:

  • One where its order is odd
  • One where it’s even

First, we’ll show the construction of magic squares with odd order.

Start with an empty square and draw a grid in it. For example, we’ll make a magic square whose order is 5.

square with order 5

Divide every side on 5 parts and draw parallels to make a grid with 25 squares.

Now on every side of this square we’ll construct a “triangle” of 4 squares. You will see these in green.

constructing triangle with 4 squares
Now, starting from the top left diagonal, draw numbers from 1 to 25 in every other diagonal (including the added “triangles”).

numbers in drawn triangle

If the order is $ n$, your last diagonal should end with n2. Now we should simply fill in the gaps. You take the numbers from those triangles and translate them vertically or horizontally to the furthest free place. If the number is placed on the top triangle, you’ll move it down. If it’s on the left, you’ll move it right and so on.

translating numbers in triangle squares

And the final result is:

the final result

Now we’ll show construction of magic squares of even order.

It is impossible to construct a magic square whose order is equal to 2. We’ll show how to construct a magic square whose order is equal to 4.

Draw a grid 4 x 4 and color them like this:

constructing magic square with order 4

Starting from the bottom right corner, write numbers from 1 to $ n_2$.

magic square with numbers inside

The numbers in the white cells are here to stay. But the numbers in the pink cells must be rearranged.

Now erase the number in the pink cells and start the counting again from the top right number corner.

magic square 3

Now, the numbers in the white cells will remain as they were, and pink cells will take the numbers from the counting. This is the final result:

constructing magic square 4

Of course, you can test it out. The sum of all rows should be equal to the sum of all columns and the sum of diagonal numbers.