The magic square
This page arose as my means of stimulating a 7-year-old student, Alpha, to create a magic square (with pencil and paper). This page was not available to Alpha, either on the computer screen or on paper. The page represents my guide to Alpha understanding and creating a magic square with as little help as possible from me. Note the two goals of the page:-
How might others use this page?
- Creation of a magic square.
- Discovering/proving tiny theorems about a magic square.
- A teacher of primary/secondary/undergrudate mathematics might welcome the superstructure of this page.
- A teacher might import the ideas from a WWW page to a whiteboard in exposition of some topic.
What is a random square?
We shall be interested in the single-digit numbers 1,2,3,4,5,6,7,8,9. Note that the sum of the numbers is 45.
We can arrange the digits as a 3-by-3 square:-
This button allows you to re-arrange the digits in the square in many ways:-
- in the background, so to speak, in the source code;
What is a magic square?
We shall be interested in eight lines of the square: the three horizontal rows, the three vertical
columns, and the two diagonals.
We wish to arrange the digits in the square so that the rows, columns and diagonals have equal sums. Hence, because the sum of the integers in all three rows is 45, we shall want the row-sums (and the row-columns and the diagonal-sums) to be 15. We shall call such a square a magic square.
Exercise. Generate a random square (above).
Is its a magic square? Do any of the rows/columns/diagonals sum to 15?
Can we create a magic square?
Exercise. Discover some trios where each sums to 15.
I discovered these trios of digits (eight of them) which sum to 15:-
1 + 5 + 9 = 15
1 + 6 + 8 = 15
2 + 4 + 9 = 15
2 + 5 + 8 = 15
2 + 6 + 7 = 15
3 + 4 + 8 = 15
3 + 5 + 7 = 15
4 + 5 + 6 = 15
Exercise. Have I overlooked a trio which sums to 15?
Hence, to construct a magic square:-
- 5 occurs in four trios. In such trios, two have 5 and two odd integers, and two have 5 and two even integers.
- Each even integer occurs in three trios, and one of the three trios includes a 5 (2 5 8, 4 5 6)
Here is the magic square:-
Exercise. Note the effect of each of the following rotations:-
- Place 5 in the centre.
- Place 2 & 8 at diagonal corners, and 4 & 6 at diagonal corners.
- Place the odd numbers at appropriate midpoints of the sides of the square.
Query. Is there only one magic square?
- Rotate the magic square 180 degrees about a diagonal in the page through the centre of the square.
- Rotate the magic square 180 degrees about a centre-row or centre-column in the page through the centre of the square.
- Rotate the magic square 90 degrees about an axis perpendicular to the page through the centre of the square.
Theorems: about the integers in particular squares
We have completed our investigations. Let us formalize the results obtained above.
Theorem 1. The digit in the centre must be 5.
Proof of Theorem 1. Try any digit other than 5 in the centre. For example, place 4 in the centre. Then 1 must be on the perimeter of the square; and it will need 10 at its opposite point to make a sum of 15! For a second example, place 6 in the centre. Then 9 must be on the perimeter of the square; and any digit at its opposite will make the sum more than 15.
Theorem 2. A digit at a corner of the magic square must be even.
Proof of Theorem 2. .............
Theorem 3. A digit at the midpoint of a row or column of a magic square must be odd.
Proof of Theorem 3. .............
Theorem 4. There is only one 3-by-3 magic square.
Proof of Theorem 4. .........
Note that the button includes an HTML form to display the output from the code.