Showing two linear functionals are the same up to constant "$g(A) = qtr(A)$" The original problem is this 

If $g: M_2(\mathbb{R}) \to \mathbb{R}$ satisfies $g(AB) = g(BA)$, then there is a constant $k$ such that $g(A) = ktr(A)$ where $tr$ is the trace.

So after reading a bit, this identification is given when messing a bit with their kernels 
Is there a more obvious solution? It wasn't clear to me to look at this general case.
 A: Let $E_1=\begin{pmatrix}1&0\\0&0\end{pmatrix},E_2=\begin{pmatrix}0&1\\0&0\end{pmatrix},E_3=\begin{pmatrix}0&0\\1&0\end{pmatrix}$ and $E_4=\begin{pmatrix}0&0\\0&1\end{pmatrix}$.
If we can show that $$g(E_1)=g(E_4)=k \text{ and } g(E_2)=g(E_3)=0,\quad (*)$$ then
$$g\begin{pmatrix}a&b\\c&d\end{pmatrix}=ag(E_1)+bg(E_2)+cg(E_3)+dg(E_4)=k(a+d)=k\cdot\text{tr}(A)$$
as we want. Hence it is enough to show that $g$ satisfies $(*)$.
Note that by the condition $g(AB)=g(BA)$ we have
$$g(E_2)=g(E_1E_2)=g(E_2E_1)=g(0)=0$$
and
$$g(E_3)=g(E_4E_3)=g(E_3E_4)=g(0)=0 $$
Now
$(E_1+E_3)(E_1+E_2)=E_1+E_2+E_3+E_4$ and $(E_1+E_2)(E_1+E_3)=2E_1$. Then
$$g(2E_1)=g(E_1+E_2+E_3+E_4)=g(E_1)+g(E_4)$$ which implies that
$$g(E_1)=g(E_4)=k \text{ for some } k\in \mathbb{R}.$$
Hence we are done.
A: We can use the same idea if $g:M_n(\mathbb{R})\to\mathbb{R}$. The idea is that if $B$ is a basis of $M_n$, also $g$ and $\text{tr}$ agree on $B$ up to some constant multiple $\alpha$, then $$g(A)=\alpha\cdot \text{tr}(A) $$ for all $A\in M_n$.
Let $E_{i,j}$ be the matrix where all the entries are zero except it is 1 at the position $(i,j)$. Let $T_k=\text{diag}(\underbrace{1,1,\ldots,1}_k,0,\ldots,0)$. Notice that for $i\neq j$ we have $E_{i,j}T_j=E_{i,j}$ while $T_jE_{i,j}=0$. Therefore for all $i\neq j$ we have $g(E_{i,j})=0$.
Now let $J_k$ be a $k\times n$ matrix where all the entries are 1. Define an $n\times n$ matrix $S_k$ as a block matrix $$S_k:=\begin{pmatrix}J_k\\0\end{pmatrix}$$.
Note that since $g(E_{i,j})=0$ for $i\neq j$, we have $g(S_k)=g(T_k)$ for all $k$.
Now 
\begin{align*}
S_kS_1&=S_k \\ S_1S_k&=kS_1
\end{align*} 
Hence $g(T_k)=g(S_k)=g(kS_1)=kg(S_1)=kg(T_1)$. Notice that the trace map also satisfies $\text{tr}(T_k)=k$. By taking $\alpha=g(T_1)$ then $g$ and $\alpha \cdot \text{tr}$ are two linear maps that agree on $B=\{E_{i,j}\mid i\neq j\}\cup \{T_k\mid k=1,..,n\}$ which is a basis of $M_n$. Hence $g=\alpha\cdot \text{tr}.$
