1

Let's assume that I have magic square 3x3 and I know middle number. How many combinations can I create if I try to solve that? Is there a way how to find them all?

  • There is actually only one 3*3 magic square (excluding rotation and reflection). –  Dec 29 '16 at 11:24
  • @Rohan there is only one (up to rotation and reflection) using the numbers $1,2,\dots,9$. If you relax that condition and allow for larger, negative, or repeating numbers you have however this answer which shows magic squares form at least a three dimensional subspace of $\Bbb R^{3\times 3}$, and for any given middle number there are infinitely many magic squares with that as the middle number. – JMoravitz Dec 29 '16 at 11:27
  • I forgot to mention that all integres (zero excluded) are allowed. Numbers in the magic square must be unique. – Jakub Gruber Dec 29 '16 at 11:34

1 Answers1

1

If you have a magic square of sum $N$:

$$\begin{array}{|c|c|c|} \hline a & b & c \\ \hline d & e & f \\ \hline g & h & i \\ \hline \end{array}$$

then if you add or substract the same number from all the cells, you also get a magic square, particularly:

$$\begin{array}{|c|c|c|} \hline a-e & b-e & c-e \\ \hline d-e & 0 & f-e \\ \hline g-e & h-e & i-e \\ \hline \end{array}$$

is a magic square of sum $N-3e$.

So WLOG we can assume that the central number is $0$. Then

$$\begin{array}{|c|c|c|} \hline -a & b & -a+c \\ \hline c & 0 & -c \\ \hline -a+b & -b & a \\ \hline \end{array}$$

is a square number of sum $0$ as long as $2a = b + c$ and $b$ and $c$ are different nonzero integers of the same parity. If you choose $b > c > 0$ with you automatically remove most of the rotations and reflexions.

Particularly, you have this infinite set of solutions:

$$\begin{array}{|c|c|c|} \hline 1-b & b & -1 \\ \hline b-2 & 0 & 2-b \\ \hline 1 & -b & b-1 \\ \hline \end{array}$$

For any $b > 3$. If you want to exclude $0$, just add $n$ to every cell, where $n\not\in \{b,b-1,b-2\}$. Add $n > b-2$ to every cell to only have positive values in the cells.

Darth Geek
  • 12,296