Skip to content
OddMaths
Back to Puzzlespuzzles

The Magic Square Puzzle: Why There's Really Only One 3×3 Square

Put the numbers 1 to 9 in a 3×3 grid so that every row, column and diagonal adds up to the same total. It sounds like it should have lots of answers, but there is really only one.

Here is a puzzle with a tiny grid, nine numbers and exactly one answer (if you don't count turning or flipping the square).

Draw a 3 × 3 grid with nine empty boxes. Write the numbers 1 to 9 in the boxes, using each number once.

Your goal: every row, every column and both long diagonals must add up to the same total.

A grid like that is called a magic square. Nine numbers, nine boxes. How hard can it be? Have a go on paper before reading on!

Stop and Think

Stuck? Here are the hints. Use them one at a time.

Hint 1: What do all the numbers 1 to 9 add up to? Your grid has 3 rows. What must each row add up to?
Hint 2: Which box is part of the most lines? (Count the row, the column and the diagonals through it.)
Hint 3: Add up the four lines that go through the middle box. The middle number gets counted four times. What does that tell you about it?

The Total Is Forced

You don't get to choose the total. All nine numbers together add up to:

1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45

The three rows use every number once, so they share out 45 equally:

45 ÷ 3 = 15

So every line must add up to 15. We call that the magic number of the square.

The Middle Must Be 5

The middle box sits in four lines: its row, its column, and both diagonals. Add those four lines together:

4 lines × 15 = 60

Those four lines cover every box once, except the middle, which gets counted four times. So they add up to the 45 from all nine boxes, plus three extra copies of the middle number:

45 + 3 × (middle) = 60
3 × (middle) = 15
middle = 5

The middle number is 5. No other number will work.

The Reveal

Here's a magic square that works:

2 · 7 · 6
9 · 5 · 1
4 · 3 · 8

Check it:

Rows: 2 + 7 + 6 = 15, 9 + 5 + 1 = 15, 4 + 3 + 8 = 15
Columns: 2 + 9 + 4 = 15, 7 + 5 + 3 = 15, 6 + 1 + 8 = 15
Diagonals: 2 + 5 + 8 = 15, 6 + 5 + 4 = 15

Every line gives 15!

Is There Another One?

Turn the square a quarter turn, or flip it like a pancake, and you get a new-looking square that still works. Together, there are 8 of them. We tried all 362,880 ways of arranging the numbers 1 to 9 on a computer. Exactly those 8 worked, and all 8 are the same square turned and flipped.

So the 3 × 3 magic square is unique. There is really only one.

Here is a pattern worth noticing. In every one of the 8 squares:

The middle is always 5.
The corners are always even numbers (2, 4, 6, 8).
The edges are always odd numbers (1, 3, 7, 9).

An Ancient Square

This square is known as the Lo Shu square. A Chinese legend says that long ago, during a great flood, a magical turtle crawled out of the Luo River with this pattern of dots on its shell. Records of a "river map" go back a very long way, and there is a clear magic square in Chinese writing by around 80 CE.

Try It Yourself

Flip it. Write the square above again, but swap the left column with the right column. Is it still a magic square?

Add one. Add 1 to every number in the square (so it uses 2 to 10). Is it still magic? What is the new magic number?

A bigger square. A 4 × 4 magic square uses 1 to 16. What must each line add up to? (Hint: add up 1 to 16 and share it out between 4 rows.)

Check your answers: swapping the columns gives 6, 7, 2 / 1, 5, 9 / 8, 3, 4, and every line still adds up to 15. Adding 1 to every box adds 3 to each line (three numbers per line), so it is still magic and the new magic number is 18. And for a 4 × 4 square, 1 + 2 + ... + 16 = 136, and 136 ÷ 4 = 34.

The OddMaths Takeaway

You can solve this puzzle without any guessing. Adding up all the numbers tells you the magic number is 15, and counting the lines through the middle tells you it has to be 5. Smart counting can trim a puzzle down to almost nothing.

The 3 × 3 magic square has been known for well over a thousand years, and it still hides a neat logic puzzle.

🎯 Test Your Skill

Nine numbers. One square. Zero guessing needed.

Sources & Further Reading