TITLE: Solving $X+X^T=tr(X)M$
QUESTION [7 upvotes]: Let $M$ be a $n\times n$ complex matrix.
Solve the equation $X+X^T=tr(X)M$ where $X$ is a $n\times n$ complex matrix.

I've done some case-checking.
Suppose $X$ is a solution.

if $tr(X)=0$, then $X$ is skew-symetric, and any skew-symetric matrix satisfies the equation

if $tr(X)\neq 0$,

if $tr(M)\neq 2$, there's a contradiction.
If $tr(M)=2$, and $M$ is not symetric, we reach a contradiction.
if $tr(M)=2$ and $M$ is symetric, I don't know what to say.



I've prefered an abstract approach so far, should I start looking at what happens with entries ?

REPLY [6 votes]: The remaining case is $M$ symmetric with ${\rm tr}(M)=2$. In this case the set of solutions is
$$S=\{\lambda M+A: A=-A^T,\lambda\in\mathbb{R}\}$$
Indeed, If $X=\lambda M+A$ then
$$
X+X^T=\lambda(M+M^T)=2\lambda M
$$
But this implies also that ${\rm tr}(X)=2\lambda$, So $X$ is a solution.
Conversely, If $X$ satisfies $X+X^T={\rm tr}(X)M$ then, 
$$
\left(X-\frac{1}{2}{\rm tr}(X)M\right)+\left(X-\frac{1}{2}{\rm tr}(X)M\right)^T=0
$$
So $X=\lambda M+A$ where $\lambda=\frac{1}{2}{\rm tr}(X)$ and $A=X-\frac{1}{2}\lambda M$. That is $X\in S$.

REPLY [3 votes]: From the equation:
$$
\begin{align}
X+X^T&=tr(X)M \tag{1}\\
\end{align}$$
it follows that solutions only exist if $M=M^T$, that is $M$ is symmetric, and if $tr(M)=2$.
Define
$$X+X^T=2\,S,\quad X-X^T=2\,A\quad \left[S=S^T,\,A=-A^T,\,tr(A)=0\right]$$
then
$$X=S+A$$
and it follows that $(1)$ becomes:
$$
\begin{align}
2\,S&=tr(S)M \tag{2}\\
\end{align}$$
hence your general solution is of the form:
$$X=aM+A \tag{3}$$
where $a$ is some constant and $A$ is any antisymmetric matrix. To test, insert the solution $(3)$ into $(1)$ to get:
$$\begin{align}
a\left(M+M^T\right)+A+A^T&=a\,tr(M)M \\
a2M&=a2M 
\end{align}$$