# Magic Matrices?

Can you determine any number of magic squares, that when treated as matrices, can be applied mathematical operations to return a new magic-matrix?

You cannot use the same matrix twice!

The answer should be given as a mathematical equation using the matrices you find.

Magic squares follow the general magic square rules, they contain 1, .., $n \times n$ once, and each row, column, and diagonal sum to 1 number.

Allowed Operations: Add, Subtract, Multiply, Exponention, Logarithms

• Must an n by n magic square contain each of the numbers 1 through $n^2$ exactly once? What are the allowed operations? – Lopsy Dec 21 '14 at 4:17
• @Lopsy See my edit. – warspyking Dec 21 '14 at 4:26
• Do you mean the operations to act on matrices or their elements? Precisely what operations are allowed? – xnor Dec 21 '14 at 6:59
• Anybody have any idea who downvoted? I honestly don't see any reason... – warspyking Dec 21 '14 at 15:00
• @warspyking "Are there any integer solutions to $2^x+\lfloor \sqrt{x} \rfloor = y^4$?" Scrap. "Are there any integer solutions to $x^n+y^n=z^n$?" 358 years of interest. The monk asks, "Why is one question more worthy than another?" His master answers, "Now you have asked a worthy question." – Lopsy Dec 21 '14 at 15:53

It is possible.

Fix $n$. Let $M$ denote the set of all $n$-by-$n$ magic squares. $M$ is really huge - for $n=6$, we have $|M| \sim 10^{19}$ (see OEIS).

Consider all $2^{|M|}$ sums of subsets of $M$. Each one is an $n$-by-$n$ matrix whose entries are positive integers which are at most $n^2|M|$. There are $(n^2|M|)^{n^2}$ matrices which fit this description.

If $|M|$ is large enough, then $2^{|M|} > (n^2|M|)^{n^2}$. Then by Pigeonhole, two of the sums of subsets are equal. Using this equality, we can express one of the magic squares as a sum/difference of others.

What is "large enough"? Taking logs on the inequality, we find that even $|M|=O(n^3)$ is large enough for sufficiently large $n$. For $n=4,5,6$ this works. I cannot find any references to back this up, but I bet there are enough magic squares that this works for all $n\geq4$.

If we consider two magic squares that differ by a rotation distinct, then here's an example with $3\times 3$ squares. Let $$M_1=\left[\begin{array}{ccc}4&9&2\\3&5&7\\8&1&6\end{array}\right],\,M_2=\left[\begin{array}{ccc}8&3&4\\1&5&9\\6&7&2\end{array}\right],\,M_3=\left[\begin{array}{ccc}6&1&8\\7&5&3\\2&9&4\end{array}\right],M_4=\left[\begin{array}{ccc}2&7&6\\9&5&1\\4&3&8\end{array}\right].$$ Then we can compute $$M_1+M_3=M_2+M_4=\left[\begin{array}{ccc}10&10&10\\10&10&10\\10&10&10\end{array}\right],$$ so that the equation $M_1+M_3-M_2=M_4$ gives a solution to the problem.

• Your finished product doesn't include the numbers 1, ..., $n \times n$ not to mention, you didn't even add properly? 4 + 8 + 6 + 2 don't equal 10... – warspyking Dec 21 '14 at 15:03
• @warspyking Read the answer more carefully. He is not just adding all four matrices. – Lopsy Dec 21 '14 at 15:15
• Oh oops, I misread that = as a + (how on earth did I do that? Lol!) – warspyking Dec 21 '14 at 15:19