# How do you find a basis for the set of all $3 \times 3$ matrices whose rows and columns add up to zero?

If $W$ is the set of all $3 \times 3$ matrices whose rows and columns add up to zero, how would you find a basis for this? There seem to be so many scenarios we'd need to cover, I can't find a way to succinctly find the answer / represent it well.

On a related note, how would you extend the basis to be a basis for $M_3(R)$? (I feel like I might be able to get this one, though, once I can clearly find a basis to begin with.)

-
"a basis" in the body is correct; "the basis" in the title is wrong. The only vector space that has only one basis is $\mathbb F_2$. – joriki Oct 17 '12 at 8:08
Of course! Sorry - I just fixed that. – dmonopoly Oct 17 '12 at 8:39

Douglas' observation that the upper left $2\times2$ submatrix determines the remaining values suggests another solution: We can take the canonical basis for $2\times2$ matrices and fill in the third row and column for each of its elements; the result is

$$\pmatrix{ 1&0&-1\\ 0&0&0\\ -1&0&1}, \pmatrix{ 0&1&-1\\ 0&0&0\\ 0&-1&1}, \pmatrix{ 0&0&0\\ 1&0&-1\\ -1&0&1}, \pmatrix{ 0&0&0\\ 0&1&-1\\ 0&-1&1}\;.$$

-
That's even better! In fact, this easily generalises to $n \times n$. – Douglas S. Stones Oct 17 '12 at 9:01
@Douglas: It also shows that your guess generalizes, since we can build all these by adding up some of your matrices. – joriki Oct 17 '12 at 9:09
It's kind of like sudoku.... neat. I guess you just need the intuition to see these things. Thanks! – dmonopoly Oct 18 '12 at 7:46

Guess: I guess this is a basis: $$\left( \begin{array}{ccc} 1 & -1 & 0 \\ -1 & 1 & 0 \\ 0 & 0 & 0 \\ \end{array} \right), \left( \begin{array}{ccc} 0 & 0 & 0 \\ 1 & -1 & 0 \\ -1 & 1 & 0 \\ \end{array} \right), \left( \begin{array}{ccc} 0 & 1 & -1 \\ 0 & -1 & 1 \\ 0 & 0 & 0 \\ \end{array} \right), \left( \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 1 & -1 \\ 0 & -1 & 1 \\ \end{array} \right).$$

Check: We know the vector space has dimension $4$ over $\mathbb{R}$, (or $\mathbb{Z}$), since once you fill in cells (1,1), (1,2), (2,1) (2,2), the rest is determined.

So, it is sufficient to show that $$\left(\begin{array}{ccccccccc} 1 & -1 & 0 & -1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & -1 & 0 & -1 & 1 & 0 \\ 0 & 1 & -1 & 0 & -1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & -1 & 0 & -1 & 1 \\ \end{array}\right)$$ has full rank (which I did on a computer).

-
Ah, a better guess than mine :-) (but also affording less opportunity to apply some linear algebra :-) – joriki Oct 17 '12 at 8:26
+1, Very nice! Thanks! – Salech Alhasov Oct 17 '12 at 9:10

You have six constraints, one for each row and column, but the sum of the row constraints and the sum of the column constraints are the same, so at most $5$ of the constraints are linearly independent, so the space is at least $4$-dimensional. The matrix of the first five constraints is

$$\pmatrix{ 1&1&1&0&0&0&0&0&0\\ 0&0&0&1&1&1&0&0&0\\ 0&0&0&0&0&0&1&1&1\\ 1&0&0&1&0&0&1&0&0\\ 0&1&0&0&1&0&0&1&0\\ }\;.$$

We can guess three basis vectors by taking the three pairs of indices and placing a $\pmatrix{1&-1\\-1&1}$ matrix in the corresponding entries; that yields

$$\pmatrix{ 1&-1&0&-1&1&0&0&0&0\\ 1&0&-1&0&0&0&-1&0&1\\ 0&0&0&0&1&-1&0&-1&1 } \;.$$

Now we can take the generalized cross product of these $8$ vectors, both to check that they're all linearly independent and to find the fourth basis vector that's orthogonal to all of them. According to Wolfram|Alpha, the result is (proportional to)

$$\pmatrix{0&1&-1&-1&0&1&1&-1&0}\;,$$

so the matrix for one possible basis is

$$\pmatrix{ 1&-1&0&-1&1&0&0&0&0\\ 1&0&-1&0&0&0&-1&0&1\\ 0&0&0&0&1&-1&0&-1&1\\ 0&1&-1&-1&0&1&1&-1&0 } \;.$$

-
+1: nice answer (: – Douglas S. Stones Oct 17 '12 at 8:27