[Home] [Other] [Mathematics]

Magic Squares

Magic Squares may be perhaps the only area of recreational mathematics to which many of us have been exposed. The classic form of a magic square is a square containing consecutive numbers starting with 1, in which the rows and columns and the diagonals all total to the same number.

I'll have to admit that I was never very much interested by magic squares, as opposed to other mathematical amusements, but a Mathematical Games column in Scientific American by Martin Gardner disclosed some new discoveries in magic squares that are of interest.

The only magic square of order 3, except for trivial translations such as reflection and rotation, is:

```  6  1  8
7  5  3
2  9  4
```

Some magic squares are very simple to construct. Magic squares of any odd order can be constructed following a pattern very similar to that of the 3 by 3 magic square:

```8 1 6   17 24  1  8 15   30 39 48  1 10 19 28   47 58 69 80  1 12 23 34 45
3 5 7   23  5  7 14 16   38 47  7  9 18 27 29   57 68 79  9 11 22 33 44 46
4 9 2    4  6 13 20 22   46  6  8 17 26 35 37   67 78  8 10 21 32 43 54 56
10 12 19 21  3    5 14 16 25 34 36 45   77  7 18 20 31 42 53 55 66
11 18 25  2  9   13 15 24 33 42 44  4    6 17 19 30 41 52 63 65 76
21 23 32 41 43  3 12   16 27 29 40 51 62 64 75  5
22 31 40 49  2 11 20   26 28 39 50 61 72 74  4 15
36 38 49 60 71 73  3 14 25
37 48 59 70 81  2 13 24 35
```

One can also construct a magic square by making a square array of copies of a magic square, and then adding a displacement to the elements of each copy based on a plan given by another magic square:

thus, making nine copies of

```8 1 6
3 5 7
4 9 2
```

and subtracting one and multiplying by 9 to get the offsets of

```63  0 45
18 36 54
27 72  9
```

we form the square:

```71 64 69  8  1  6 53 46 51
66 68 70  3  5  7 48 50 52
67 72 65  4  9  2 49 54 47
26 19 24 44 37 42 62 55 60
21 23 25 39 41 43 57 59 61
22 27 20 40 45 38 58 63 56
35 28 33 80 73 78 17 10 15
30 32 34 75 77 79 12 14 16
31 36 29 76 81 74 13 18 11
```

Starting from a 4 by 4 magic square, such as

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

we can trivially form magic squares of the even orders 12, 20, 28, 36 by combining this square with one of odd order.

A variation on this technique works for doubling the order of a magic square of even order. We can construct the following magic square of order 8:

``` 1 60  8 61 17 44 24 45
63  6 58  3 47 22 42 19
14 55 11 50 30 39 27 34
52  9 53 16 36 25 37 32
33 28 40 29 49 12 56 13
31 38 26 35 15 54 10 51
46 23 43 18 62  7 59  2
20 41 21 48  4 57  5 64
```

from the order-4 square given above by making four copies of it, and then using the array:

``` 1/4 2/3
3/2 4/1
```

instead of a real magic square, as our basis for the offsets: that is, in this case the offsets will look like:

``` 0 48  0 48 16 32 16 32
48  0 48  0 32 16 32 16
0 48  0 48 16 32 16 32
48  0 48  0 32 16 32 16
32 16 32 16 48  0 48  0
16 32 16 32  0 48  0 48
32 16 32 16 48  0 48  0
16 32 16 32  0 48  0 48
```

First we could construct a magic square of any odd order, then one of four times any odd order, and now we can construct one whose order is four times any number.

Magic squares of orders 6, 10, 14, 18, and so on also exist, but the general rule for their construction is more complicated.

It has long been known that there are 880 different 4 by 4 magic squares, and it was recently discovered that the number of different 5 by 5 magic squares is 275,305,224. Other transformations in addition to reflection and rotation can relate all order-5 magic squares to a smaller number of "really" different squares, but those other transformations could affect some of the other properties of the square.

The following magic hexagon,

```     18  17   3
11   1   7  19
9   6   5   2  16
14   8   4  12
15  13  10
```

is the only magic hexagon possible of any size except the trivial one consisting of only the number 1.

In 1890, an 8 x 8 magic square was devised by one G. Pfeffermann in which not only the numbers, but the squares of the numbers as well, along each row, column, and diagonal summed to the same total. A square of this type is called bimagic.

