Let $f$ be an endomorphism of $\mathbb{R}^3$ with its matrix $A$ in the canonical basis $\mathcal{B}$ as $$ A = \begin{pmatrix} 3 & 1 & 1 \\ -1 & 1 & - 1 \\ 0 & 0 & 1 \end{pmatrix}.$$ What is the minimal polynomial of $f$?
The characteristic polynomial of $f$ is: $$P_{f}(X) = (1 - X)(X - 2)^2.$$
The minimal polynomial $m_{f}$ is the polynomial with the least degree that divides $P_{f}$, has the eigenvalues of $f$ as roots and $m_{f}(A) = 0$.
In this case, we have $m_{f}(X)= (1 - X)(2 - X)$ but $m_f(f) \neq 0 $.
How can I find the minimal polynomial of $A$ and what is the fastest method to determine it?