## 3x3 Magic Square

#### Problem

A $3 \times 3$ magic square is a square grid containing the numbers 1 to 9 in such a way that the sum of each row, column, and diagonal has the same "magic total".

By considering rotations and reflections to be equivalent, prove that this $3 \times 3$ magic square is the only solution.

#### Solution

We shall begin by assigning letters to each of the cells in the $3 \times 3$ grid.

Although we do not know the individual value of each letter we do know that each of the digits 1 through 9 is assigned to the letters in some order. If we let the "magic total" for each row, column, and diagonal be $T$ then it can be seen that adding the following rows is equivalent to $3T$.

But this is also equivalent to adding every cell.

$\therefore a + b + c + d + e + f + g + h + i = 1 + 2 + ... + 9 = 45 = 3T \Rightarrow T = 15$

$\begin{eqnarray}(a+e+i)+(d+e+f)+(g+e+c)+(b+e+h) & = & 4T\\\therefore (a+b+c+d+e+f+g+h+i)+3e & = & 60\\45 + 3e & = & 60\\\therefore e = 5\end{eqnarray}$

Hence we know that the "magic total" is 15 and the central cell must be 5. So in order for each line to have the same total of 15 it will be necessary for the cells either side of the central cell to be of the form $5 - x$ and $5 + x$.

Take a moment to verify that the following arrangement is necessary and that each row, column, and diagonal adds to 15.

It can be seen that the cell with greatest value, $5 + x + y = 9 \Rightarrow x + y = 4$. Clearly $x$ and $y$ must be different values, otherwise the cells with $5 + x = 5 + y$; it should also be clear that $x, y \lt 0,$ because if, for example, $x = 0$ then $5 + x = 5 - x$.

Without loss of generality, let $x \lt y$, and as their sum is 4 it follows that $x = 1$ and $y = 3$. By substituting these values into the grid above we obtain the solution given in the problem and hence prove that this solution is unique.

Prove that the "magic total" for an $n \times$ grid is given by $\dfrac{n(n^2 + 1)}{2}$.

Problem ID: 366 (15 Nov 2009)     Difficulty: 2 Star

Only Show Problem