Family of functions from Matrices to Reals I was given this question in one of my interviews. I have tried a lot even after that but I am not able to get a hold of it. Can anybody help me with this.
Function $f$ has the following properties


*

*$f:$ Square Matrix -> Real

*$f(I_n) = 1$ // Identity Matrix of size n maps to one : independent of n

*If $A$ and $B$ both are square matrices of same size then $f(AB) = f(BA)$

*If $A$ and $B$ both are square matrices of same size then $f(mA+nB) = mf(A) + nf(B)$


Describe the family of functions $f$ that satisfies the above criteria.
The only property I was able to obtain was that $f(-A) = -f(A)$
Thanks
 A: Consider the matrix units $\{E_{kj}\}$ where $E_{kj}$ is the matrix with $1$ in the $k,j$ entry and zeroes everywhere else. Note that $f$ is linear, so in particular $f(0)=0$. Then, if $k\ne j$, $$f(E_{kj})= f(E_{kk}E_{kj})=f(E_{kj}E_{kk})=f(0)=0.$$
When $k=j$, 
$$
f(E_{kk})=f(E_{k1}E_{1k})=f(E_{1k}E_{k1})=f(E_{11}).
$$
Using 4, 
$$
1=f(I)=f(\sum_kE_{kk})=\sum_kf(E_{kk})=\sum_kf(E_{11})=nf(E_{11}),
$$
so $f(E_{kk})=1/n$ for all $k$. 
Now, given any matrix $A$, $A=\sum_{kj}a_{kj}E_{kj}$. So
$$
f(A)=f(\sum_{kj}a_{kj}E_{kj})=\sum_{kj}a_{kj}f(E_{kj})=\frac1n\sum_{k}a_{kk}=\frac1n\,\text{Tr}(A).
$$
Comment: any function satisfying 1 and 4 is of the form $A\mapsto \text{Tr}(AH)$ for some matrix $H$. Properties 2 and 3 force $H=\frac1n\,I$.
A: Denote by $A_{ij}$ the matrix with
$$
  [A_{ij}]_{kl} = \begin{cases} 1 & k = l, i\ne k, j \ne k\\
                                1 & k = j, l = i\\
                                1 & l = j, k = i\\
                                0 & \text{otherwise} \end{cases}
$$
And by $E_i$ the matrix 
$$
  [E_{ij}]_{kl} = \begin{cases} 1 & k = i, l = j\\
                             0 & \text{otherwise}\end{cases}
$$
Then we have $A_{ij}E_{ii}A_{ij} = E_{jj}$ and $A_{ij}^2 = I_n$. As $\sum_{i=1}^n E_{ii} = I_n$, 
$$ f(E_{ii}) = f(A_{ij}E_{ij}A_{ij}) = f(A_{ij}^2E_{jj}) = f(E_{jj}) $$
and hence, by linearity $f(E_{ii}) = \frac 1n$ for $1 \le i \le n$. For $i \ne j$, we have $E_{ij}E_{ii} = 0$ and $E_{ii}E_{ij} = E_{ij}$, hence
$$ 0 = f(E_{ij}E_{ii}) = f(E_{ii}E_{ij}) = f(E_{ij}) $$
Now let $A \in \mathrm{Mat}_n(\mathbb R)$, then we have
\begin{align*}
  f(A) &= f\left(\sum_{i,j} a_{ij}E_{ij}\right)\\
       &= \sum_{i,j} a_{ij}f(E_{ij})\\
       &= \sum_i a_{ii} \frac 1n\\
       &= \frac 1n \operatorname{tr}A
\end{align*}
That is $f = \frac 1n\operatorname{tr}$ on $n \times n$-matrices.
