A matrix $M$ that commutes with any matrix is of the form $M=\alpha I$

I feel like this is probably a simple proof but I can't quite come up with it in an elegant way nor could I find it here.

Prove that if a matrix $M$ commutes with any matrix then $M$ is of the form $M=\alpha I$.

Proving the contrapositive seems like the natural way to go where we can logically transform $\lnot \forall A(MA = AM)$ into $\exists A (MA \neq AM)$ but assuming that $M \neq \alpha I$ immediately becomes messy. Is there a nice way out of this or is it inevitably going to get messy?


Here is a coordinate-free proof. For any nonzero vector $x$, let $B$ be a linear map whose null space is spanned by $x$. Then $Ax\in\ker B$ because $B(Ax)=ABx=0$. As $\ker B$ is one-dimensional, $Ax=\lambda_xx$ for some scalar $\lambda_x$ that may depend on $x$.

Now, given any two nonzero vectors $x$ and $y$, if they are linearly dependent, then $y=kx$ for some scalar $k$. It follows that $\lambda_xy=\lambda_xkx=k\lambda_xx=kAx=Ay=\lambda_yy$ and hence $\lambda_x=\lambda_y$.

If $x$ and $y$ are linearly independent instead, then $0=Ax+Ay-A(x+y)=\lambda_xx+\lambda_yy-\lambda_{x+y}(x+y)$. By linear independence, we must have $\lambda_x=\lambda_{x+y}=\lambda_y$.

In other words, the factor $\lambda_x$ is identical for every nonzero vector $x$, i.e. there exist some $\lambda$ such that $Ax=\lambda x$ for every $x$, meaning that $A=\lambda I$.


We can do this by inspection. Suppose $A$ commutes with every matrix. Let $E_{ij}$ have all entries zero except the $(i,j)$-th entry, which is $1$ . Then $$\delta_{\ell j}a_{ki}=[AE_{ij}]_{k\ell}=[E_{ij}A]_{k\ell}=\delta_{ki}a_{j\ell}$$ so if $\ell\ne j$ setting $k=i$ gives us $a_{j\ell}=0$, hence $A$ is diagonal. If $\ell=j$ and $k=i$ we get $a_{ii}=a_{jj}$, hence $A$ is scalar.


Here is a hint:

Let $E_{ij}$ be the matrix with a one in the $ij$th position and zeros everywhere else. Write down what it means for $$ M E_{ij} = E_{ij} M $$ to hold, in terms of the entries of $M$.


Here's somewhat of an overkill answer for what it is worth.

A normal matrix is a matrix that is unitarily similar to a diagonal matrix. Another characterization is that a matrix $M$ is normal iff $M^* M = M M^*$.

If $M$ commutes with all matrices then it is clear it is normal. From this we have $M = UDU^*$ for some unitary matrix $U$. Write $MU = UDU^* U = UD$ and then use commutativity to write $UM = UD$. Finally cancel the $U$'s to conclude that $M$ must be diagonal.

Then if $P$ is the elementary matrix that swaps rows $i$ and $j$ when applied to $M$ as $PM$, since $MP$ swaps columns and is the same as $MP$, we conclude each diagonal element is the same.