Associated Topics || Dr. Math Home || Search Dr. Math

### Finding Magic Squares

```
Date: 05/12/98 at 22:11:54
Subject: Magic squares - how to find them

I've looked at magic squares, many of them actually, and just couldn't
find a pattern in the numbers. Is there a pattern for each type of
magic square?  A universal pattern that would work on all magic
squares?  Also, are there similar patterns in magic cubes as well?
```

```
Date: 05/14/98 at 11:27:05
From: Doctor Jeremiah
Subject: Re: Magic squares - how to find them

Hi Chris:

I really like magic squares. I have found that any size magic square
with an odd number of squares on a side (3x3 9x9 101x101) is easy to
do. I do not know of an easy way to do magic squares with an even
number of squares on a side (4x4 10x10). So the way I would create a
4x4 magic square is probably by trial and error.

A magic square has a certain number of smaller squares placed together
to form a larger square. The numbers 1 through however many smaller
squares exist are placed each exactly one time into one of the smaller
squares so that all the rows, columns and both diagonals add to the
same number:

+---+---+---+       +---+---+---+
|   |   |   |       | 8 | 1 | 6 |
+---+---+---+       +---+---+---+
|   |   |   |  ==>  | 3 | 5 | 7 |
+---+---+---+       +---+---+---+
|   |   |   |       | 4 | 9 | 2 |
+---+---+---+       +---+---+---+

Here is the method that I use for doing a magic square with an odd
number of squares on one side (5x5):

If things are not lining up very well, change to a monospaced font
like Courier.

Step 1: Always put the number "1" in the center bottom square.

+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   | 1 |   |   |
+---+---+---+---+---+

Step 2: Place successively bigger numbers in the squares in a downward
diagonal direction. If you run off the end, wrap around as if
the sides were attached to each other.

+---+---+---+---+---+
|   |   |   | 2 |   |
+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   |   |   |   |
+---+---+---+---+---+
|   |   | 1 |   |   |
+---+---+---+---+---+

Step 3: Continuing with Step 2 . . .

+---+---+---+---+---+
|   |   |   | 2 |   |
+---+---+---+---+---+
|   |   |   |   | 3 |
+---+---+---+---+---+
| 4 |   |   |   |   |
+---+---+---+---+---+
|   | 5 |   |   |   |
+---+---+---+---+---+
|   |   | 1 |   |   |
+---+---+---+---+---+

Step 4: When you get to a square that is already filled, move one

+---+---+---+---+---+
|   |   |   | 2 |   |
+---+---+---+---+---+
|   |   |   |   | 3 |
+---+---+---+---+---+
| 4 | 6 |   |   |   |
+---+---+---+---+---+
|   | 5 |   |   |   |
+---+---+---+---+---+
|   |   | 1 |   |   |
+---+---+---+---+---+

Step 5: Repeat this over and over.

+---+---+---+---+---+
|11 |   |   | 2 | 9 |
+---+---+---+---+---+
|10 |   |   |   | 3 |
+---+---+---+---+---+
| 4 | 6 |   |   |   |
+---+---+---+---+---+
|   | 5 | 7 |   |   |
+---+---+---+---+---+
|   |   | 1 | 8 |   |
+---+---+---+---+---+

Step 6: Repeat this over and over.

+---+---+---+---+---+
|11 |   |   | 2 | 9 |
+---+---+---+---+---+
|10 |12 |   |   | 3 |
+---+---+---+---+---+
| 4 | 6 |13 |   |   |
+---+---+---+---+---+
|   | 5 | 7 |14 |16 |
+---+---+---+---+---+
|   |   | 1 | 8 |15 |
+---+---+---+---+---+

Step 7: Repeat this over and over.

+---+---+---+---+---+
|11 |18 |   | 2 | 9 |
+---+---+---+---+---+
|10 |12 |19 |21 | 3 |
+---+---+---+---+---+
| 4 | 6 |13 |20 |   |
+---+---+---+---+---+
|   | 5 | 7 |14 |16 |
+---+---+---+---+---+
|17 |   | 1 | 8 |15 |
+---+---+---+---+---+

Step 8: Stop when all the squares are filled.

+---+---+---+---+---+
|11 |18 |25 | 2 | 9 |
+---+---+---+---+---+
|10 |12 |19 |21 | 3 |
+---+---+---+---+---+
| 4 | 6 |13 |20 |22 |
+---+---+---+---+---+
|23 | 5 | 7 |14 |16 |
+---+---+---+---+---+
|17 |24 | 1 | 8 |15 |
+---+---+---+---+---+

This particular square adds up to 65 in each direction.

As far as a 4x4 magic square is concerned, check out:

http://www.astro.virginia.edu/~eww6n/math/MagicSquare.html

because it has a solved 4x4 magic square and a somewhat complicated
method for solving it. And for a lot of information about magic
squares see "How to construct magic squares" at

I hope this helps.

-Doctors Jeremiah and Sarah,  The Math Forum
Check out our web site! http://mathforum.org/dr.math/
```
Associated Topics:
Middle School Puzzles

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search