Prove that if $B$ is a $2 × 2$ matrix commuting with $A$, then $B$ is a diagonal matrix I have the following statement I need to prove:
Suppose $A = \left[
      \begin{array}{cc}
        a&0\\
        0&b\\
      \end{array}
    \right]$ is a diagonal matrix, where $a ≠ b$. Prove that if $B$ is a $2 × 2$ matrix commuting with $A$, then $B$ is a diagonal matrix.
My proof:
In particular, let $B = \left[
      \begin{array}{cc}
        c&0\\
        0&d\\
      \end{array}
    \right]$.
Suppose $B$ is not a diagonal matrix, then the commutative property of diagonal matrices, that is $AB = BA$, should not hold.
We see that $AB = \left[
      \begin{array}{cc}
        ac&0\\
        0&bd\\
      \end{array}
    \right]$ and $BA = \left[
      \begin{array}{cc}
        ca&0\\
        0&bd\\
      \end{array}
    \right]$ which is basically $ \left[
      \begin{array}{cc}
        ac&0\\
        0&bd\\
      \end{array}
    \right]$. 
Since $AB = BA$ this is a contradiction. Thus $B$ is a diagonal matrix.
END OF PROOF
I feel like I'm completely off here. Any guidance would be appreciated.
EDIT: What I got with all the help.
Suppose $A = \left[
      \begin{array}{cc}
        a&0\\
        0&b\\
      \end{array}
    \right]$ is a diagonal matrix where $a ≠ b$.
Let B be an arbitrary matrix $\left[
      \begin{array}{cc}
        w&x\\
        y&z\\
      \end{array}
    \right]$.
By definition, for matrices to be commuting AB = BA must hold.
We see that AB $\left[
      \begin{array}{cc}
        aw&ax\\
        by&bz\\
      \end{array}
    \right]$ and BA = $\left[
      \begin{array}{cc}
        aw&bx\\
        ay&bz\\
      \end{array}
    \right]$. 
For these two matrices to be equal x = y = 0 must be true.
It then follows that B = $\left[
      \begin{array}{cc}
        w&0\\
        0&z\\
      \end{array}
    \right]$ which is indeed a diagonal matrix.
Is this all I need?
 A: The matrix
$$\pmatrix{c&0\cr0&d\cr}$$
is diagonal.  So it makes no sense to say "let $B$ be this matrix, suppose $B$ is not diagonal".  That's just like saying "let $x=100$, suppose $x$ is not positive".
To solve the problem, take
$$B=\pmatrix{w&x\cr y&z\cr}\ ,$$
multiply out $AB=BA$ in terms of components, and prove $x=0$ and $y=0$.  Don't forget the fact that $a\ne b$.
Good luck!
A: You write $B$ as a diagonal matrix to start with, so this is no good. What you want to do is start with an arbitrary $B$ and show that it must be diagonal if it commutes with $A$, where $A$ is diagonal with distinct diagonal components. So write $$B=\begin{bmatrix}a&b\\c&d\end{bmatrix}\qquad\text{and}\qquad A=\begin{bmatrix}x&0\\0&y\end{bmatrix}~,~x\neq y$$
then show that $AB=BA$ implies $c=d=0$ to show that $B$ is diagonal.
A: Take a more general case for B matrix where all the elements are different and then prove that elements on non primary diagonal are equal to zero using the conditions given in question .
