Endomorphism of $S_n(\mathbf{R})$ such that $L(O^T S O) = O^T L(S) O$ Let $n \in \mathbb{N}$ such that $n \geq 2$. Let $L$ be an endomorphism of $S_n(\mathbf{R})$ such that:
$$
\forall O \in O_n(\mathbf{R}), \forall S \in S_n(\mathbf{R}), L(O^T S O) = O^T L(S) O
$$
I want to show that there exist $\lambda, \mu \in \mathbf{R}$ such that $L(S) = \lambda S + \mu \textrm{Tr}(S)I_n$ for all $S \in S_n(\mathbf{R})$.
What I have tried:
Denoting $E_i$ the diagonal matrix whose only non-zero coefficient is $1$, at the $(i, i)$ position, we know from the spectral theorem that for each symmetric matrix $S$, there exists $O$ an orthogonal matrix and $\lambda_1, ..., \lambda_n$ (its eigenvalues) such that $S = O^T (\lambda_1 E_1 + ... + \lambda_n E_n) O$. So, $L$ is characterised by the values it takes in the matrices $E_1, ..., E_n$. Therefore, we can reduce the problem to find $\lambda, \mu$ such that for all $i \in \{ 1, ..., n\}, L(E_i) = \lambda E_i + \mu I_n$. Showing that would solve the problem. Maybe showing $L(E_i)$ is diagonal is a good start?
Notations:
$S_n(\mathbf{R})$: Symmetric matrices with real coefficients
$O_n(\mathbf{R})$: Orthogonal matrices (i.e. such that $M^T M = I_n$)
You can use the following theorems:


*

*Let $E$ be a vector space on a field $\mathbf{K}$ and $u$ an endomorphism of $E$ such that for all $x \in E$, there exists $\lambda_x \in \mathbf{K}$ such that $u(x) = \lambda_x x$. This implies there exists a $\lambda \in \mathbf{K}$  such that $\forall x \in E, u(x) = \lambda x$ (same $\lambda$ for all $x$).

*Let $u, v$ be endomorphisms of $E$. If $uv = vu$, the eigenspaces of $u$ are invariant by $v$, and vice-versa.

*You can easily derive the matrix equivalent of these two theorems
 A: Pick an arbitrary unit vector $v$. For every unit vector $u\perp v$, denote by $R_u$ the Householder reflection along $u$, i.e. $R_uu=-u$ and $R_uw=w$ for all $w\perp u$. Since $R_u$ is a symmetric orthogonal matrix, the given condition implies that $L(vv^T)=L(R_uvv^TR_u)=R_uL(vv^T)R_u$ and hence
$$
R_uL(vv^T)=L(vv^T)R_u.
$$
With this equality, one may argue that $v$ is an eigenvector of $L(vv^T)$, $\{v\}^\perp$ is an invariant subspace of $L(vv^T)$ and the restriction of $L(vv^T)$ on $\{v\}^\perp$ is a scalar multiple of the identity map. It follows that $L(vv^T)=a_vvv^T+b_vI$ for some scalars $a_v$ and $b_v$.
Since $v$ is arbitrary in the above, if $w$ is any other unit vector, we also have $L(ww^T)=a_www^T+b_wI$. As $ww^T$ is orthogonally similar to $vv^T$, the given condition implies that $L(ww^T)$ is orthogonally similar to $L(vv^T)$. Therefore, the two matrices have the same spectra, i.e. $\{a_w+b_w,\,b_w\}=\{a_v+b_v,\,b_v\}$. Let $Q$ be an orthogonal matrix such that $Q^Tv=w$. Then
$$
(a_w+b_w)w=L(ww^T)w=L(Q^Tvv^TQ)Q^Tv=Q^TL(vv^T)QQ^Tv=Q^TL(vv^T)v=(a_v+b_v)w.
$$
Hence $a_w+b_w=a_v+b_v$. In turn, $b_w=b_v$.
Thus there exist $a,b\in\mathbb R$ such that $L(vv^T)=avv^T+bI=avv^T+b\operatorname{tr}(vv^T)I$ for every unit vector $v\in\mathbb R^n$. Since every symmetric matrix $S$ is a linear combination of rank-$1$ symmetric matrices, we conclude that $L(S)=aS+b\operatorname{tr}(S)I$.
