Compute $A^{105}$ Let $A = \begin{bmatrix}
          2&4\\
          1&5
          \end{bmatrix}$, compute $A^{105}$.
I interpreted this question to just find the nth power of matrix A. Not sure if this was the intended route.
I did the $D=P^{-1}AP$ and got $D^n$.
so $A^n = PD^nP^{-1}$
my final result: $\frac{1}{5} \begin{bmatrix}
                                6^n+4&4(6^n-1)\\
                                6^n-1&4(6^n)+1
                               \end{bmatrix}$
So I can compute just by pluging $105=n$?
 A: There's also a rather special trick for $2 \times 2$ matrices that can save a little work: you don't need to know $P$ and $P^{-1}$.  If $\lambda_1$ and $\lambda_2$ are the eigenvalues (and they are distinct), then 
$$ A^n =  \frac{\lambda_1^n - \lambda_2^n}{\lambda_1 - \lambda_2} A +
\frac{\lambda_1 \lambda_2^n - \lambda_1^n \lambda_2}{\lambda_1 - \lambda_2} I $$
If there is only one eigenvalue $\lambda$ (of algebraic multiplicity $2$), this becomes 
$$ A^n = n \lambda^{n-1} A - (n-1) \lambda^n I$$
More generally, if $f$ is an analytic function in a neighbourhood of the eigenvalues of $A$,
$$f(A) = \frac{f(\lambda_1) - f(\lambda_2)}{\lambda_1 - \lambda_2} A + 
\frac{\lambda_1 f(\lambda_2) - f(\lambda_1) \lambda_2}{\lambda_1 - \lambda_2} I$$
in the first case,
$$ f(A) = f'(\lambda) A + (f(\lambda) - \lambda f'(\lambda)) I$$
in the second.
This works e.g. for $\exp(A)$ with $f(\lambda) = \exp(\lambda)$, or $(A-\mu I)^{-1}$ with $f(\lambda) = 1/(\lambda-\mu)$, where $\mu$ is not an eigenvalue.
A: You can use the Cayley-Hamilton theorem to evaluate powers of a matrix (in fact, any analytic function of a matrix). The basic idea is that by dividing by the characteristic polynomial, you can reduce the degree of any polynomial of an $n\times n$ matrix to at most $n-1$.  
Let $\Delta(x)$ be the characteristic polynomial of the matrix $A$ and write the polynomial $P(x)$ as the quotient and remainder $P(x)=Q(x)\Delta(x)+R(x)$. By the Cayley-Hamilton theorem, $\Delta(A)=0$, so $P(A)=R(A)$. Since by definition $\Delta(\lambda)=0$ if $\lambda$ is an eigenvalue of $A$, we also have $P(\lambda)=R(\lambda)$.
The characteristic polynomial of A is $\Delta(x)=x^2-7x+6$, so one way to compute $A^{105}$ is to find the remainder of $x^{105}$ after division by $\Delta(x)$ and plug in $A$. Another way is to use the property of the eigenvalues mentioned above. We know that for each eigenvalue $\lambda$, $\lambda^{105}=a_0+a_1\lambda$ for some unknown coefficients $a_0$ and $a_1$. Plugging in the two eigenvalues $6$ and $1$ produces a system of linear equations that can be solved for the unknown coefficients: $$\begin{align}a_0+a_1&=1 \\ a_0+6a_1&=6^{105}\end{align}$$ from which we get $A^{105}=\frac15(6-6^{105})I+\frac15(6^{105}-1)A$.  
This method works for any size square matrix, although you need to modify the equations for the unknown coefficients a bit if there are repeated eigenvalues.
