basic linear algebra question, proving it is a diagonal matrix and scalar matrix. Let A = $(a_{ij})_{n\times n}$ such that $AB = BA$ for every square matrix $B$ of order $n$.
$(I)$ Prove that $A$ is a diagonal matrix. 
[Hint: Let $B_i$ denote the matrix whose $(i,i)$ entry is $1$, and $0$ elsewhere. Show
that $a_{ij} = 0$ whenever $i ≠ j$.]
$(II)$ Prove that $A$ is a scalar matrix. 
[Hint: For $i ≠ j$, let $B_{ij}$ denote the matrix whose $(i,j)$-entry is $1$ and $0$ elsewhere.Show that, $a_{ii} = a_{jj}$ for all $i ≠ j$.]
Can someone help me with this question using basic linear algebra concepts? Thanks.
 A: i) You have the matrix $(B_i)_{kl}=\delta_{ik}\delta_{il}$, where $\delta_{rs}$ is the matrix with only $1$'s in the diagonal and the rest zeros.
The multiplication $AB_i$ is then
$$(AB_i)_{rs}\,=\,\sum_{r}A_{rk}(B_i)_{ks}\,=\,\sum_{k}A_{rk}\,\delta_{ik}\delta_{is}\,=\,A_{ri}\delta_{is}$$
Thus $AB_i$ is the matrix with all zeros except for its $s=i$-th column which contains the $i$-th column of $A$ -given by $A_{ri}$ where $r=1,\cdots,n$.
Analogously the multiplication $B_iA$ gives
$$(B_iA)_{rs}\,=\,\sum_{k}(B_i)_{rk}A_{ks}\,=\,\sum_{k}\,\delta_{ir}\delta_{ik}\,A_{ks}\,=\,A_{is}\delta_{ir}$$
This, however, is is the matrix with all zeros except for its $r=i$-th row which contains the $i$-th row of $A$ -given by $A_{is}$ where $s=1,\cdots,n$.
From the arrangement of both results, you can readily infer the conclusion sought. Indeed, a "row matrix" (by that I mean it's all zeros except within a given row) can never be equal to a "column matrix" (analogous but within a column) unless all values of the row in one matrix and the column in the other are zero, except maybe the diagonal elements in each case. This means 
$$A_{ri}=0 \; (r\neq i)$$ 
ii) Let's consider now the matrix $B$ whose entries $k,l$ are $(B_{ij})_{kl}=\delta_{ki}\delta_{jl}$. Proceeding as before we see that $(AB_{ij})_{rs}=A_{ri}\delta_{js}$ and $(B_{ij}A)_{rs}=\delta_{ri}A_{js}$. Equating this two results, and considering that the deltas bound the values of $r$ and $s$ to $i$ and $j$, respectively, leads to $A_{ii}=A_{jj}$.
We can call that number $a$. Thus we have proven that $A=a\mathbb{1}$ a multiple of the identity matrix.
