Linear Algebra (Matrixes with powers) Let
$$
M \colon= \left[ \begin{matrix} 
2 & -1 \\
2 & 5
\end{matrix} \right]
$$
Find formulas for the entries of $M^n$, where $n$ is a positive integer.
$$ M^n = \text{?} $$
 A: I think simple diagonilization makes sense here for  $M$ has two different eigenvalues, $\{3,4\}$. Two corresponding eigenvectors are $[1,-1]^\top$ and $[1,-2]^\top$. Setting
\begin{align}
P=\begin{pmatrix}
1 & 1\\
-1 & -2
\end{pmatrix}
\end{align}
can be expressed $M$ as $M= P\Delta P^{-1}$ where $\Delta=\operatorname{diag}(3,4)$, that is
\begin{align}
\begin{pmatrix} 
2 & -1\\
2 & 5
\end{pmatrix} = \begin{pmatrix} 
1 & 1\\
-1 & -2
\end{pmatrix}\begin{pmatrix} 
3 & 0\\
0 & 4
\end{pmatrix}\begin{pmatrix} 
2 & 1\\
-1 & -1
\end{pmatrix}
\end{align}
Thus
\begin{align}
M^n = \begin{pmatrix} 
1 & 1\\
-1 & -2
\end{pmatrix}\begin{pmatrix} 
3^n & 0\\
0 & 4^n
\end{pmatrix}\begin{pmatrix} 
2 & 1\\
-1 & -1
\end{pmatrix} = \begin{pmatrix} 
2\cdot3^n - 4^n & 3^n - 4^n\\
2(4^n-3^n) & -3^n - 2\cdot4^n
\end{pmatrix}
\end{align}
This is of course the same as what was mentioned in one of the comments above (egorovik)
A: Look for the Eigenvalues and eigenvectors:
$$\det(M-\lambda I)=0$$
Then the eigenvectors:
$$M\mathbf{x}=\lambda\mathbf{x}$$
Put the eigenvectors as columns in a $2\times 2$ matrix $P$, and compute $P^{\textrm{T}}MP$. Note that $P^{\textrm{T}}P=PP^{\textrm{T}}=I$
