# Determining the dimension of span$\{AB-BA : A,B \in M_{n \times n}(\mathbb R) \}$

Let $S$ be the subspace , of $M_{n \times n}(\mathbb R)$ (the vector space of all $n \times n$ real matrices ) , generated by matrices of the form $AB-BA$ , where $A,B \in M_{n \times n}(\mathbb R)$ , then how do we prove that $\dim S=n^2-1$ ? The only thing that I can determine is that the trace of all matrices of $S$ is $0$ . Please help

In fact, a matrix $$M$$ is of the form $$AB - BA$$ if and only if it has trace zero. It suffices to verify that the set of matrices of trace $$0$$ is indeed an $$n^2 - 1$$ dimensional space.
For the purposes of this problem, however, it is not necessary to show that every trace zero matrix can be expressed as $$AB - BA$$ (i.e. as a commutator). Instead, it suffices to show that we have a set of commutators than spans the trace-0 subspace. To that end, it suffices to observe the following.
Let $$E_{ij}$$ denote the matrix with a $$1$$ as the $$i,j$$ entry and $$0$$s elsewhere. We have $$E_{ij}E_{pq} - E_{pq}E_{ij} = \delta_{jp} E_{iq} - \delta_{ip} E_{qi},$$ where $$\delta_{ij}$$ is a Kronecker delta. By judiciously selecting $$i,j,p,q$$ in the above, we see that the matrices $$E_{ij}$$ with $$i \neq j$$ and $$E_{ii} - E_{jj}$$ can all be expressed as a commutator