The magic squares

The Ministry is migrating nzmaths content to Tāhurangi.           
Relevant and up-to-date teaching resources are being moved to Tāhūrangi ( 
When all identified resources have been successfully moved, this website will close. We expect this to be in June 2024. 
e-ako maths, e-ako Pāngarau, and e-ako PLD 360 will continue to be available. 

For more information visit


This problem solving activity has a number focus.

Achievement Objectives
NA5-3: Understand operations on fractions, decimals, percentages, and integers.
NA5-7: Form and solve linear and simple quadratic equations.
Student Activity
A 9-square grid (3 rows of 3 squares).

Tui realises that there are nine positions in a magic square.

Can she make up a magic square using each of the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9 only once?



Specific Learning Outcomes
  • Use algebra as required.
  • Construct magic squares.
Description of Mathematics

magic square is an arrangement like the one below where the vertical, horizontal and diagonal lines of numbers all add up to the same value. This ‘same value’ is called the sum of the magic square.


It’s a critical part of this problem that three times the centre square is equal to the sum of the magic square. Developing the proof is the point of this lesson. This is also proved in the extension to Negative Magic Squares, Level 4.

The magic square in this problem can be solved by guess and check. Using algebra is however the more efficient way. Students should be encouraged to determine what critical information within the problem is needed in order to find a solution, allowing the students to develop their own algebraic equations to fit the problem situation.  

Magic squares are interesting objects in both mathematics proper and in recreational mathematics. The students may have already encountered magic squares as this problem is part of a series of Number problems: Little Magic Squares and A Square of Circles, Level 2; Big Magic Squares, Level 3; Fractional Magic Squares, Level 4; Difference Magic Squares, Level 6. These all look at interesting variations of the magic square concept.


The Problem

Tui realises that there are nine positions in a magic square. Can she make up a magic square using each of the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9 only once?

Teaching Sequence

  1. Show the students a magic square such as the one below, and ask why it is called a magic square.
  1. Have them to check that the rows all have the same sum (of 12); that the columns all have the same sum; and that the diagonals have the same sum.
  2. Pose Tui’s problem.
  3. Have students work in pairs  to create their magic square.
    Do not tell them that the sum of a magic square is three times the centre entry. They will need this information, but the point is to have them work this out themselves.
  4. As some pairs report back, have them justify each step in the production of the magic square. Ask:
    How did you solve the problem? (There is more than one way.) 
    How many different magic squares can you find?
    How many do they think there are?
  5. Have the students record what they have discovered.
  6. Pose the Extension as appropriate.


What other magic squares can you make with nine consecutive numbers?

Students may like to investigate consecutive numbers b – 1, b and b + 1 to show that there are only four magic squares that use only these three numbers.
Does the same argument hold with 2b – 2, 2b and 2b + 2? What about b, c and 2c - b? 


Suppose that the magic square is as in the diagram below.


Let s = the sum of three numbers in a row. Therefore:

s   = A + B + C   =    D + E + F      =    G + H  + I
     = A + D + G   =    B + E + H     =    C + F + I
     = A + E + I    =     C + E + G

We know that:
A + B + C + D + E + F + G + H + I = 1 + 2 +…+ 9 = 45
Can we use this information to establish s?

We can see that the first three equations for s are A + B + C; D + E + F; and G + H  + I.  If we sum these three equations, we get:
3s = A + B +C + D + E + F + G + H + I = 45. So 3s = 45, which means that s = 15.

There are two ways to go from here. Call this point step *. Thus the sum has to be 15.  How many ways can this sum be attained?  Let's see how many ways each number 1 to 9 can be used in a sum of three to get 15.

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

As can be seen, there are only eight possible equations of three numbers using the numbers 1 to 9 that give a sum of 15. Thus, all these eight equations have to be used together in the solution.  We can see from the eight algebraic equations that each corner square is in three equations (i.e., a, c, g, i), the centre square is in four equations (i.e., e) and the remaining middle row squares are in two equations (i.e., b, d, f, h).

We can see from the eight equations using the numbers 1 to 9, that 5 is the only number which appears in four equations, thus 5 must be the centre square, E:


We can also see that 9, 7, 3, and 1 only appear twice each in these eight equations, thus they must be B, D, F, and H. We can also see that 9 and 1 have to be in an equation together, as do 7 and 3. Therefore, they are restricted to the following arrangements (and their rotations about the centre square):


The remaining numbers 2, 4, 6, and 8 must therefore be in the corners, i.e., A, C, G and I. Checking the eight algebraic equations, we can see that this is possible, as all of these numbers each appear three times in the eight equations using the numbers 1 to 9. As these numbers are in the corners, they all appear in one equation with each of the other corner numbers. We can also see that 2 is in equations with 9, 7, and 5; 4 is in equations with 9, 5 and 3; 6 is in equations with 7, 5 and 1; and 8 is in equations with 1, 3 and 5. Therefore, the only following arrangements can be formed (and their rotations about the centre square):


This is the same arrangement, reflected through B, E and H. Thus, 15 is the only sum, and this sum can only be attained using the above eight equations of three numbers using the numbers 1 to 9. Due to the symmetry of a 3 by 3 grid, reflecting or rotating the solution can form 8 different arrangements of this solution:


We have therefore proved that there is only one magic square that can be made from the numbers 1 to 9 inclusive (subject to rotations and reflections of the square).

But earlier, we could have used more algebra. Think about all of the rows, columns and diagonals through the centre square. So, if s is the sum, then:

A + E + I = s
B + E + H = s
C + E + G = s
D + E + F = s

Add all of these up and you’ll get:

(A + D + G) + (B + E + H) + (C + F + I) + 3E = 4s.

Now each term in the brackets equals s as they are the column sums. So: 

s + s + s + 3E = 4s.

This means that 3E = s. And since s = 15, then e = 5.

Now one way to make 15 is to 1 + 5 + 9, so suppose that 1, 5, 9 are down the main diagonal.


Then B + C = 14 so {B, C} = {5, 9} or {6, 8}. But we’ve already used 5 and 9 so {B, C} = {6, 8}. This presents a problem. If C = 6 then G = 0 and if C = 8, then G = -2. This can only mean that 1, 5, 9 are not on the main diagonal.

Add to plan

Log in or register to create plans from your planning space that include this resource.

Level Five