Linear transformation matrix to find trace I'm looking for a matrix that it's product with an $n\times n$ matrix that will return the trace of the matrix. Any ideas of how to build one? 
 A: For any linear transformation $T$ from the space of size $n$ column vectors to size $m$ column vectors, we can always find an $m \times n$ matrix $A$ such that for every column vector $x$ (of size $n$), we have
$$
T(x) = Ax
$$
However, if we have a linear transformation from $n \times n$ matrices to $\Bbb R$, we cannot find a matrix $A$ such that for an $n \times n$ matrix $M$,
$$
T(x) = AM
$$
In order to build the matrix of a linear transformation on any space that does not consist explicitly of column vectors, we need to choose a basis of that space and find the matrix relative to that basis.  

The easier way to answer your question, however, is to think of the linear transformation "trace" without finding its matrix with respect to any basis.  In particular,  note that trace is a map from $\Bbb R^{n \times n}$ to $\Bbb R$.  $\Bbb R^{n \times n}$ is $n^2$ dimensional, and $\Bbb R$ is $1$-dimensional.
The map trace is onto, so the rank of the "trace" operation is $1$.  By the rank-nullity theorem, the dimension of the null-space of the trace operation is $n^2 - 1$.  Note that this null-space is precisely the set of matrices that has a trace of $0$.
Thus, the dimension of the space that you're looking for is $n^2 - 1$.
A: Hint: Let $V=M_n(\Bbb R)$ and $W=\{A\in V:\operatorname{tr}(A)=0\}$. If $A=(a_{ij})\in W$, then $\operatorname{tr}(A)=0$ and so $\sum\limits_{i=1}^n{a_{ii}}=0$. Without loss of generality assume that $a_{11}\neq 0$. Then $a_{11}=-a_{22}-\dotsm-a_{nn}$. Since $A=\sum\limits_{i=1}^n\sum\limits_{j=1}^n{a_{ij}E_{ij}}$, where $E_{ij}$ is the elementary matrix with $1$ at the $ij^\text{th}$-entry and all other entries are zero. Thus we have $A=\sum\limits_{i=2}^n{a_{ii}(E_{ii}-E_{11})}+\sum\limits_{i,j,i\neq j}{a_{ij}E_{ij}}$. Then show that the set $S=\{E_{ii}-E_{11}:2\le i\le n\}\cup\{E_{ij}:1\le i\neq j\le n\}$ is a basis for $W$ and hence $\dim W=n^2-1.$
A: Trace is a non identically zero linear form $$\operatorname{tr}:\mathcal{M}_n(\mathbb{K})\rightarrow\mathbb{K}$$
Therefore the kernel of trace is a hyperplane of $\mathcal{M}_n(\mathbb{K})$ and has dimension $n^2-1$
