## The Number of Solutions to a Magic Square

A magic square is a 3 by 3 square so that the numbers 1 to 9 each appear once, and the numbers in each row, column or diagonal add up to the same number.\[1+2_3+4+5+6+7+8+9=15\]

There are three rows and three columns so each rown, and each column must add up to 15.

There are only eight possible sums of three numbers to give 15.

1 + 5 + 9 = 15

1 + 6 + 8 = 15

2 + 4 + 9 = 15

2 + 5 + 8 = 15

2 + 6 + 7 = 15

3 + 4 + 8 = 15

3 + 5 + 7 = 15

4 + 5 + 6 = 15

5 appears four times, so must be at the centre of the square, as the sum of the middle row, the middle column and two diagonals

2, 4, 6, 8 each appear three times so must be at the corners, to appear in the sum of a row, diagonal and columns. The square can then only be completed in one way, giving one solution.

Hence, there is at least one solution, namely

\[ \left( \begin{array}{ccc} 2 & 9 & 4 \\ 7 & 5 & 3 \\ 6 & 1 & w8 \end{array} \right) \]

Other solutions can be obtained from this one using the symmetries of a square. The group of symmetries of a square consists of four rotations and four reflections - one horizontal, one vertical and two diagonal.

There are eight solutions in total.