TITLE: When is the trivial solution to this matrix equation the only solution?
QUESTION [5 upvotes]: Consider a possibly-rectangular (only the rectangular case is of real interest) matrix $M$, and two diagonal matrices $D_1, D_2$.
We want
$$D_1 M+M D_2=0$$
Clearly $D_1=0,D_2=0$ is sufficient.
But is is not always necessary:

if $M=0$, any $D_1, D_2$ will do.
If $M$ is diagonal, $D_1=-D_2$ suffices.

What conditions must $M$ obey for the trivial solution $D_1=0,D_2=0$ to be the only solution? Does it suffice that $M$ does not commute with diagonal matrices?

REPLY [4 votes]: There are always infinitely many solutions. Suppose $M$ is a $k\times n$ matrix. Choose $a\in\mathbb{R}$, let $I$ denote the identity matrix and let $D_1 = a I_{k}$ and let $D_2 = -a I_{n}$. Then we get
$$
D_1M + MD_2 = aI_kM + M(-a)I_n = aI_kM-aMI_n = aM - aM = 0.
$$