Endomorphism of $\mathcal{M}_n(\mathbb{R})$ such that $ f({}^t M)={}^t f(M)$ I and a friend are trying to find all endomorphisms $f$ of $\mathcal{M}_n(\mathbb{R})$ such that $f({}^t M)={}^t f(M)$ for all $M$. We believe they are of the form $M\mapsto\lambda M+\mu {}^t M$ for a fixed $(\lambda,\mu)\in\mathbb{R}^2$. Any help is appreciated, thank you.
 A: Let $f$ be a linear endomorphism on $M_n(\mathbb R)$. Then
$$
f(M^T)=f(M)^T\quad\forall M\tag{1}
$$
if and only if
$$
f(M)=\frac12\left(g(M)+g(M^T)^T\right)\quad\forall M\tag{2}
$$
for some endomorphism $g$.
Given $g$, it is straightforward to verify $(1)$ when $f$ is defined by $(2)$. Conversely, given any $f$ that satisfies $(1)$, condition $(2)$ is satisfied by taking $g=f$.
Alternatively, note that $(1)$ is satisfied if and only if $f$ preserves both symmetric and skew-symmetric matrices. Hence such an $f$ takes the form of $f(M)=h\left(\frac{M+M^T}{2}\right)+k\left(\frac{M-M^T}{2}\right)$ where $h$ is an endomorphism defined on the space $\mathcal H_n$ of all symmetric matrices and $k$ is an endomorphism defined on the space $\mathcal K_n$ of all skew-symmetric matrices. Therefore the dimension of the space of all such $f$s is
$$
\dim\operatorname{End}(\mathcal H_n)+\dim\operatorname{End}(\mathcal K_n)
=\left[\frac{n(n+1)}{2}\right]^2+\left[\frac{n(n-1)}{2}\right]^2
=\frac{n^2(n^2+1)}{2}.
$$
A: First, consider a basis of the space $\mathcal{M}_n$. For example, the $n^2$ elementary matrices $e_{ij}$ which are all zero's except a $1$ in the $(i,j)$ spot. An element $f \in \mathrm{End}(\mathcal{M}_n)$ is determined by where it sends each $e_{ij}$. Call these $M_{ij}$, so that $f(e_{ij}) = M_{ij}$. Then for an arbitrary matrix $A$ with entries $a_{ij}$, you have
$$ f(A) = \sum_{i,j} a_{ij} M_{ij} $$
Now, you want to consider when $f$ commutes with the transpose operation. Consider this in the special case of the basis elements $e_{ij}$. Notice that ${}^te_{ij} = e_{ji}$, so the condition becomes :
$$
\begin {align*}
f({}^te_{ij}) &= {}^tf(e_{ij}) \\
f(e_{ji}) &= {}^tM_{ij} \\
M_{ji} &= {}^tM_{ij}
\end {align*}
$$
