<s>[INST] how to compute the matrix polynomial Let $A$ be the matrix $$A = \begin{pmatrix} 1 & \sqrt{2}\\ -\sqrt{2} & -1\\ \end{pmatrix}$$


Compute the matrix $B = 3A -2A^2 - A^3 -5A^4 + A^6$.

Could any one give me any hint for this one? I have calculated the eigenvalues they are $(1+\sqrt{2}i),(1-\sqrt{2}i)$
 [/INST] We have the characteristic polynomial $ch_A(x)=\begin{vmatrix}1-x&\sqrt{2}\\-\sqrt{2}&1-x\end{vmatrix}=(x-1)^2+2=x^2-2x+3$.
Then by Cayley-Hamilton theorem we know that $A^2-2A+3=0$.
So if you divide your polynomial $p(x)$ by $(x^2-2x+3)$ and you get $p(x)=q(x)(x^2-2x+3)+r(x)$, you only need to calculate $r(A)$, i.e., to plug the matrix $A$ into the remainder. 
</s>