The square

```58 12 51  1 47 29 38 24
6 56 15 61 19 33 26 44
36 18 41 27 53  7 64 14
32 46 21 39  9 59  4 50
11 57  2 52 30 48 23 37
55  5 62 16 34 20 43 25
17 35 28 42  8 54 13 63
45 31 40 22 60 10 49  3
```

is one example of such a square.

There are 80 possible 8 by 8 bimagic squares. A link previously provided for a listing of all of them is now broken, but it should be possible through a web search to find sites about magic squares with more information than this page.

In 1905, a 128 by 128 magic square was devised by Gaston Tarry where the numbers, their squares, and their cubes were all magic; this is called a trimagic square. This was cut in half to 64 by 64 by General Cazalas in 1933, and halved again by William Benson to 32 by 32.

Very recently, although a 16 by 16 trimagic square with the numbers from 1 to 256 is not yet known, a 12 by 12 trimagic square was discovered by Walter Trump in June 2002:

```  1  22  33  41  62  66  79  83 104 112 123 144
9 119  45 115 107  93  52  38  30 100  26 136
75 141  35  48  57  14 131  88  97 110   4  70
74   8 106  49  12  43 102 133  96  39 137  71
140 101 124  42  60  37 108  85 103  21  44   5
122  76 142  86  67 126  19  78  59   3  69  23
55  27  95 135 130  89  56  15  10  50 118  90
132 117  68  91  11  99  46 134  54  77  28  13
73  64   2 121 109  32 113  36  24 143  81  72
58  98  84 116 138  16 129   7  29  61  47  87
80  34 105   6  92 127  18  53 139  40 111  65
51  63  31  20  25 128  17 120 125 114  82  94
```

It has the property that if it is reflected left to right, and the value in each square is replaced by 145 minus that value, that it remains the same square.

In 2001, a 512 by 512 square with powers up to the fourth power being magic, and a 1024 by 1024 square with powers up to the fifth power being magic, were announced by C. Boyer and A. Viricel.

The traditional definition of a magic cube has been one in which the rows in both directions, the columns, and the diagonals between opposite corners going through the center of the cube all add to the same total.

An example of such a cube of order 3 is:

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

However, there are other diagonals in a cube.

A cube of order 6 in which the diagonals on the faces of the cube are also magic was devised by John Worthington some time before 1917:

```111   1   2 213 216 108
194 117 120   9  13 198
197 119 118  14  10 193
20 206 207  98 101  19
24 204 201 102  97  23
105   4   3 215 214 110

50 185 186  86  88  56
92  61  64 169 171  94
96  59  58 173 170  95
179  79  76  67  72 178
181  78  80  69  66 177
53 189 187  87  84  51

55 192 191  83  81  49
93  60  57 176 174  91
89  62  63 172 175  90
182  74  77  70  65 183
180  75  73  68  71 184
52 188 190  82  85  54

163 135 136  25  27 165
36 145 149 144 138  39
40 146 147 139 141  38
121  48  42 156 159 125
123  43  45 158 160 122
168 134 132  29  26 162

166 130 129  32  30 164
37 152 148 137 143  34
33 151 150 142 140  35
128  41  47 157 154 124
126  46  44 155 153 127
161 131 133  28  31 167

106   8   7 212 209 109
199 116 113  16  12 195
196 114 115  11  15 200
21 203 202 103 100  22
17 205 208  99 104  18
112   5   6 210 211 107
```

Like other cubes and squares presented here, I have oriented it to place the lowest numbers in the earliest positions - in this case, only by reversing the order of the layers from the version originally constructed.

Order 6 is a difficult order in which to construct magic squares as well as cubes. From any Graeco-Latin square, it is possible to construct trivially a square that is a magic square except for its diagonals (although they possibly can add to the right total as well, so some magic squares do correspond directly to such squares). There can be no Graeco-Latin square of order 6, and for orders 10, 14, 18, 22, 26, and so on, such squares can only be produced by a method which was very recently discovered.

For orders 7 and 8, there are magic cubes that are perfect, in which not only the space diagonals, but the diagonals of every layer in each of the three directions, add to the correct total. The first order 8 perfect magic cube was discovered in 1875, but the first order 7 one was discovered only in 1962. There are such cubes for higher orders as well.

[Home] [Other] [Mathematics]