• Foundation
  • About 15 min
  • 5 practice questions

Grids with sums and the 3 × 3 magic square

Reason about row and column sums in a grid filled with 1 to 9, and build a 3 × 3 magic square step by step by working out the magic sum, the centre and the corners.

If something looks wrong, please tell us.

By the end of this lesson you can

  • Explain why each row sum of a 1 to 9 grid lies between 6 and 24, and why the three row sums total 45.
  • Show that a 3 × 3 magic square using 1 to 9 has magic sum 15 and centre 5.
  • Build a 3 × 3 magic square by reasoning rather than guessing.

Fill a 3 × 3 grid with the numbers 1 to 9, each used once, and write the sum of each row and each column outside the grid. Simple reasoning tells us a lot about these sums before we place a single number.

What the sums can be

The smallest possible sum of three different numbers from 1 to 9 is 1 + 2 + 3 = 6, and the largest is 7 + 8 + 9 = 24. So no row or column sum can be less than 6 or more than 24. Also, the three rows together contain every number from 1 to 9 exactly once, so the three row sums always add up to 1 + 2 + … + 9 = 45. The same is true of the three column sums.

Worked example 1: spotting impossible grids

  • Row sums 10, 14 and 25: impossible, because 25 is more than 24.
  • Row sums 12, 15 and 17: impossible, because 12 + 15 + 17 = 44, not 45.
  • Row sums 12, 15 and 18: possible, since they total 45; for example the rows 1, 2, 9 and 3, 4, 8 and 5, 6, 7.

Magic squares

A magic square is a square grid in which every row, every column and both diagonals add up to the same number, called the magic sum. Trying random arrangements is hopeless: there are 3,62,880 ways to fill a 3 × 3 grid with 1 to 9. Instead, we reason.

Building a 3 × 3 magic square from 1 to 9

  1. Magic sum = 15 Three equal row sums total 45, so each is 45 ÷ 3.
  2. Centre = 5 The four lines through the centre use it four times.
  3. 1 and 9 go in middle edges A corner is in three lines; 1 and 9 have only two partner pairs each.
  4. Fill the rest Use 'each line makes 15' to finish.

Why the centre must be 5

The middle row, the middle column and the two diagonals all pass through the centre. Together these 4 lines add up to 4 × 15 = 60. They include each of the 8 outer numbers once and the centre 4 times. The outer numbers plus the centre once make 45, so the centre's three extra appearances add 60 − 45 = 15, and the centre is 15 ÷ 3 = 5. A quick check that 9 cannot be the centre: 8 would share a line with it, and 9 + 8 = 17 is already more than 15.

Where 1 and 9 go

A corner square lies on three lines (a row, a column and a diagonal). If 1 were in a corner, we would need three different pairs adding to 14 to go with it. From 2 to 9 the only pairs are 5 + 9 and 6 + 8, just two. So 1 cannot be in a corner; nor can 9, whose partners must add to 6, and only 1 + 5 and 2 + 4 do. So 1 and 9 sit in the middle of two opposite edges, in a line with the 5.

In a 3 × 3 magic square made from 1 to 9, the magic sum is 15, the centre is 5, and 1 and 9 sit in the middles of opposite edges.

Worked example 2: completing the square

Put 5 in the centre, 1 in the middle of the left column and 9 in the middle of the right column (1 + 5 + 9 = 15). The left column needs two numbers adding to 14 with the 1: these must be 6 and 8; put 6 at the top and 8 at the bottom. Each diagonal makes 15: 6 + 5 + ? gives 4 at the bottom right, and 8 + 5 + ? gives 2 at the top right. Then the top row 6 + ? + 2 needs 7, and the bottom row 8 + ? + 4 needs 3.

A 3 × 3 magic square: every row, column and diagonal adds to 15
GridColumn 1Column 2Column 3
Row 1672
Row 2159
Row 3834

Check: rows 15, 15, 15; columns 6 + 1 + 8, 7 + 5 + 3, 2 + 9 + 4, all 15; diagonals 6 + 5 + 4 and 2 + 5 + 8, both 15. Turning or flipping this square gives the other magic squares made from 1 to 9.

Key takeaways

Key takeaways: In a grid filled with 1 to 9, row and column sums lie between 6 and 24 and each set of three totals 45. A 3 × 3 magic square from 1 to 9 must have magic sum 15 and centre 5, with 1 and 9 in middle edge squares. Reasoning about sums turns an impossible search into a short construction.

Check your understanding

  1. 1. What is the magic sum of a 3 × 3 magic square made with the numbers 1 to 9?

    1. 15
    2. 45
    3. 18
    4. 9
    Show answer

    Answer: A. All the numbers add to 1 + 2 + … + 9 = 45. The three rows have equal sums totalling 45, so each is 45 ÷ 3 = 15.

  2. 2. A 3 × 3 grid uses 1 to 9 once each. Which set of row sums is impossible?

    1. 6, 15, 24
    2. 10, 14, 21
    3. 11, 16, 19
    4. 12, 15, 18
    Show answer

    Answer: C. Row sums must total 45. 11 + 16 + 19 = 46, so it is impossible. The others total 45 and can be made, e.g. 1 + 2 + 3, 4 + 5 + 6, 7 + 8 + 9.

  3. 3. Which number must be in the centre of a 3 × 3 magic square made with 1 to 9?

    1. 1
    2. 5
    3. 9
    4. 4
    Show answer

    Answer: B. The 4 lines through the centre total 4 × 15 = 60, which counts the outer numbers once and the centre 4 times. 60 − 45 = 15 is three extra centres, so the centre is 15 ÷ 3 = 5.

  4. 4. Why can 9 not be at the centre of a 3 × 3 magic square made with 1 to 9?

    1. Because 9 is odd
    2. Because the centre must be even
    3. Because 9 is the largest number
    4. Because 8 would share a line with it, and 9 + 8 = 17 is already more than 15
    Show answer

    Answer: D. Every outer square shares a line with the centre. Wherever 8 goes, its line would contain 9 + 8 = 17, more than the magic sum 15, so 9 cannot be at the centre.

  5. 5. In a 1 to 9 magic square, the top row is 4, ?, 8. What is the missing number?

    1. 3
    2. 5
    3. 2
    4. 1
    Show answer

    Answer: A. The row must add to 15: 15 − 4 − 8 = 3.

Privacy · Terms · Refunds · Delivery