# How to create magic squares

*I have been teaching mathematics in an Australian High School since 1982, and I am a contributing author to mathematics text books.*

Trapped indoors on a rainy day and with nothing interesting to watch on the television, in desperation you may have discovered your child’s puzzle book and come across ‘magic squares’. Unable to complete them, frustration took over and you resolved to choose the lesser of two evils by returning to TV channel surfing until your trigger-finger succumbed to RSI from overuse of the remote control.

Now, however, is a good time to erase that haunting frustration from your memory and astound your friends by mastering the art of creating magic squares.

A magic square is a square array of numbers with the property that the sum of the numbers in each row, column and diagonal is the same, known as the “magic sum”.

The ‘order’ is the number of rows and columns, so a magic square of order 4 means it has 4 rows and 4 columns. If N is the order, then N x N different numbers are used to complete the magic square.

One of the earliest known records is the Lo Shu Square, described in ancient Chinese literature thousands of years ago and is part of Feng Shui astrology. The story goes that an emperor came across a tortoise with markings on its shell that resembled a Magic Square consisting of 3 rows and 3 columns with a magic sum of 15. This magic sum corresponds to the number of days between the new moon and the full moon.

We will first look at how to construct magic squares of odd order, with the smallest possible magic square having order 3. Then we will see how to complete magic squares whose order is divisible by 4.

The method of construction requires an arithmetic sequence of numbers. This means the difference between consecutive terms of the sequence has the same value. The sequence of numbers used can be whole numbers, integers, fractions, decimals or any other number type, as long as the increment/decrement between successive terms remains the same.

**Magic Sum**

The sum of a Magic Square is given by the formula

**How to create a magic square of odd order**

The strategy is to fill squares with consecutive numbers by imagining that from your current position on the magic square, you are moving North East.

As an example, let’s construct the Lo Shu Square using the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9.

Step 1. Always place the first number in the middle column of the first row.

Step 2.

To move North East, move one space right and one space up.

If this takes you outside the grid, go vertically all the way down and place the next number there.

Step 3.

Move one space right and one space up.

If you are outside the grid, go all the way to the left and place the next number there.

Step 4.

Move one space right and one space up.

If the square is occupied, place the next number in the square immediately underneath.

Step 5

Move one space right and one space up.

Step 6

Move one space right and one space up.

Step 7

Move one space right and one space up. This situation occurs for this corner only.

Place the next number in the square underneath.

Step 8. Move space right and one space up.

Just like step 3, go all the way to the left and place the next number there.

Step 9.

Move one space right and one space up.

You are outside the grid, so go vertically all the way down.

Follow the method in this order 5 magic square that uses the numbers 2, 4, 6, 8, …, 50.

The magic sum is 130.

__ __

**How to create a magic square whose order is divisible by 4**

** **

The smallest possible even-ordered magic square consists of 4 rows and 4 columns.

Let’s use the numbers 1, 2, 3, 4, …., 16, which give a magic sum of 34.

Two ‘passes’ are required to enter the 64 numbers.

For the 1^{st} pass, start at the top left and sequentially work across to the right and then down, at the same time jumping over any box that lies on one of the two leading diagonals.

For the 2^{nd} pass, start at the bottom right and work to the left and then up.

**How to create an 8 x 8 magic square**

The method we use to construct a magic square of order 8 is the same as the method used for the 4 x 4.

The only extra consideration is to include leading diagonals of each 4 x 4 ‘sub-square’.

Let’s use the numbers 1, 2, 3, 4, …., 64, which give a magic sum of 260.

Two ‘passes’ are required for the 64 numbers.

There are many intriguing properties of this magic square. For example, the sum of the diagonals of each 2 x 2 square is the same.

Here are several more interesting properties.

(6 + 7) - (2 + 3) = (62 + 63) - (58 + 59)

(41 + 49) - (9 + 17) = (48 + 56) - (16 + 24)

(12 + 13 + 20 + 21) + (44 + 45 + 52 + 53) = (26 + 27 + 34 + 35) + (30 + 31 + 38 + 39)

Magic Squares provide many patterns and number properties that can be explored at a far greater depth than what I have provided in this article. I cover some of these relationships in a video.

## Questions & Answers

**Question:** Can you create magic squares of even order other than divisible by 4, such as 6 or 10?

**Answer:** Yes, it is possible to have magic squares that are even and not divisible by 4. Check out the following.

http://www.math.wichita.edu/~richardson/mathematic...

## Comments

**Maria** on April 12, 2018:

Thank you! Very good article. I was looking for this info and this page is much more informative than others and the material is well explained and illustrated.