Answer
The set $$S=\left\{\left[\begin{array}{cccc}
1&0&0\\
0&0&0
\\
0&0&0
\\
\end{array}\right], \left[\begin{array}{cccc}
0&0&0\\
0&1&0
\\
0&0&0
\\
\end{array}\right],\left[\begin{array}{cccc}
0&0&0\\
0&0&0
\\
0&0&1
\\
\end{array}\right]\right\}$$
is a basis for the set of all $3 \times 3$ diagonal matrices and the dimension is $3$.
Work Step by Step
Any $3 \times 3$ diagonal matrix has the form
$$\left[\begin{array}{cccc}
a&0&0\\
0&b&0
\\
0&0&c
\\
\end{array}\right], \quad a,b,c \in R.$$
To find a basis for the space of all $3 \times 3$ diagonal matrices, rewrite the above matrix as follows
$$\left[\begin{array}{cccc}
a&0&0\\
0&b&0
\\
0&0&c
\\
\end{array}\right]=a\left[\begin{array}{cccc}
1&0&0\\
0&0&0
\\
0&0&0
\\
\end{array}\right]+b\left[\begin{array}{cccc}
0&0&0\\
0&1&0
\\
0&0&0
\\
\end{array}\right]+c\left[\begin{array}{cccc}
0&0&0\\
0&0&0
\\
0&0&1
\\
\end{array}\right].$$
Hence, the set $$S=\left\{\left[\begin{array}{cccc}
1&0&0\\
0&0&0
\\
0&0&0
\\
\end{array}\right], \left[\begin{array}{cccc}
0&0&0\\
0&1&0
\\
0&0&0
\\
\end{array}\right],\left[\begin{array}{cccc}
0&0&0\\
0&0&0
\\
0&0&1
\\
\end{array}\right]\right\}$$
is a basis for the set of all $3 \times 3$ diagonal matrices and the dimension is $3$.