Tuesday 4 February 2020

Matrices and Magic Squares

Matrices and Magic Squares

In the last half of January, John Cook posted a blog about Matrices made up of Magic Squares. He pointed out that if you multiply an odd number of 3 × 3 magic squares together, the result is a magic square. He used the three Spanish Magic Squares above from another of his posts as an example. The conjecture is that it would work for squares of any order, but that may not have been proven yet.

Since -1 is an odd number, it followed that the inverse of a magic square matrix would form a magic square also, so I gave it a go on Wolfram Alpha. The oldest and most common magic square known is the one with integers from 1 to 15 with a total for each row, column, and diagonal of 15 (and five in the center square).

And the inverse came out to be:

If you add up any row, column, or diagonal you should get \( \frac{24}{360} = \frac{1}{15}\)  which we might expect, since the product of the inverses has a determinant of one.  To make that happen the sequence of numbers 1 to 9 in the original became the sequence from \( \frac{-32}{360}\) and increasing by \( \frac {1}{15} \) each step until it reaches the highest value.  The center number, as in any 3x3 magic square must be 1/3 of the total. 

If you add up all the numbers in  the original magic square, you get 45.  If you add up all the numbers in the inverse, you get 1/5,  or nine times the center value of  8/360?

If this was consistent in all such inverses of magic square matrices, ... we might expect that in a 5x5 matrix inverse would produce a sum of all the entries that is  1/13?  As it turned out, it did.  And the sum of each row, column, etc would be 1/65. The center term of the 5x5 should then be 1/5 of 1/65, or 1/325, with the 12 numbers above it increasing by 1/13 each, and the 12 below it decreasing 1/13 each.  But when I did the inverse of a 5x5 on Wolfram Alpha, the values were not in the same order as the originals.  For example, the smallest number in the standard 3x3, 1, is in the same position as the smallest number in the inverse, -52/360; but when I did the 5x5, the smallest number was NOT in the same spot as the one, and more importantly, their were numbers that repeated.

Even though the method of placing 1/325 in the center square with increments in order as indicated above will produce a magic square with all the same values suggested for rows, columns, totals, etc, it simply is not the inverse of the classic 5x5 magic square.  The idea that the inverse would produce a magic square is correct, but not in the classic style in which each value is unique and the numbers all form a sequence.  I have not gone on to see if other NxN magic square matrices might have a similar affliction, but would enjoy you sharing your results.

A similar conflict may happen when you cube a magic square matrix.  While the 3x3 comes out as expected, the 5x5 has duplicate values in the upper left and lower right corners.

No comments: