Characterization of matrices such that $AX=XA^T$ Let $A \in \mathbb{R}^{n \times n}$. Is $A=aI$, where $a \in \mathbb{R}$, the only class of matrices such that $$AX=XA^T,\quad \forall X\in\mathbb{R}^{n \times n},~X\text{ symmetric}?$$   
 A: To explain with more precision my answer:
Taking $X=I$ the problem becomes the following:
What can be said of $A$ if $AX=XA$ for all symmetric matrix $X$ ?
For any symmetric matrices $X_1$ and $X_2$ you have:
$$A(X_1 X_2)= X_1 A X_2=(X_1 X_2) A$$
But for any $B \in \mathbb{R}^{n \times n}$ there exists $X_1, X_2$ symmetric matrices such that $B=X_1 X_2$ (see for example here).
So $AB=BA$ for all $B \in \mathbb{R}^{n \times n}$ and then $A= a I$.
A: Put $X=I$, we see that $A$ is symmetric. Put $X=vv^T$ for some $v\ne0$, we see that $(Av)v^T=vv^TA=vv^TA^T=v(Av)^T$. Hence $Av$ is a scalar multiple of $v$. That is, $A$ is a matrix such that every nonzero vector is its eigenvector. In general, the only matrices (symmetric or not) with this property are the scalar matrices.
A: As @Delta-u said, with $X=I_n$, you get $A=A^T$. By the spectral theorem, there is an orthogonal matrix $P$ and a diagonal matrix $D$ such that $P^TDP=A$.
Making the change of variables $Y=P^TXP$, we see that $D$ must commute with any symmetric matrix $Y$. Write $D=diag (d_1,\ldots, d_n)$. Assume that $D$ has two different entries. Conjugating by a suitable transposition matrix (which is orthogonal), we may assume that $d_1\neq d_2$ without any loss of generality.
Then the block diagonal symmetric matrix $Y=\begin{pmatrix}0 & 1 & \cr 1 & 0 & \cr  & & I_{n-2}\end{pmatrix}$ does not commute to $D$, hence a contradiction. Therefore, $D=d I_n$. Now $A=dP^TP=dI_n$ since $P$ is orthogonal.
