Write down the eigenvalues of the matrix $A$, where $$
A=\begin{pmatrix}
-2&1&-1\\
0&-1&2\\
0&0&1
\end{pmatrix},
$$ and find corresponding eigenvectors. [4]
Find a matrix $P$ and a diagonal matrix $D$ such that $P^{-1}AP=D$, and hence find the matrix $A^n$, where $n$ is a positive integer. [8]