<s>[INST] Finding minimal polynomial of a matrix Let $A\in M\underset{nxn}{(\mathbb{R})}$ so that $\forall\lambda\in\mathbb{R}: A\neq \lambda I$. It also given that $A^4-5A^2+4I=A^3-7A-6I=0$.
Find the minimal polynomial.  
I got the polynomial: $x^4-x^3-5x^2+7x+10=0$. After factorization I got:
$(x+2)(x+1)(x^2-4x+5)=0$.
I tried to find the minimal polynomial:
$(x+2)(A)= A+2I \Leftrightarrow A=-2I\rightarrow$ invalid since $A\neq \lambda I$.
$(x+1)(A)=A+I\Leftrightarrow A=-I\rightarrow$  invalid since $A\neq \lambda I$.
$(x^2-4x+5)(A)\rightarrow A^2-4A+5I=0\rightarrow$ irreducible since $F=\mathbb{R}$.
Therefore, the minimal polynomial must be: $(x+2)(x+1)(x^2-4x+5)$.  
I am not sure if what I did is correct and how can I check it, can you please give me your way of solving it?
 [/INST] Recall that if a polynomial $P$ annihilates a matrix $A$ then the minimal polynomial of $A$ divides $P$ and then the spectrum of $A$ is includ in the set of roots of $P$.
We have
$x^4-5x^2+4=(x-1)(x-2)(x+2)(x+1)$ annihilates $A$ and then $\mathrm{sp}(A)\in\{1,2,-2,-1\}$
and 
$x^3-7x-6=(x-3)(x+2)(x+1)$ annihilates $A$ and then $\mathrm{sp}(A)\in\{3,,-2,-1\}$
so 
 $$\mathrm{sp}(A)\in\{-2,-1\}$$
hence the minimal polynomial $\pi_A(x)=(x+2)(x+1)$ since otherwise $A=-2 I$ or $A=-I$.
</s>