Matrices that commute with all matrices [duplicate]

Let $Z_n$ be the set of all $n \times n$ matrices that commute with all $n \times n $ matrices. Show that $$Z_n = \{\lambda I_n \ | \ \lambda \in \mathbb R\}$$

($I_n$ is the $n \times n$ identity matrix)

I don't know how to use $E_{ij}$ (matrix with $1$ in $(i,j)$ and $0$ elsewhere) and the elementary matrix $P_{ij}$ to prove this question. Can anyone explain it please?


Notice that

$$E_{ij}E_{kl}=\delta_{jk}E_{il}$$ so if a matrix $$A=\sum_{1\le k,l\le n}a_{kl}E_{kl}$$ commutes with the all the matrices then it commutes with $E_{ij}$ hence we get

$$AE_{ij}=E_{ij}A\iff \sum_{k=1}^n a_{ki}E_{kj}=\sum_{l=1}^n a_{jl} E_{il}$$ so we see that

$$a_{ii}=a_{jj}=:\lambda\;\forall i,j\quad \text{and} \quad a_{ki}=0\;\forall k\ne i$$ hence $A=\lambda I_n$. Finally, it's trivial that $\lambda I_n$ does commute with all the matrices.


Hint: Compute $A E_{ij}$ and $E_{ij} A$. Force them to be equal.