<s>[INST] When is matrix $A$ diagonalizable? I got the following matrix:
$$ A = 
        \begin{pmatrix}
        a & 0 & 0 \\
        b & 0 & 0 \\
        1 & 2 & 1 \\
        \end{pmatrix}
$$
I need to answer when this matrix is diagonalizable.
Its characteristic polynomial is $ t(t-a)(t-1) $. So its 3 eigenvalues are 0, 1 and a. Both the algebraic and geometry multiplicities of those values are 1 (for all of them).
Let's look at the matrices for those eigenvalues:
$$ A - 0I = 
        \begin{pmatrix}
        a & 0 & 0 \\
        b & 0 & 0 \\
        1 & 2 & 1 \\
        \end{pmatrix}
$$
$$ A - I = 
        \begin{pmatrix}
        a -1 & 0 & 0 \\
        b & -1 & 0 \\
        1 & 2 & 0 \\
        \end{pmatrix}
$$
$$ A  - aI = 
        \begin{pmatrix}
        0 & 0 & 0 \\
        b & -a & 0 \\
        1 & 2 & 1 - a \\
        \end{pmatrix}
$$
$\rho (A - 0I) = 2 $
$\rho (A - 1I) = 2 $
$\rho (A - aI) = 2 $
It seems that for every $a$ and $b$ this matrix would be diagonalizable.
But it's not. Where am I wrong?
 [/INST] 1) If $a\ne 0, 1,\;$ then A is diagonalizable since it has 3 distinct eigenvalues.
2) If $a=0$, then A is diagonalizable $\iff$ $\text{nullity}(A-0I)=\text{nullity}(A)=2 \iff \text{rank}(A)=1$
$\hspace{2.3 in}\iff\text{rank}\begin{pmatrix} 0&0&0\\b&0&0\\1&2&1\end{pmatrix}=1\iff b=0$
3) If $a=1$, then A is diagonalizable $\iff$ $\text{nullity}(A-1I)=\text{nullity}(A-I)=2 \iff \text{rank}(A-I)=1$
$\hspace{2.3 in}\iff\text{rank}\begin{pmatrix} 0&0&0\\b&-1&0\\1&2&0\end{pmatrix}=1\iff b=-\frac{1}{2}$
</s>