Is This Matrix Diagonalizable? Consider the matrix A below:
$$A = \begin{pmatrix} 3 & 2 & 2 \\ -1 & 0 & -2 \\ 1 & 2 & 4\end{pmatrix}$$
Is the matrix A diagonalizable? If so, then find a diagonal matrix D and an invertible matrix P such that $P^{-1}AP=D$.
I know it is supposed to be diagonalizable but I have tried to solve it and haven't succeeded. The format I'm used to is $A=PDP^{-1}$.
Thanks.

Assuming $A$ is an $n\times n$ matrix, $A$ diagonalizable if $P_A(\lambda)$ has $n$ distinct real roots or if, for each eigenvalue, the algebraic multiplicity equals the geometric multiplicity. So let's find out:
$$P_A(\lambda) = det(A - \lambda I) = det \begin{pmatrix} 3-\lambda & 2 & 2 \\ -1 & -\lambda & -2 \\ 1 & 2 & 4-\lambda\end{pmatrix}$$
$$ = (3-\lambda)((-\lambda)(4-\lambda) + 4) - 2(\lambda - 4 + 2) + 2(-2+\lambda) = 0$$
$$\Rightarrow -\lambda^3+7 \lambda^2-16 \lambda+12 = 0$$
$$\Rightarrow -(\lambda-3) (\lambda-2)^2 = 0$$
$$\lambda = 3 \text{ (multiplicity $1$)}$$
$$\lambda = 2 \text{ (multiplicity $2$)}$$
We see that $\lambda=2$ has algebraic multiplicity 2, so we need to check for its geometric multiplicity.
Geometric multiplicity is equal to $n - Rank(A - \lambda I)$
$$Rank(A - 2I) = dim\left(col\begin{pmatrix} 1 & 2 & 2 \\ -1 & -2 & -2 \\ 1 & 2 & 2\end{pmatrix}\right) $$
$$ = dim\left(col\begin{pmatrix} 1 & 2 & 2 \\ 0 & 0 & 0 \\ 0 & 0 & 0\end{pmatrix}\right)  = 1$$
So $$\text{geometric multiplicity}  = 3 - Rank(A - 2I) = 3 - 1 = 2$$
$$ = \text{algebraic multiplicity when $\lambda=2$}$$
So the matrix is diaginalizable. 
Now we can diaginalize it:
Let's find our eigenvectors.
For $\lambda=2$:
$$\vec{V_1} + \vec{V_2} = null(A - \lambda I) = null(A - 2I) = null\begin{pmatrix} 1 & 2 & 2 \\ -1 & -2 & -2 \\ 1 & 2 & 2\end{pmatrix}$$
$$ = null\begin{pmatrix} 1 & 2 & 2 \\ 0 & 0 & 0 \\ 0 & 0 & 0\end{pmatrix}$$
$$ = \begin{pmatrix} -2 \\ 1 \\ 0\end{pmatrix}x_1 + \begin{pmatrix} -2 \\ 0 \\ 1\end{pmatrix}x_2$$
So our eigenpairs so far are $\left(2, \begin{pmatrix} -2 \\ 1 \\ 0\end{pmatrix}\right)$ and $\left(2, \begin{pmatrix} -2 \\ 0 \\ 1\end{pmatrix}\right)$
Now, to find it for $\lambda=3$:
$$\vec{V} = null(A-\lambda I) = null(A - 3I) = null\begin{pmatrix} 0 & 2 & 2 \\ -1 & -3 & -2 \\ 1 & 2 & 1\end{pmatrix}$$
$$ = null\begin{pmatrix} 1 & 0 & -1 \\ 0 & 1 & 1 \\ 0 & 0 & 0\end{pmatrix} = \begin{pmatrix} 1 \\ -1 \\ 1 \end{pmatrix}x_3$$
So our eigenpair is $\left(3, \begin{pmatrix} 1 \\ -1 \\ 1 \end{pmatrix}\right)$
We now have everything we need to make our diaginalized matrix:
$$PDP^{-1} = \begin{pmatrix}-2 & -2 & 1 \\ 1 & 0 & -1 \\ 0 & 1 & 1 \end{pmatrix}\begin{pmatrix}2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3\end{pmatrix}\begin{pmatrix}-2 & -2 & 1 \\ 1 & 0 & -1 \\ 0 & 1 & 1 \end{pmatrix}^{-1}$$
$$ = \begin{pmatrix}-2 & -2 & 1 \\ 1 & 0 & -1 \\ 0 & 1 & 1\end{pmatrix}\begin{pmatrix}2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3\end{pmatrix}\begin{pmatrix}1 & 3 & 2 \\ -1 & -2 & -1 \\ 1 & 2 & 2\end{pmatrix}$$ 
