Let: $$ A = \left[ \begin{matrix} 1 & 2 & 2 \\ 2 & 1 & 2 \\ 2 & 2 & 1 \\ \end{matrix}\right ] $$
The characteristic equation of this matrix is: $(\lambda +1) (\lambda^2 -4\lambda -5) = 0$
$\implies (A+I)(A^2- 4A -5I) = 0$
But $AB = 0 \require{cancel} \cancel\implies A= 0$ or $B= 0$
But in this case, on solving we can clearly see that $A^2 - 4A - 5A = 0$ (0 denotes null matrix)
So, when does this work? When are we allowed to get cancel factors? In another question I did yesterday, cancelling the factor from the characteristic equation gave me the wrong answer.
To know more about the difference, i suggest reading on characteristic polynomials and Jordan blocks on wikipedia.
– Kolja Oct 10 '18 at 07:31