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? 

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?
