# Finding a non commuting matrix $M$ such that $AMA=MAA$ for all non invertible $A$.

Is it possible to create an $n \times n$ matrix $M$ such that $AMA=MAA$ for all non-invertible $n \times n$ matrix $A$?

Clearly, we can find an $M$, for say the identity, that commutes with all $A$'s and satisfies $AMA=MAA$.

So my real question is can we find a matrix $M$ such that $AMA=MAA$ for all non-invertible $A$ such that $M$ does not commute with all $A$'s. I feel like I might be missing something trivial and this is not possible. Nonetheless, I would appreciate any comments/responses. Thank you!

• Hint: start with A that have all but one matrix entry equal to $0$. Commented Jun 8, 2018 at 2:58

Consider a projection matrix onto a subspace $V$ of dimension $1$. Then $A^2=A$ first of all, and $AMA=MA$ implies that the range of $MA$ is a subset of the line $V$. Since the line $V$ is the range of $A$, it implies that $V$ is an eigendirection for $M$. Since this is true for all $V$ of dimension $1$, $M$ has to be a multiple of the identity matrix (classic exercise).
1. $M$ has to be diagonal. Consider the non-invertible projection matrix $P_i$ whose only non-zero entry is the $i$-th diagonal entry and is equal to $1$. Note that $P_i^2=P_i$, so you want $$P_iMP_i=MP_i$$ which implies that the $i$-th column of $P$ is full of zeroes except on the diagonal. This being true for all $i$ implies that $M$ is diagonal.
2. all diagonal coefficients must be the same. Consider $A$ with the first column full of ones, and all other columns full of zeroes. Again $A^2=A$. Now $MA$ has as first column the diagonal of $M$, and $AMA$ has a first column full of the first entry in the diagonal of $M$.