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? 
 A: You could use Diagonalization.
Let $A$ be a matrix then if you diagonalize $A$ then you get $A=PDP^{-1}$ with $B$ as a diagonal matrix and $P^{-1}$ an invertible matrix. If you try for $A^2$, then it is equal to $A^2=PD^2P^{-1}$. Similarly for $A^n=PD^nP^{-1}$
Here are the steps:
$1.$Find the characteristic polynomial $p(t)$ of $A$.
$2.$Find eigenvalues $λ$ of the matrix $A$ and their algebraic multiplicities from the characteristic polynomial $p(t)$.
$3.$For each eigenvalue $λ$ of $A$, find a basis of the eigenspace $E_λ$.
If there is an eigenvalue $λ$ such that the geometric multiplicity of $λ$, dim$(E_λ)$, is less than the algebraic multiplicity of $λ$, then the matrix $A$ is not diagonalizable. If not, $A$ is diagonalizable, and proceed to the next step.
$4.$If we combine all basis vectors for all eigenspaces, we obtained n linearly independent eigenvectors $v1,v2,…,vn$.
$5.$Define the nonsingular matrix $P=[v_1v_2…v_n]$.
$6.$Define the diagonal matrix $D$, whose $(i,i)$-entry is the eigenvalue λ such that the $i^{th}$ column vector $v_i$ is in the eigenspace $E_λ$
$7.$Then the matrix $A$ is diagonalized as $P^{-1}AP=D$
Eigenvalues $$\begin{vmatrix} 2-\lambda & 0 & 1 \\ 0 & -3-\lambda & 0 \\ 1 & 0 & 2-\lambda \end{vmatrix}=0$$$$\lambda=-3,1,3$$
By using the eigenvalues you need to find the eigenvectors, then we get $$P=\begin{bmatrix} 1 & -1 & 0 \\ 0 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}$$and $P^{-1}=\begin{bmatrix}\dfrac12&0&\dfrac12\\ -\dfrac12&0&\dfrac12\\ 0&1&0\end{bmatrix}$$$D=P^{-1}AP$$
$$D=\begin{bmatrix}\dfrac12&0&\dfrac12\\ -\dfrac12&0&\dfrac12\\ 0&1&0\end{bmatrix}\begin{bmatrix}2&0&1\\ \:0&-3&0\\ \:1&0&2\end{bmatrix}\begin{bmatrix} 1 & -1 & 0 \\ 0 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}=\begin{bmatrix}3&0&0\\ 0&1&0\\ 0&0&-3\end{bmatrix}$$Now you can find $$A^n=PD^nP^{-1}$$$$A^n=\begin{bmatrix} \frac12(3^n+1) & 0&\frac12(3^n-1)\\ 0 &( -3)^n& 0 \\ \frac12(3^n-1) & 0&\frac12(3^n+1)\end{bmatrix}$$
A: 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}$$
A: No, that is not true, we can also use other way : 
$A=\begin{pmatrix} 2 & 0&1\\ 0 & -3& 0 \\ 1 & 0&2 \end{pmatrix}$
$A=B+C$
$C=\begin{pmatrix}  0& 0&1\\ 0 & 1& 0 \\ 1 & 0&0 \end{pmatrix}$
$B=\begin{pmatrix} 2 & 0&0\\ 0 & -4& 0 \\ 0 & 0&2 \end{pmatrix}$
$A^n = (B+C)^n = \sum_{k=0}^{n} C_n^k B^k C^{n-k} $
$= \frac{1}{2} \sum_{k=0}^{n} C_n^k \begin{pmatrix} 2^{n-k} & 0&0\\ 0 & (-4)^{n-k} & 0 \\ 0 & 0&2^{n-k} \end{pmatrix} \begin{pmatrix} (-1)^k+1 & 0&(-1)^{k+1}+1\\ 0 & 2& 0 \\ (-1)^{k+1}+1 & 0&(-1)^k+1 \end{pmatrix} $
$=\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}$
