Diagonalize the following matrix $$A = \begin{bmatrix} -2 & -8 & -12\\ 1 & 4 & 4\\ 0 & 0 & 1\end{bmatrix}$$ and compute $A^{10}$.
I have found that the eigenvalues of $A$ are $\lambda _1 = 0$, $\lambda _2 = 1$, $\lambda _1 = 2$. Then, I found the following eigenvectors who form my matrix $P$.
$$v_1=\left (\begin{matrix}1\\ 1\\ 1\end{matrix} \right ), \qquad v_2=\left (\begin{matrix}-1/4\\ 0\\ -1/2\end{matrix} \right ), \qquad v_3=\left (\begin{matrix}0\\ -1/4\\ 0\end{matrix} \right )$$
At the end my matrix
$$P=\left ( \begin{matrix} 1 & 1 &1 \\ -\frac{1}{4}& 0 &-\frac{1}{2} \\ 0 &-\frac{1}{4} & 0 \end{matrix} \right )$$
In linear algebra, two $n$-by-$n$ matrices $A$ and $B$ are called similar if $B=P^{-1}AP$. I get that
$$B=\left ( \begin{matrix} 0 & 0 & 0\\ 0 &1 &0 \\ 0& 0 & 2 \end{matrix} \right )$$
So is this all good? How can I use that to get value of $A^{10}$?
Notice the following: $B = P^{-1}AP \iff A = PBP^{-1}$.
Now consider $A^2$. We see that $A^2 = (PBP^{-1})(PBP^{-1})$. But since $PP^{-1} = I$, this simplifies to $A^2 = PB^2P^{-1}$. Inductively it should be clear that $A^n = PB^nP^{-1}$.