How to compute the $n^{\textrm{th}}$ power of a matrix?

How would I compute $\begin{pmatrix}-5&8\\-4&7\end {pmatrix}^5$ using the relationship between the diagonal matrices and the $n^{\textrm{th}}$ power of a matrix?

My lecturer gave the relation $A^k$=$P^{-1}D^kP$ where $D$ is the diagonalized form of the first matrix. Could somebody give a step by step by step solution to this please?

Solutions Collecting From Web of "How to compute the $n^{\textrm{th}}$ power of a matrix?"

Imagine that $A$ is diagonalizable, i.e, you can write $A = P^{-1}DP$ for some $P$ and diagonal $D$. Then,
$$
A^2 = \left( P^{-1}DP \right) \left( P^{-1}DP \right)
= \left( P^{-1}D \left(P P^{-1}\right) DP \right)
= \left( P^{-1}D^2 P \right)
$$

Can you take this from here?

EDIT In response to the comments below, I am getting
$$
P = \pmatrix{1 & -1\\-1 & 2}, P^{-1}= \pmatrix{2 & 1\\1 & 1}, D= \pmatrix{-1 & 0\\0 & 3}
$$
so
$$
A^5 = \pmatrix{2 & 1\\1 & 1} \pmatrix{-1 & 0\\0 & 243} \pmatrix{1 & -1\\-1 & 2}
= \pmatrix{-245 & 488\\-244 & 487}
$$

It may help to know that the diagonal entries of $D$ are the eigenvalues of $A$, and the rows of $P$ are the corresponding eigenvectors of $A$, so calculate the eigenvalues and eigenvectors, then $A^5=(P^{-1}D^5P)$

To find the diagonal form of the matrix you would calculated the eigenvalues and eigenvectors. $D$ is a diagonal matrix where the entries are the eigenvalues of $A$, $P$ is a matrix formed by the eigenvectors (each eigenvector is a column corresponding to the column its eigenvalue is in for $D$).