Recreational Math II: Even-ordered Magic Squares: 4×4

Hits: 105

I had been going on now for quite a while about magic squares of odd-order, particlularly those magic squares whose order is a prime number of 5 or more. The algorithm for creating 5×5, 7,7, 11×11, 13,13 and other prime-ordered magic squares are all pretty similar, based on a sum of two squares and what might be called a “knight’s tour” to the right for the first one, and to the left for the second one.

The pattern breaks when you get to squares of even order, or of composite order. So, 4×4 has many pan-magic squares, but most methods I have observed appear to be brute force. And even after I have read about a method for constructing such squares, I have been often disappointed by the low-yielding nature of the algorithms they suggest.

The methods I have described for a 7×7 construction, for example, can yield (71)^2 = (5040)^2 = 25,401,600 possible magic squares. And the larger the prime-ordered square, the greater the possibilities. By the time we get to 13×13, the number of squares becomes (13!)^2 = (6,227,020,800)^2 = 38,775,788,043,632,640,000 or over 38 quintillion. Counting to such a number would take more than 1.2 trillion years, hundreds of times longer than the age of the universe. And we are just getting warmed up. After all, 13×13 isn’t really that big. But I think by now I can impress on you what a “high-yielding” algorithm can do. It must be stated that there appear to be no magic squares beyond 5×5 that are pan-magic. The rest appear to be normal magic, which I will distinguish shortly.

The methods I will now describe in the coming articles, those of composite order of 4 or more, are generally low-yielding. We will start with order 4. The one I learned about for a 4×4 square was by visiting Grogono.com, a site created and run by Alan Grogono, a professor of anesthesiology at the Tulane University School of Medicine, located in New Orleans, Louisiana. His foray into this branch of mathematics is proof that non-mathematicians are as capable as anyone of spending more time in recreational math than they or their spouses will care to admit.

Grogono states that all 4×4 squares are variations of the same three squares. This is probably uncharitable, since he only refers to pan-magic squares, and that is quite a high bar. He does not appear to count the possibility of squares that are fully magic (or a normal level of magic), but not pan-magic. Normal magic in a 4×4 square will have unique digits from 1 to 16 in some randomized order, which nevertheless add to 34 in each of its rows, columns and diagonals. Pan-magic goes beyond this and offers multiple symmetrical ways of getting the total, in addition to normal magic.

So, I have a strong hunch that if we ignore pan-magic and stick with normal magic, I think I can state cautiously that we will obtain a number of unique magic squares greater than 3.

The Magic Carpet Method

But first, I wll mention the “magic carpet” technique that Grogono describes for the creation of his randomized 4×4 pan-magic squares. The magic carpet method has been around possibly for centuries, probably as long as magic squares have been around. And if we count China, it would have been for at least a millenia. But “magic carpet” for me conjures up images of Arabic lore and mythology. Indeed, magic squares have been known to Middle Eastern and South Asian culture for centuries as well. For all of its renown worldwide, no one has yet thought of a use for magic squares. It remains a staple of recreational mathematics.

A 4×4 pan-magic square requires four 4×4 magic carpets, or numbers patterned in a 4×4 matrix which resemble the weave of a carpet. Each of the carpets have a different “weave”:

The four magic carpets, expressed as matrices.

Each of a, b, c, and d represents a specific number, namely a power of 2. We get to decide which of a, b, c, or d gets to be the numbers 1, 2, 4, or 8. Once filled out, we add all four matrices to obtain the 4×4 magic square we want. But this gets us a magic number of 30, not 34, and the numbers will go from 0 to 15 rather than 1 to 16. If we add 1 to each number, or rather, add a matrix filled with 1’s, that fixes the problem, and the numbers 1 to 16 are restored, and 34 becomes the magic number.

The fact that the 4×4 magic squares depends on the ordering of four numbers means that potentially there are 4!, or 24 possible magic squares. So, it is not a great yield. Grogono tells us that even these squares boil down to the rotations or reflections of the same 3 pan-magic squares.

This caused me to have a look at the magic squares in question to see if there was any truth to this. For your edification, here are the 24 magic squares below:

8421 8412 8241 8214
16 9 6 3 16 9 7 2 16 9 4 5 16 9 7 2
5 4 15 10 5 4 14 11 3 6 15 10 3 6 12 13
11 14 1 8 10 15 1 8 13 12 1 8 10 15 1 8
2 7 12 13 3 6 12 13 2 7 14 11 5 4 14 11
8142 8124 4821 4812
16 9 4 5 16 9 6 3 16 5 10 3 16 5 11 2
2 7 14 11 2 7 12 13 9 4 15 6 9 4 14 7
13 12 1 8 11 14 1 8 7 14 1 12 6 15 1 12
3 6 15 10 5 4 15 10 2 11 8 13 3 10 8 13
4281 4218 4182 4128
16 5 4 9 16 5 11 2 16 5 4 9 16 5 10 3
3 10 15 6 3 10 8 13 2 11 14 7 2 11 8 13
13 8 1 12 6 15 1 12 13 8 1 12 7 14 1 12
2 11 14 7 9 4 14 7 3 10 15 6 9 4 15 6
2841 2814 2481 2418
16 3 10 5 16 3 13 2 16 3 6 9 16 3 13 2
9 6 15 4 9 6 12 7 5 10 15 4 5 10 8 11
7 12 1 14 4 15 1 14 11 8 1 14 4 15 1 14
2 13 8 11 5 10 8 11 2 13 12 7 9 6 12 7
2184 2148 1842 1824
16 3 6 9 16 3 10 5 16 2 11 5 16 2 13 3
2 13 12 7 2 13 8 11 9 7 14 4 9 7 12 6
11 8 1 14 7 12 1 14 6 12 1 15 4 14 1 15
5 10 15 4 9 6 15 4 3 13 8 10 5 11 8 10
1482 1428 1284 1248
16 2 7 9 16 2 13 3 16 2 7 9 16 2 11 5
5 11 14 4 5 11 8 10 3 13 12 6 3 13 8 10
10 8 1 15 4 14 1 15 10 8 1 15 6 12 1 15
3 13 12 6 9 7 12 6 5 11 14 4 9 7 14 4

