The magic square

Preamble

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?

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:-
Note that the JavaScript for generating a random square is:

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?

Note:-

Hence, to construct a magic square:-

Here is the magic square:-
Exercise. Note the effect of each of the following rotations:-

Query. Is there only one magic 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. .........

Addednum: generating a random square in a JavaScript Workspace

Here is the JavaScript for the button above:-

Output:
Note that the button includes an HTML form to display the output from the code.