# Number Theory - Regular Magic Squares (4x4)

Ok, so I think I found a neat way to solve a $4\times4$ regular magic square (A regular square has one of each number from $0$ to $n^2-1$ and is base $n$. So here's how I did it. We have $16$ possible combinations. So first I enter the $00, 11, 22$ and $33$ into the diagonal of the $4\times4$ matrix so that I now have some restrictions on every row and column. Then I set the $(B,1)$ position to $23$ and the $(A,2)$ position with $32$. It would of course work if I switched the positions of the $23$ and the $32$. Now after this, its like a sudoku game of filling it in and we get a regular square which is magic of course. Now why exactly does this work? I have a vague idea but I wanted to know if this has been done.

Now I think it can, but can this be generalized for any $n\times n$ magic square?

• Sorry for the double image. Can someone get rid of that? – Siddhartha Apr 6 '18 at 19:20
• Please use MathJax. For some basic information about writing math at this site see e.g. basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to. $$\bbox[yellow]{\begin{matrix}0 & 23 & 31 & 12 \\ 32 & 11 & 1 & 1 \\ 1 & 1 & 1& 1\\1&1&1&1\end{matrix}}$$ – GNUSupporter 8964民主女神 地下教會 Apr 6 '18 at 19:24
• Are you alowed to use numbers larger than $15$ in $4\times 4$ magic square ? – Youem Apr 6 '18 at 19:28
• @Youem The numbers are written in base $n$, e.g. $33$ in this $4 \times 4$ square corresponds to $15$ in decimal. And writing them in base $n$ is just the point to this technique, as that would allow one to treat the filling in of the numbers as a 'Sudoku' like puzzle: make sure that there are not two numbers with the same digit in the same place in a row, column, or diagonal. – Bram28 Apr 6 '18 at 19:38
• So you're basically constructing a Graeco-Latin square, with the extra constraint that the diagonals are also all different just like the rows/columns. There is no Graeco-Latin square for n=6, but for all other n>2 there are. However I don't know if for all those n the diagonal constraints can be satisfied too. Note however that most magic squares are not derived this way, and (especially for larger n) are much easier to find with other techniques. – Jaap Scherphuis Apr 6 '18 at 20:14