6
$\begingroup$

A magic square over $\mathbb{Z}$ is an n x n matrix whose entries are $\{1, \ldots, n^2\}$, with the sum of every row and column identical (in particular, my magic squares are all normal, but the sum of diagonal entries need not equal the sum of the rows/columns, which is necessarily $\frac{n(n^2+1)}{2}$). A magic square over $\mathbb{Z}_m$ is the same, except that $\{1, \ldots, n^2\}$ should be interpreted as a multiset of congruence classes modulo m.

Suppose I have an n x n magic square over $\mathbb{Z}_m$. Is there a simple way to tell if it is the image of a magic square over $\mathbb{Z}$ under the (element-wise) canonical projection map $a_{i,j} \mapsto a_{i,j}+m\mathbb{Z}$?

It's easy to come up with examples that are the image of a magic square. But not every one is. Two examples where this may fail are: $m=n=2$

$A= \left( \begin{array}{ccc} 1 & 0 \\ 0 & 1 \end{array} \right)$

and

$m=n=3$

$A= \left( \begin{array}{ccc} 1 & 2 & 0 \\ 1 & 2 & 0 \\ 1 & 2 & 0 \end{array} \right) $

Adding the identity to A in this case gives another counterexample of a slightly less trivial nature.

However, for $m=2$, $n=3$, every magic square over $\mathbb{Z}_2$ is the preimage of a magic square over $\mathbb{Z}$. This is extremely easy to see, since there are 5 ones and 4 zeros, so the matrix must be the image of the Lo Shu Square (up to permuting rows and columns).There are no magic squares with $m=3, n=2$. There are doable larger cases, but none of the ones I tried gave anything that seemed generic.

In general, what I would expect is that for m large compared to n, there won't be any additional ones; this is obvious if $m \ge n^3$ (better bounds are certainly possible). But for m small and n large, there might be more magic squares. And of course, if $m|n$ then cases like the 3x3 above will probably crop up.

The question I'm more interested in than the sort of general results above, though, is for a particular magic square over $\mathbb{Z}_m$, what is a fast way to check if it is the image of a magic square over $\mathbb{Z}$ (if such a way exists at all).

  • 0
    The last column in the second example should consist of $0$s instead of $3$s.2012-04-19
  • 0
    3 was technically still correct, but after looking at it I prefer 0 also, so I've changed it.2012-04-19
  • 0
    The conventional notation for the elements of $\mathbb Z_3$ is $0$, $1$, $2$. If you wanted to use the name $3$ instead, I think it would have to be introduced, and if you were thinking of $3$ as a representative rather than a name, it would have to be $[1]$, $[2]$, $[3]$ instead.2012-04-19
  • 0
    The conventions I have usually seen are not so rigid, namely for any $n \in \mathbb{Z}$, n indicates the element $n+m\mathbb{Z}$ in $\mathbb{Z}_m$. This may only be standard in physics, I'm not sure. Of course this is abuse of notation, and $[n]$ is more correct. In any case, the first paragraph states that all of them should be interpreted as congruence classes, though perhaps this was not clearly stated to extend to later paragraphs. Still, whether or not 3 is incorrect, 0 is certainly correct.2012-04-19

1 Answers 1