3

I am trying to show that $$\left\{\begin{bmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix},\begin{bmatrix} 0 & 1 & −1 \\ −1 & 0 & 1 \\ 1 & −1 & 0 \end{bmatrix},\begin{bmatrix} −1 & 1 & 0 \\ 1 & 0 & −1 \\ 0 & −1 & 1 \end{bmatrix}\right\}$$ is a basis for the vector space of all 3×3 magic squares (3x3 matrices such that the sum of each row and column and diagonal is equal).

Is there an easy way to do this?

TommyX
  • 35
  • Clearly, the three matrices span a space of magic squares, and they're linearly independent. What's left is to show that the space of all magic squares is a vector space and that it is $3$-dimensional. – Arthur Feb 09 '17 at 20:37
  • Are the three rectangular images immediately following the word "set" in your first sentence obsolete now that you've formatted the three matrices? – amWhy Feb 09 '17 at 20:37
  • @Arthur what's hard is to show that the set spans the space of all 3x3 magic squares. – TommyX Feb 09 '17 at 20:43
  • You could come up with a matrix representing the system of equations you want - that all rows, columns and diagonals have the same sum, and then show that it has a 3 dimensional solution. This may be a bit ugly though.... – A. Thomas Yerger Mar 04 '17 at 04:55

2 Answers2

4

This is really an extension to my comment above. If you denote the entries of the matrix by $a,b,c,d,e,f,g,h,i$, then your condition that all rows and columns and diagonals have the same sum corresponds to the solutions to the matrix equation:

$$ \left[ \begin{array}{ccccccccc|c} 1 & 1 & 1 & 0 & 0 &0 &0 &0 &0 & k\\ 0 & 0 & 0 & 1 & 1 &1 & 0 & 0 &0 & k \\ 0 & 0 & 0 & 0& 0 &0 &1 &1 & 1 & k\\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0&k \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 &k\\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1&k \\ 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 &k\\ 0 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 &k\\ \end{array} \right] $$

Where the first three rows represent the rows, the next three rows represent the columns, and the last two rows represent the diagonals. The $k$ represent any old fixed constant that you want the sums to be, all the same because this square is magic.

I'll work on reducing this matrix for this answer, but I suspect a TI84 or some other calculator can do this faster than I can.

After working this out on pen and paper and doing it improperly (of course, you can never get them right the first time), I went to this site here, and entered the matrix with $k = 1$. It doesn't matter what $k$ is since this variable is going to be free no matter what, and you can just scale that column.

The output given is this: $$ \left[ \begin{array}{ccccccccc|c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2k/3\\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 2k/3 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 &-1 &-1 & -k/3\\ 0 & 0 & 0 & 1 & 0 & 0 & 0 &-1 &-2 & -2k/3 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & k/3\\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 2 & 4k/3 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & k\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ \end{array} \right] $$

This matrix has $2$ free variables, and $k$ is also free like we said above, so this is the $3$ dimensional solution set we wanted. Since you have found $3$ such matrixes that are linearly independent and have the desired property, they must span the set of all magic squares.

A. Thomas Yerger
  • 18,175
  • 4
  • 45
  • 93
  • I did thought about this, but I used Python to reduce the matrix because it is too ugly. But thanks anyways! – TommyX Mar 08 '17 at 03:44
3

Another approach comes from an article by Martin P. Cohen and John Bernard in the Mathematics Teacher, January 1982.

The generic $3\times 3$ magic square can be written in terms of $c$, $e$, and $h$, and therefore has dimension 3.

$ \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix} = \begin{bmatrix} e+h-c & 2e-h & c \\ 2c-h & e & 2e-2c+h \\ 2e-c & h & e-h+c \\ \end{bmatrix} $

The given magic squares are generated by assigning the values:

A: $c=1, e=1, h=1$;

B: $c=-1, e=0, h=-1$;

C: $c=0, e=0, h=-1$.

Then we have that for integers $x, y, z$ and magic squares $A, B, C$, the linear combination $xA + yB +zC$ can generate any magic square. Hence we have a basis for the $3 \times 3$ magic square vector space.

Bryan H-M
  • 143