<s>[INST] Calculate $A^5 - 27A^3 + 65A^2$, where $A$ is the matrix defined below. If $A=\begin{bmatrix} 0 & 0 & 1 \\
3 & 1 & 0 \\ 
-2&1&4\end{bmatrix}$, find $A^5 - 27A^3 + 65A^2$
$$A=\begin{bmatrix} 0 & 0 & 1 \\
3 & 1 & 0 \\ 
-2&1&4\end{bmatrix}$$
Let $\lambda$ be its eigenvalue, then 
$$(A-\lambda I) = \begin{bmatrix} 0-\lambda & 0 & 1 \\
3 & 1-\lambda & 0 \\ 
-2&1&4-\lambda\end{bmatrix}$$
$$|A-\lambda I| = -(\lambda)^3 + 5(\lambda)^2 - 6(\lambda) +5$$
Using Cayley-Hamilton theorem
$$A^3-5^2+6A-5=0$$
How do I use this find $A^5 - 27A^3 + 65A^2$?
 [/INST] To add to the above answer, using  $A^3 = 5A^2 - 6A + 5$ to simplify further $A^2(5A^2 -33A + 70) = A(5(5A^2 - 6A + 5) - 33A^2 + 70A) = A(-8A^2 + 40A + 25) = -8(5A^2 -33A + 70) + 40A^2 + 25A = 289A - 560$
</s>