# It’s Magic Square!

A magic square is a $n$ by $n$ square grid filled with distinct integers $1,2,..., n^2$ such that each cell contains a different integer and the sum of the integers, called magic number, is equal in each row, column and diagonal. The order of a $n$ by $n$ magic square is $n$.

The first known example of a magic square is said to have been found on the back of a turtle by Chinese Emperor Yu in 2200 B.C. (see Fig. 1) : circular dots represents the integers 1 through 9 are arranged in a $3$ by $3$ grid. Its order and magic number are $3$ and $15$ respectively.

Fig. 1

The first magic square to appear in the Western world was the one depicted in a copperplate engraving by the German artist-mathematician Albrecht Dürer, who also managed to enter the year of engraving – $1514$ – in the two middle cells of the bottom row (see Fig. 2)

Fig. 2

Let $m$ be the magic number of a $n$ by $n$ magic square. Sum of all its rows (see “Little Bird and a Recursive Generator“)

$n\cdot m = 1+2+3+...+n^2 = \frac{n^2(n^2+1)}{2}$.

That is,

$m = \frac{n(n^2+1)}{2}.\quad\quad\quad(1)$

Fig. 3

There is no $2$ by $2$ magic square. For if there is, it must be true (see Fig. 3) that

$a +b = a+c \implies b=c$, contradicts “each cell contains a different integer”.

Shown in Fig. 4 is a square whose rows and columns add up to $260$, but the diagonals do not, which makes the square only semi-magic.

Fig. 4

What’s interesting is that a chess Knight, starting its L-shaped moves from the cell marked “$1$” can tour all $64$ squares in numerical order. The knight can reach the starting point from its finishing cell (marked”$64$“) for a new round of tour.

Exercise-1 Is it true that for every $n \in \mathbb{N}\setminus\left\{2\right\}$ there exists at least one magic square?

Exercise-2 Is there a Knight’s Tour magic square?

Exercise-3 Fill in the missing numbers in the following square so that it is a magic square: