The Three by Three Magic Square

  • Medium
  • Arrangement puzzles
  • Tests: Deducing the centre before placing anything

The puzzle

Place the numbers 1 to 9 in a three by three grid so that every row, every column and both long diagonals add to the same total.

What must that total be, what must go in the centre, and how many different squares are there?

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

The nine numbers add to 45, and the three rows partition them.

Hint 2

Add the middle row, the middle column and both diagonals. Each passes through the centre.

Show the answer Hide the answer

The total is 15, the centre must be 5, and there is essentially one square - 8 arrangements, all rotations and reflections of each other.

How to get there

1 + 2 + ... + 9 = 45, and the three rows are disjoint and cover everything, so each row sums to 45/3 = 15. That fixes the magic constant before anything is placed.

Now add the four lines through the centre - middle row, middle column, both diagonals. Together they total 4 x 15 = 60 and they cover all nine cells, but the centre is counted four times instead of once. So 45 + 3 x centre = 60, giving centre = 5.

The corners must then be even. 5 is in the middle, and the four even numbers 2, 4, 6, 8 go in the corners with the odd 1, 3, 7, 9 on the edges - any other split fails. Fixing that leaves exactly 8 completions, which are the one square turned four ways and mirrored: 2-7-6 / 9-5-1 / 4-3-8 is the traditional form.

The technique worth keeping

Derive the invariants before searching. Summing overlapping lines and comparing with the total is a general trick for magic squares - it counts the shared cells extra times and solves for them directly.