Showing a set of matrices is a basis of all 3x3 magic squares 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?
 A: 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: 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.
