I would like to find the minimal polynomial of the following matrix.
$$ A = \begin{pmatrix} 1& 2& 0& 0 \\ 2& 1& 1& 1 \\ 0& 0& 1& 2 \\ 0& 0& 0& 1 \end{pmatrix}. $$
The characteristic polynomial of $A$ is $$ c_A(x) = x^4 - 4x^3 + 2x^2 + 4x - 3 = (x-3)(x-1)^2(x+1). $$ Thus, the minimal polynomial must be either $c_A(x)$ or $(x-3)(x-1)(x+1)$.
Yet, neither $(A - 3I)(A-I)(A+I)$ nor $(A - 3I)(A-I)^2(A+I)$ yields the zero matrix (I double checked this in Mathematica).
I can't figure out what I've done wrong here...
EDIT:
Indeed, I simply made a computational error (though I can't quite figure out exactly where...)
Check your computation of matrix product, it works for me.
The minimal polynomial is the characteristic polynomial.