Powers of a Square Matrix

To find power of a square matrix
$\mathbf{M}$
start by find eigenvalues and corresponding eigenvectors.
Using the eigenvalues form the matrix
$\mathbf{D}$
with eigenvalues along the leading diagonal and all other entries equal to zero, and with the igenvectors form the matrix
$\mathbf{P}$
with each eigenvector in the column of its corresonding eigenvalue in the matrix
$\mathbf{D}$
.
The relationship between
$\mathbf{M} , \mathbf{D} , \mathbf{P}$
is
$\mathbf{M} = \mathbf{P} \mathbf{D} \mathbf{P}^{-1}$

$\mathbf{M}^n =\underbrace{ \mathbf{P} \mathbf{D} \mathbf{P}^{-1} \mathbf{P} \mathbf{D} \mathbf{P}^{-1} ...\mathbf{P} \mathbf{D} \mathbf{P}^{-1}}_{n \: times}=\mathbf{P} \mathbf{D}^n \mathbf{P}^{-1}$

Example: The eigenvalues of
$\left( \begin{array}{cc} 2 & 1 \\ 1 & 2 \end{array} \right)$
are the solutions to
\begin{aligned} det(\left( \begin{array}{cc} 2 & 1 \\ 1 & 2 \end{array} \right) - \lambda \mathbf{I}) &= det \left( \begin{array}{cc} 2- \lambda & 1 \\ 1 & 2- \lambda \\ \end{array} \right) \\ =& (2- \lambda)^2 - 1 \times 1 \\ &= \lambda^2 - 4 \lambda +3 \\ &= (\lambda -3)(\lambda -1)=0 \end{aligned}

Then
$\lambda =3,1$
.
$\lambda =3 \rightarrow (\mathbf{M} - 3 \mathbf{I})\mathbf{v}=0 \rightarrow \left( \begin{array}{cc} -1 & 1 \\ 1 & -1 \end{array} \right) \left( \begin{array}{c} v_1 \\ v_2 \end{array} \right) = \left( \begin{array}{c} -v_1 +v_2 \\ v_1-v_2 \end{array} \right) = (\left( \begin{array}{c} 0 \\0 \end{array} \right)$

We can take an eigenvector as
$\left( \begin{array}{c} 1 \\ 1 \end{array} \right)$

$\lambda =1 \rightarrow (\mathbf{M} - \mathbf{I})\mathbf{v}=0 \rightarrow \left( \begin{array}{cc} 1 & 1 \\ 1 & 1 \end{array} \right) \left( \begin{array}{c} v_1 \\ v_2 \end{array} \right) = \left( \begin{array}{c} v_1 +v_2 \\ v_1 +v_2 \end{array} \right) = (\left( \begin{array}{c} 0 \\0 \end{array} \right)$

We can take an eigenvector as
$\left( \begin{array}{c} 1 \\ -1 \end{array} \right)$

Then
\begin{aligned} \left( \begin{array}{cc} 2 & 1 \\ 1 & 2 \end{array} \right)^n &= \left( \begin{array}{cc} 1 & 1 \\ 1 & -1 \end{array} \right) \left( \begin{array}{cc} 3 & 0 \\ 0 & 1 \end{array} \right)^n \left( \begin{array}{cc} 1 & 1 \\ 1 & -1 \end{array} \right)^{-1} \\ &= \left( \begin{array}{cc} 1 & 1 \\ 1 & -1 \end{array} \right) \left( \begin{array}{cc} 3^n & 0 \\ 0 & 1 \end{array} \right)^n \frac{1}{-2} \left( \begin{array}{cc} -1 & -1 \\ -1 & 1 \end{array} \right) \\ &=- \frac{1}{2} \left( \begin{array}{cc} -3^n -1 & -3^n +1 \\ -3^n +1 & -3^n -1 \end{array} \right) \end{aligned}