SEED Science

Solution: Math Puzzle: Magic Squares

Solution: Magic Squares Math Puzzle

In this puzzle we challenged you to create magic squares with the numbers 1 through 9. Read on to see several interesting solutions we received.

Solution

Our puzzle was to rearrange these numbers so that the sums of the three rows, the three columns, and the two diagonals are all equal.

1   2   3
4   5   6
7   8   9

In other words, if we represent the numbers in the squares by letters:

a   b   c
d   e   f
g   h   i

then it should be true that

a + b + c = d + e + f = g + h + i = a + d + g = b + e + h = c + f + i = a + e + i = c + e + g

Dionicio's Solution

Dionicio sent in this solution:

8   3   4
1   5   9
6   7   2

There are several other solutions that result from flipping or rotating Dionicio’s Magic Square. For example, if we rotate the pattern 90º clockwise, we have

6   1   8
7   5   3
2   9   4

Flipping the rotated pattern along its vertical axis gives

8   1   6
3   5   7
4   9   2

Vincent's Solution

Vincent Vieugue offers this solution.

Let’s represent the nine numbers by the letters:

a   b   c
d   e   f
g   h   i

The first number we need to find out is the sum of each row, column, or diagonal. Let’s call that number x. If we look only at the three rows, it should be true that:

Equation 1) a + b + c = d + e + f = g + h + i = x

We also know that if we sum the three rows together, whatever the arrangement of the numbers is, the total value should be the sum of all the numbers available in that arrangement. In other words we should have:

Equation 2) a + b + c + d + e + f + g + h + i = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45

In Equation 2, we can replace (a + b + c) , (d + e + f) , (g + h + i) with the number x from Equation 1. We obtain:

(a + b + c) + (d + e + f) + (g + h + I) = x + x + x = 45
3x = 45
x = 15

The next number to look for is e, which is at the center of the arrangement. Because of its position, e is linked to all of the other numbers by the following equations:

Equations 3) d + e + f = 15

b + e + h = 15

 a + e + i = 15

c + e + g = 15

Let’s add all these equations together. We obtain

(d + e + f) + (b + e + h) + (a + e + i) + (c + e + g) = 60

Reordering the numbers gives us

(a + b + c + d + e + f + g + h + i) + (e + e + e) = 60

Using Equation 2, we can replace the first expression by 45, so

45 + 3e = 60
e = 5

Now, we know that the arrangement begins as:

a   b   c
d   5   f
g   h   i

And Equation 3 should be true, which means when replacing e with 5

d + f = b + h = a + i = c + g = 10

To obtain 10, the only possible combinations with all the remaining numbers available are (9 + 1), (8 + 2), (7 + 3), and (6 + 4).

Let's try to place the (9,1) first.

Because we can rotate the arrangement by 90º to obtain the same configuration, we have only two solutions:

Replacing (a and i). Replacing (c and g) will give the same answer.
Replacing (b and h). Replacing (d and f) will give the same answer.

Let's first try Solution 1.

If a = 9 and i = 1 , we need to resolve the following equation:

Equation 4) b + c = d + g = 15 - 9 = 6

We know that b, c, d, and g have to be different numbers. The only numbers left to validate Equation 4 are 4 and 2.
This means that Equation 4 is impossible to resolve and therefore the numbers 9 and 1 cannot be on positions a
and i or c and g.

Let's now try Solution 2.

If b = 9 and h = 1, we need to resolve the following equations:

Equation 5) a + c = 6
Equation 6) g + i = 14

Because a and c have to be two different numbers, the only solutions available are

a = 4 and c = 2 or
a = 2 and c = 4

Let's place all the numbers we have found so far. The arrangement looks like

4   9   2
d   5   f
g   1   i

It is now easy to finish the arrangement:

i  = 15 - 4 - 5 = 6
g = 15 - 2 - 5 = 8
d = 15 - 4 - g = 15 - 4 - 8 = 3
f  = 15 - 2 - i  = 15 - 2 - 6 = 7

A final solution is

4   9   2
3   5   7
8   1   6

Or any of the following rotations:

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

Going Further

How many different arrangements can you get with flips and rotations?
Can you make a 3-by-3 Magic Square using numbers other than 1 through 9?
Can you make a larger Magic Square, say 4-by-4 or 5-by-5?

More about Magic Squares

To learn more about Magic Squares, check out The Math Forum.