Can someone please point me in the right direction on how to solve the matrix equation below.
If $$A = \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 1 & 2 & -1\end{bmatrix}$$ find constants $p$, $q$ and $r$ such that $$A^3 = p A^2 + q A +r I_3$$ where $I_3$ is the $3 \times 3$ identity matrix.
We get $$\det(\lambda I-A) = \begin{vmatrix} \lambda & -1 & 0 \\ 0 & \lambda & -1 \\ -1 & -2 & \lambda+1 \end{vmatrix}=\lambda^3+\lambda^2-2\lambda-1.$$ Thus, using Cayley-Hamilton theorem, we have that
$$A^3+A^2-2A-I=0.$$ That is
$$A^3=-A^2+2A+I.$$