the vector space of Magic Squares Can anyone offer help? I have no clue how to do this problem.
Magical squares are 3 by 3 matrices with the following properties: the sum of all numbers in each row, and in each column, and in each diagonal is equal. This number is called the magical number. 
(i)Prove that the set of magical squares forms a vector space with the usual matrix addition and scalar-matrix product. 
(ii) Find a basis of the vector space of magical squares and determine its dimension.
 A: The given relations correspond to a homogeneous system of linear equations for the $9$ entries (ordered left to right, top to bottom) and the negated sum, with the following matrix:
$$
\pmatrix{
1&1&1&0&0&0&0&0&0&1\\
0&0&0&1&1&1&0&0&0&1\\
0&0&0&0&0&0&1&1&1&1\\
1&0&0&1&0&0&1&0&0&1\\
0&1&0&0&1&0&0&1&0&1\\
0&0&1&0&0&1&0&0&1&1\\
1&0&0&0&1&0&0&0&1&1\\
0&0&1&0&1&0&1&0&0&1
}
$$
This matrix has rank $7$ over the real numbers (as you can establish by hand or using Wolfram|Alpha), so the solution set is a vector space of dimension $10-7=3$. If the squares are meant to contain real numbers, their addition and scalar multiplication correspond to those of these solution vectors, so the squares also form such a vector space.
A: Assuming the entries of your magic square belong to some field of characteristic zero to avoid complications, the given relations tell us that a generic magic square looks like
$$\begin{pmatrix}a & 2a -4b +3c & b \\ c & a -b + c & 2a - 2b + c \\ 2a - 3b + 2c & 2b-c &a-2b+2c\end{pmatrix}$$
with magic number $3a -3b+3c$.
Thus your space has dimension $3$. (Verifying that the set of magic squares really forms a subspace of the space of $3 \times 3$ matrices with coefficients in the chosen field is routine; alternatively, this argument shows that the set of all magic squares is precisely the span of three specific magic squares, namely the ones obtained by setting exactly one of $a,b,c$ equal to $1$ and the rest to zero.)
A: (i) The map "compute the sum of elements in row $i$" (or in column $j$, or in one of the diagonal) is a linear map from the vector space of $3\times 3$ matrices to the base field, hence so is each difference of such maps. The set of magic squares is the intersection of the kernels  of these difference maps, hence  a subspace.
A: Here's an easy way to do this for general $n$: given a magic number $S$, consider the topleft $(n-1)$ by $(n-1)$ submatrix of the square. Given these values, one can fill in the margins by subtracting rows and columns of the submatrix from $S$, and the bottom-right entry by subtracting the diagonal of the submatrix from $S$.
The only equations remaining to satisfy are: (1) the sum of each new margin equals $S$ and (2) the sum of the non-principal diagonal equals $S$. The condition (1) is the same for each margin (because the last column can be determined given all the rows and all the other columns). So the conditions are, where $1\le i,j\le n$ and $1\lt k\lt n$:
$$\sum_{i}a_{ii}=(n-1)S-\sum_{ij}a_{ij}$$
$$\sum_k a_{k(n-k+1)}+\sum_j a_{1j}+\sum_i a_{i1}=S$$
These can be checked to be linearly independent for $n>2$. Allowing $S$ to be free, the dimension of our space is therefore $(n-1)^2-2+1$, which equals: 
$$n^2-2n$$
Which indeed gives 3 in the case $n=3$ Meanwhile, for $n=1$ and $n=2$, the dimension is clearly 1.
