Mathematics of Magic Squares

Patterns with sequences and sums on square grids

Washington University Middle School Mathematics Teachers’ Circle

Richard Lodholz, April 15, 2008

The most famous ‘Magic Square’ was created and displayed in the painting “Melancholia” by the artist Albrecht Dürer in the year 1514.

The interesting thing about this magic square is that the year’s date is given in the bottom, two middle squares.

A Magic Square is defined by the sum of the numbers in each row and each column and each diagonal having the same sum. In this case the sum is 34. That result is also the sum of the four interior cells. This is an example of a 4 by 4 Magic Square.

To look at the mathematics in creating magic squares let’s go down a notch to a square array 3 by 3. Place the numbers, 1, 2, 3 in this square so that each number appears exactly once in the row and column and

diagonal.

Since each number appears three times the sum of all nine numbers is 18 with the sum in each row, column, and diagonal equal to 6. It should be clear that 2 must be in the middle cell. This is the average (arithmetic mean) of the nine numbers, and a good condition to remember. After some trial and error effort or good reasoning we can see that 2’s must be the diagonal and the rest follows nicely.

There exist some nice patterns with this arrangement, which we can embellish by making a pyramid structure out of the square, as illustrated below.

Then think of the larger square determined by the outer vertices. Looking left to right (and up)

this figure has 3 diagonals.

And, left to right down

another set of 3 diagonals.

Move outside numbers to the open

spot furthest away in the same row

or column. (see arrows). This

completes the magic square.

Thus using the pyramid shape is a quick method to build a 3 by 3 magic square. The diagonals looking up and down must merely be in an arithmetic sequence where the difference between cells is not in a 2:1 ratio.

One example is:

Becomes à

The same process can be used to build any odd square, magic square, such as 5 by 5, 7 by 7.

Notice that the center square on the 3 by 3 magic square is the average of the rows, columns, and diagonals. So, it is 1/3 of the magic sum.

Since each diagonal is in arithmetic progression consider the algebraic representation below:

This format determines the center cell as the average.

So, fill in the remaining cells to keep the same average. In other words the center row across would be determined by left cell equal to an expression that would give 3a from the top and bottom entrees of

(a-y) + (a-x)

or

a + y + x

Then (a-y) + (a+y+x) + (a-x) = 3a

Following this pattern the middle row cell on the right would have to be (a-y-x).

All algebraically represented cells are then:

We can build magic squares with an integral sum that is a multiple of 3. For instance a magic square with the sum of 72 would have a center cell of 24. We could use the pyramid model to build sequences and transfer to the square, or we could use the algebraic notation shown to the left to complete the magic square.

It is the case that x and y cannot be in the ratio of 2:1 or 1:2. Try x = 6 and y = 3 to see what happens.

Problems;

1. Build a 3x3 magic square with all prime numbers.

2. On a 5x5 grid place the numbers 0, 1, 2, 3, 4 so that each row and column has only one of each number.

Use the illustrations on the next page to create even arrays of magic squares.

3. Build a 4 by 4 magic square.

4. Build an 8 by 8 magic square.

Count left to right going down and do not fill in cells on the diagonal. Then start over counting right to left going back up placing all numbers not yet used. This method can be used for the 8 by 8 magic square.

Observe the square to the right. Find the pattern counting from 1 to 64. What is the pattern?

This magic square was created by Leonhard Euler in the 18th century. The intriguing thing about this square is that it is created with “chess Knight” moves. Try it.

Washington University Teachers’ Circle, April 15, 2008, Lodholz page 4