For which $a$ is a matrix $A$ diagonalizable? Say I have a matrix $A_a$ with
$$A_a:= \left(\begin{array}{c}
 2 &  a+1  &  0   \\
-a & -3a   & -a   \\
 a &  3a+2 &  a+2
\end{array}\right)$$
I was wondering if there was an easy way to determine for which $a$ the matrix would be diagonalizable.
I tried to determine its eigenvalues first.
$det(A_a - \lambda I_3) = 0$ gave me a rather complex formula, from where on I don't know how to continue.
$0 = 7a \lambda - 6a - 4 \lambda + 4 \lambda^2 - 2a\lambda^2 - \lambda^3 - a^2\lambda + 2a^2$

If you factor the characteristic polynomial, you find it is
$$
(2a^2-6a)-(a^2-7a+4)\lambda+(4-2a)\lambda^2-\lambda^3=
(2-\lambda)(\lambda^2+(2a-2)\lambda+a^2-3a)
$$
If you know this polynomial has three distinct roots, then the matrix is diagonalizable. A root can be repeated only if either


*

*the discriminant of $f(\lambda)=\lambda^2+(2a-2)\lambda+a^2-3a$ is zero, or

*$2$ is also a root of $f(\lambda)$, that is $f(2)=0$.


The first case gives
$$
4(a-1)^2-4(a^2-3a)=0
$$
that is
$$
a^2-2a+1-a^2+3a=0
$$
or
$$
a=-1
$$
The second case gives
$$
4+2(2a-2)+a^2-3a=0
$$
or
$$
4+4a-4+a^2-3a=0
$$
that is,
$$
a^2+a=0
$$
which has the roots $0$ and $-1$.
So, when $a\ne0$ and $a\ne-1$, the matrix is diagonalizable.
For $a=-1$ the characteristic polynomial is $(2-\lambda)^3$ and discussing the eigenspace is easy.
For $a=0$ the eigenvalues are $2$ (double) and $0$ single, so you have to discuss the eigenspace relative to $2$.
