# Difference magic squares

Purpose

This is a problem from the number and algebra strand.

Achievement Objectives
NA6-5: Form and solve linear equations and inequations, quadratic and simple exponential equations, and simultaneous equations with two unknowns.
Student Activity

Tui wonders if it is possible to place the numbers 1 through to 9 in a 3 by 3 grid, so that in any direction of three squares (across, down or diagonally), the sum of the first and last numbers minus the centre number gives the same answer.

If it is possible, how many different answers exist?

Specific Learning Outcomes
Use algebra when necessary
Construct, 3 by 3 arrays of numbers according to a given rule
Devise and use problem solving strategies to explore situations mathematically (be systematic).
Description of Mathematics

This Difference Magic Square can be solved by guess and check, as the students guess where the numbers go into a 3 by 3 grid and then check whether this gives the correct solution. The most efficient way to solve this problem, however, is to use algebra. Encourage your students to first try non-algebraic techniques, such as guess and check, to emphasise the efficiency of algebra.

This problem is the final in a sequence of related problems:  A Square of Circles and Little Magic Squares, Level 2,  Big Magic Squares and Decimal Magic SquaresLevel 3,  Fractional Magic Squares and Negative Magic SquaresLevel 4, and The Magic Squares Level 5.

Required Resource Materials
Activity

### The Problem

Tui wonders if it is possible to place the numbers 1 through to 9 in a 3 by 3 grid, so that in any direction of three squares (across, down or diagonally), the sum of the first and last numbers minus the centre number gives the same answer.

If it is possible, how many different answers exist?

### Teaching sequence

1. Pose the problem to the students and check that it is understood. Ask:
What is the important information?
2. Have students work on the problem in groups. As they do so you might ask:
Have you seen a similar problem before? How did you approach that?
Could you apply equations to the problem?
3. Reconvene the class and have them discuss their progress so far. Record the steps made to this point.
4. Have the students continue to explore the problem in their groups.
5. Have the students share solutions as a class and individually write up what they have discovered.

### Solution

Draw up a 3 by 3 grid. Label the grid cells as following:

 A B C D E F G H I

Let k = the sum of the first and last numbers minus the centre number.  Therefore:

k   =      A + C – B  =      G + I – H   =      B + H – E  =      A + I – E
=      D + F – E  =      A + G – D  =     C + I – F   =      C + G – E

We can see that:
k – E = D + F = B + H = A + I = C + G.

We know that:
A + B + C + D + E + F + G + H + I = 1 + 2 +…+ 9 = 45.

Rearranging we get:
(A + I) + (B + H) + (C + G) + (D + F) + E = 45.

Substitution gives:
4(A + I) = 45 – E.  Thus: A + I = 45 - E .
4

Trying 1 to 9 as values for E, only E = 1, 5, and 9 give whole number answers for A + I:

 E A+1 1 11 5 10 9 9

This gives the following possible combinations of A and I.

 E A I E A I E A I 1 2 9 5 1 9 9 1 8 3 8 2 8 2 7 4 7 3 7 3 6 5 6 4 6 4 5

Many 3 by 3 designs could be constructed from these combinations. Perhaps we could limit the number of designs further. Looking back at the original equations, is there another equality we can find involving E, A and I from the four equations we have not yet utilised?

k =       A + C – B  =   G + I – H
=       A + G – D  =     C + I – F

We can see that:
(A + C – B) + (G + I – H) + (A + G – D) + (C + I – F) = 4k.

Rearranging we get:
2A + 2C + 2G + 2I – (B + D + F + H) = 4k.

We previously established that k – E = D + F = B + H = A + I = C + G.
Substitution gives:
4(A + I) – 2(A + I) = 4(A + I – E).

This reduces to:
2E = A + I.

The only E, A, I combinations that fit both A + I = (45 – E)/4 and 2E = A + I are those that have E = 5.  When E = 5, A + I = 2E = 10, thus k = A + I – E = 10 – 5 = 5 = E.

Using this knowledge, and the equation A + C – B = 5, when E = 5,
if A = 1 and I = 9, then:
C – B = 4.
Of the remaining numbers, B and C could be: 2 and 6, 3 and 7, 4 and 8.
If C = 6 then:
C + I - F = 5, making F = 10, - not possible.  So C cannot be 6.
If C = 7 then F = 11, again not possible.  C has to be 8.  But this gives F = 12.  A contradiction, therefore A and I cannot be 1 and 9.

If A = 2 and I = 8, then C – B = 3.  B and C could be: 1 and 4, 3 and 6, 4 and 7, 6 and 9.  If C = 4, then F = 7.
As D + F = B + H = A + I = C + G = 2E = 10, then knowing F = 7, D = 3, G = 6 and H = 9.
We have found a solution!

 2 1 4 3 5 7 6 9 8

(Due to the symmetry of a 3 by 3 grid, reflecting or rotating it can form 7 different arrangements of this solution.)

Now we need to establish if there are any more possible solutions:
If A = 3 and I = 7, then C – B = 2.  B and C could be: 2 and 4, 4 and 6, 6 and 8.
If C = 4, then F = 7 – not possible, as I = 7.  So C cannot be 4.
If C = 6, then F = 8.
As D + F = B + H = A + I = C + G = 2E = 10, then knowing F = 8, D = 2, G = 4 – not possible, as B = 4.
So C cannot be 6.  If C = 8, then F = 10 – not possible.
A contradiction, therefore A and I cannot be 3 and 7.

If  A = 4 and I = 6, then C – B = 1.  B and C could be: 1 and 2, 2 and 3, 7 and 8, 8 and 9.
If C = 2, then F = 3.  As D + F = B + H = A + I = C + G = 2E = 10,
then knowing F = 3, D = 7, G = 8, and H = 9.
This gives:

 4 1 2 7 5 3 8 9 6

However, this is simply a reflection of the previous solution. Therefore, there is only the one solution to this problem, which can be arranged in any of the following eight ways:

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