If $X$ is diagonal with distinct diagonal entries and $XY = YX$ then $Y$ is also diagonal.
I was trying to prove this.
I tried as follows -
Since we know that $X$ is of distinct diagonal entries which means that distinct eigenvalues implying that $X$ is diagonalizable.
that is $X = P^{-1}XP$ where $P$ is the matrix whose columns are the eigenvectors of $X$.
Now we are given that $XY = YX$ or $X = Y^{-1}XY$ but this is for all $Y$ I guess.
Now for $Y = P$ it is clear that $Y$ is diagonalizable, but for other $Y$ how we can prove that they are diagonalizable?