How to determine a basis and the dimension for this vectorspace? Determine a basis and the dimension for the following vectorspace:
\begin{align*} W = \left\{A \in \mathbb{R}^{3 \times 3} \mid A \ \text{is a diagonal matrix and} \ \sum_{i=1}^3 A_{ii} = 0\right\} \end{align*} I know the dimension of all $(3 \times 3)$-diagonal matrices is $3$. A basis for that space would be: \begin{align*} \left\{ \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix},  \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix} \right\} \end{align*} But now there is another condition: the trace should be zero. How should I bring that into account? Will the basis be smaller? 
 A: I think you mean that the dimension of the space of all $3 \times 3$ diagonal matrices has dimension three (the dimension of the space of all $3 \times 3$ matrices is 9).
Let us denote the space of all $3 \times 3$ diagonal matrices by $D_3$. The space you seek, let us call it $W$, is a subspace of $D_3$. You can make a guess about the dimension: If you choose the first two diagonal elements in the matrix to be $a$ and $b$, the last element must be $- a - b$, so the dimension of $W$ seems to be two, since we could pick two elements independently.
You have given a basis for $D_3$, let the basis vectors be $b_1, b_2, b_3$ (corresponding to a one in the first, second and third diagonal position, respectively). Any element $B$ in $D_3$ can be written uniquely as
$$B = \beta_1b_1 + \beta_2b_2 + \beta_3b_3$$
and for this to be in $W$ we must also have
$$\beta_1 + \beta_2 + \beta_3 = 0$$
which removes one "degree of freedom" in our choice (if we choose two of the $\beta$'s, the third is determined by the two we have chosen). If we solve the equation above for $\beta_3$ we get $\beta_3 = - \beta_1 - \beta_2$, which we can plug into our equation for $B$ to get an equation for something in $W$:
$$\beta_1b_1 + \beta_2b_2 + (-\beta_1 - \beta_2)b_3 = \beta_1(b_1 - b_3) + \beta_2(b_2 - b_3)$$
and so a basis for $W$ is given by $\{b_1 - b_3, b_2 - b_3\}$.
A: Note that $A\in W$ if and only if
$$
A=\begin{bmatrix}a&0&0\\0&b&0\\0&0&c\end{bmatrix}
$$
where $a+b+c=0$. It follows that
$$
A=\begin{bmatrix}a&0&0\\0&b&0\\0&0&-a-b\end{bmatrix}
=a\begin{bmatrix}1&0&0\\0&0&0\\0&0&-1\end{bmatrix}+
b\begin{bmatrix}0&0&0\\0&1&0\\0&0&-1\end{bmatrix}
$$
This proves that
$$
\left\{
\begin{bmatrix}1&0&0\\0&0&0\\0&0&-1\end{bmatrix},
\begin{bmatrix}0&0&0\\0&1&0\\0&0&-1\end{bmatrix}
\right\}
$$
spans $W$. Can you prove that these two matrices are linearly independent? Once this is done what can we conclude?
A: $W$ is isomorphic to the plane in $\mathbf R^3$ with equation $x+y+z$. It has dimension $2$, since it's defined by one non-trivial linear equation. A basis is, for instance:
$$\begin{bmatrix}1\\-1\\0\end{bmatrix}\enspace\text{and}\enspace\begin{bmatrix}1\\0\\-1\end{bmatrix}.$$
