Answer: The eigenvalues are \(-2,-1,1\).
Corresponding eigenvectors can be taken as
\(\begin{pmatrix}1\\0\\0\end{pmatrix},\quad \begin{pmatrix}1\\1\\0\end{pmatrix},\quad \begin{pmatrix}0\\1\\1\end{pmatrix}.\)
One suitable choice is
\(\mathbf P=\begin{pmatrix}1&1&0\\0&1&1\\0&0&1\end{pmatrix},\qquad \mathbf D=\begin{pmatrix}-2&0&0\\0&-1&0\\0&0&1\end{pmatrix}.\)
Then
\(\mathbf A^n=\begin{pmatrix}(-2)^n&-(-2)^n+(-1)^n&(-2)^n+(-1)^{n+1}\\0&(-1)^n&(-1)^{n+1}+1\\0&0&1\end{pmatrix}.\)
Since \(A\) is upper triangular, its eigenvalues are the diagonal entries:
\(\lambda=-2,-1,1\).
Now find eigenvectors one by one.
For \(\lambda=-2\), solve \((A+2I)x=0\):
\(A+2I=\begin{pmatrix}0&1&-1\\0&1&2\\0&0&3\end{pmatrix}\).
From the last row, \(z=0\). Then the second row gives \(y=0\), and \(x\) is free. So an eigenvector is \(\begin{pmatrix}1\\0\\0\end{pmatrix}\).
For \(\lambda=-1\), solve \((A+I)x=0\):
\(A+I=\begin{pmatrix}-1&1&-1\\0&0&2\\0&0&2\end{pmatrix}\).
Then \(z=0\), and the first row gives \(y=x\). So an eigenvector is \(\begin{pmatrix}1\\1\\0\end{pmatrix}\).
For \(\lambda=1\), solve \((A-I)x=0\):
\(A-I=\begin{pmatrix}-3&1&-1\\0&-2&2\\0&0&0\end{pmatrix}\).
The second row gives \(z=y\), and the first row then gives \(x=0\). So an eigenvector is \(\begin{pmatrix}0\\1\\1\end{pmatrix}\).
Take these eigenvectors as the columns of \(P\), in the same order as the eigenvalues in \(D\):
\(P=\begin{pmatrix}1&1&0\\0&1&1\\0&0&1\end{pmatrix},\qquad D=\begin{pmatrix}-2&0&0\\0&-1&0\\0&0&1\end{pmatrix}.\)
Then \(P^{-1}AP=D\), so \(A=PDP^{-1}\) and therefore \(A^n=PD^nP^{-1}\).
Now \(D^n=\operatorname{diag}(( -2)^n,(-1)^n,1)\). Also, since \(P\) is unit upper triangular,
\(P^{-1}=\begin{pmatrix}1&-1&1\\0&1&-1\\0&0&1\end{pmatrix}\).
Hence
\(D^nP^{-1}=\begin{pmatrix}(-2)^n&-(-2)^n&(-2)^n\\0&(-1)^n&(-1)^{n+1}\\0&0&1\end{pmatrix}.\)
Multiplying by \(P\) gives
\(A^n=\begin{pmatrix}(-2)^n & -(-2)^n+(-1)^n & (-2)^n+(-1)^{n+1}\\0 & (-1)^n & (-1)^{n+1}+1\\0&0&1\end{pmatrix}.\)