Each square is labelled with a 4-digit number denoting, in order, the values of a, b, c, and d used in the magic carpets in constructing each square. I was able to order the squares from the highest 4-digit number to the lowest, to show there are no duplicates.

Asside: The missing square: The Dürer Square

Click here for a previous article I wrote on the Dürer Square.

On a side note, I found that the 4×4 magic square created by Albrecht Dürer and engraved on his 1514 Melancholia carving does not appear to be included in the above set of 24. This is one example of a square that is not pan-magic. Here is the Dürer square:

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

The Dürer square is fully magic (all rows, columns and both diagonals add to 34), and in addition, you can obtain 34 by adding the four corner squares, and again by adding the four central squares. But there is no other way to obtain a total of 34 that uses a pattern with any kind of symmetry that would cause us to group it among the pan-magic squares.

The above square follows the pattern of having 16 on  the upper left, but in addition has the year of the engraving, “1514” at the centre squares of the bottom row. It is sort of like the 2418 square in the above series, but just sort of, and without the distinctive “1514”. It also bears some resemblance to the square 2814. But you will find there will be numbers that break symmetry, and so you can’t just shuffle a column or two to get the Dürer square. If you follow the numbers 1 to 16 in the Dürer square, they appear to follow a magic carpet pattern of some kind, but it doesn’t seem quite like what we did.

In the above series of 24 squares, we can see right away that the squares are unique, since a “16” consistently appears on the upper left corner, precluding the idea that any of these squares are mere rotations or reflections of each other. The only reflection I would imagine to be the case might be reflections along the main diagonal, which extends from the upper left to the lower right. There is another consistency in all of these squares in that they also possess a “1” in the third row, third column.

I can make out adjacent pairs of squares with the same main diagonal, where the other diagonal in the second is the reversal of the first. This is seen throughout the 24 squares, for example the first two squares 8421 and 8412 have 16, 4, 1, and 13 as their main diagonal, while the opposing diagonal in 8421 is 3, 15, 14, 2, which is the reversal of the square 8412. Since I have not seen a pair of squares where the rest of the number follow suit to produce such a reflection (known as a “transposition” in matrix math), this just remains an interesting quirk.

However, Grogono went to the extent of defining any magic square with identical columns as “the same”, even if their ordering of those columns are different. This might be justified from the thinking of matrices as vector systems. Thus, shifting columns is merely just shuffling vectors around, and if these were indeed vector systems, all shufflings of four equations (which these vectors would represent) in four unknowns would yield the same solutions. Thus, it can be argued, matrices with shifted columns are “the same”. Examples I have been able to spot are 4281 and 2481. If you look, you begin to find them everywhere, which is why Grogono was able to reason that there were only 3 squares whose columns are truly unique and “non-shufflable”, if there is such a phrase. All the rest are shufflings of these three.

But I have a problem with this in that, objectively speaking, these are not vector systems. This is just a number game where numbers are distributed in a grid of some kind. It might be helpful to think of this as a matrix, or a table, but the fact remains that this is just a number game, and no one is trying to say these are vector systems or linear systems in four dimensions. I find matrix terminology helpful as well, but we can’t get carried away into the recesses of linear algebra, since that is not what this is about.

What most people who dabble in magic squares mean when they say two squares are “the same” is that if you rotate or reflect the magic square and get the same as another square, then they are the same. I offer a quick  example with 3×3 squares:

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

The middle square is a rotation of the left square. The right square is a reflection of the left square. If we simply either rotate or reflect the other two squares we always get the square on the left. This is why it has been widely stated that only one unique 3×3 magic square exists. According to Grogono, there are 8 variations of this one square, all being rotations or reflections of each other. I will leave it to the reader to find the other five.

So, when someone who knows about magic squares says that squares are the same, they are referring to something “visual” done to it, so that the arrangements of numbers will always be the same relative to each other.

The above 3×3 squares can’t be shuffled, since “9 5 1” and “7 5 3” will always have the immutable property of being either the middle row or the middle column, with “5” always occupying the center square. So, any “shuffling” in a 3×3 is really a reflection, since the outer rows or columns are the only things you are allowed to shuffle. Also notice that the diagonal numbers are immutable as well: “6 5 4” and “8 5 2” are the only game in town for these diagonals. Indeed, rotations and reflections of squares shouldn’t be counted as different, because addition is commutative: 6+5+4 = 4+5+6, for example. Adding the same 3 numbers will get the same total.

In larger squares, if shuffling is observed, I would argue that the squares can be seen as different. The center number, if there is one, can change, and there are no immutable rows or columns that we saw in the 3×3 squares. It still must be conceded that the rows and columns are “the same” due to addition’s commutative property. If you shuffle the columns, then the numbers in the rows are merely in a different order, and so you are still adding the same four numbers. However, the shuffling changes the diagonals, and any other symmetric arrangements which can add up to the magic number, which exist in the above 4×4 pan-magic squares.

One thought on “Recreational Math II: Even-ordered Magic Squares: 4×4”

What are your thoughts?