<s>[INST] Finding n-th term of a matrix I have to find the n-th power of the following matrix $$A=\begin{pmatrix} 2 & 0&1\\ 0 & -3& 0 \\ 1 & 0&2 \end{pmatrix}
$$ I computed a few powers $$A^2=\begin{pmatrix} 4+1& 0&4\\ 0 & 9& 0 \\ 4 & 0&1+4\end{pmatrix}$$
$$A^3 =\begin{pmatrix} 14 & 0&13\\ 0 & -27& 0 \\ 13& 0&14\end{pmatrix}$$
$$A^n=\begin{pmatrix} \frac12(3^n+1) & 0&\frac12(3^n-1)\\ 0 &( -3)^n& 0 \\ \frac12(3^n-1) & 0&\frac12(3^n+1)\end{pmatrix}$$  And is just induction left which is easy, but I found by check and try the n-th term, is it possible to find it in a proper way? 
 [/INST] HINT
$A$ is a real and symmetric matrix therefore we can diagonalize that is find $P$ such that
$$A=PDP^{-1} \implies A^n=\overbrace{PDP^{-1}PDP^{-1}\ldots PDP^{-1}}^{n\,terms}=PD^nP^{-1}$$
</s>