For which value of a is matrix A diagonalizable? A = 
        \begin{pmatrix}
    a & -1 & 2 \\
    0 & 0 & 0 \\
    a & -1 & 2 \\
    \end{pmatrix}
I cant seem to find an answer to this, I've tried finding λ but no matter what i always end up with different algebraic and geometry multiplicities.
Edit: 
So far, the Characteristic polynomial I've found is: 
 $\lambda^3+\lambda^2(-2-a)=0$
So when $\lambda= 0$ it should be a double eigenvalue, but then when i try to find the eigenvector related to that eigenvalue i do:
M=     \begin{pmatrix}
    ax & -1y & 2z |0\\
    0x & 0y & 0z | 0\\
    ax & -1y & 2z | 0\\
    \end{pmatrix}
and that makes it : $y = ax+2z$, so basically the eigenvector is generated by :
$x(1,a,0)$ and $z(0,2,1)$ but since they are always linearly independent every value for a is valid, so how can I determine a value for a?
 A: The double eigenvalue is $0$, so the corresponding eigenspace is $\ker A$. Can you determine $\dim(\ker A)$?
A: You have found two independent eigenvectors for the eigenvalue $\lambda=0$ correctly as
$$
v_1=\begin{bmatrix}1\\a\\0\end{bmatrix}\qquad\text{and}\qquad v_2=\begin{bmatrix}0\\2\\1\end{bmatrix}.
$$
The question is: what is the third eigenvalue? If the third eigenvalue is not zero then the matrix is diagonalizable since the eigenvectors with distinct eigenvalues are linearly independent, thus we have found three of such, which make a basis. If the third eigenvalue is zero then we are in trouble, since then the diagonal form must be identical zero (eigenvalues on the diagonal), but the matrix itself is not zero (contradiction!). Try to find the third eigenvector:
$$
\begin{bmatrix}a & -1 & 2\\0 & 0 & 0\\a & -1 & 2\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\lambda\begin{bmatrix}x\\y\\z\end{bmatrix}.
$$
Clearly, if $\lambda\ne 0$ then $y=0$ and $x=z$, thus, for example, $x=z=1$ would work and $\lambda=a+2$
$$
\begin{bmatrix}a & -1 & 2\\0 & 0 & 0\\a & -1 & 2\end{bmatrix}\begin{bmatrix}1\\0\\1\end{bmatrix}=(a+2)\begin{bmatrix}1\\0\\1\end{bmatrix}.
$$
If $a\ne -2$ then it works. If $a=-2$ then the third eigenvalue is zero too, and the matrix is not diagonalizable. This is the exceptional value for $A$ that makes it nilpotent ($A^2=0$). The link I provided in the comments explains the same thing in general: your matrix is
$$
\begin{bmatrix}a & -1 & 2\\0 & 0 & 0\\a & -1 & 2\end{bmatrix}=
\begin{bmatrix}1\\0\\1\end{bmatrix}\begin{bmatrix}a & -1 & 2\end{bmatrix}=uv^T.
$$
It is diagonalizable iff (see the link)
$$
v^Tu\ne 0\qquad\Leftrightarrow\qquad \begin{bmatrix}a & -1 & 2\end{bmatrix}\begin{bmatrix}1\\0\\1\end{bmatrix}=a+2\ne 0.
$$
A: I think you got your answer but here one way I think to deal with it.Before that remember matrix is diagonalizable if algebraic multiplicity and geometric multiplicity of each eigenvalue is same.Here we go now.
From your characteristic polynomial we get $\lambda$=$0$,$0$,$-2-a$.
See if $a=-2$ then $0$ is the only eigenvalue of matrix with algebraic multiplicity 3 but if you calculate geometric multiplicity of $0$ i.e. calculating dim ker$(A-0I)$ (see first and third row of matrix is same)you will see it is 2 which not possible because G.M.is always $<=$A.M.So, now let's assume a$\ne$$-2$.So with no problem eigenvalue $0$ will have both A.M. and G.M. 2 irrespective of the value of a and remaining eigenvalue will have both A.M. and G.M. $1$...So your matrix is diagonalisable for all a except $-2$.
