Finding a cubic polynomial with Cayley-Hamilton Theorem I have two matrices:
$A = \begin{bmatrix}
1 &2 \\
-1 &4
\end{bmatrix}
$
and 
$B = \begin{bmatrix}
0 &-1 \\
2 &3
\end{bmatrix}
$
I need to find a monic cubic polynomial $g$ such that $g(A)=g(B)=0$, the zero matrix.
I understand through the Cayley-Hamilton Theorem that both $A$ and $B$ satisfy their own characteristic equations. That is,
$f_A(A)=0\,$ for $\,f_A(t)=t^2-5t+6$
and
$f_B(B)=0\,$ for $\,f_B(t)=t^2-3t+2$
I can verify this computationally or simply by citing Cayley-Hamilton, so that's fine. However, I'm not sure how to combine these and find the cubic polynomial that's been requested so that both matrices evaluate the polynomial to $0$. 
Am I missing something deeper about the Cayley-Hamilton Theorem, or am I just forgetting some basic algebra tricks? 
 A: Hint: The characteristic polynomials share a common root, $2$.
A: the least common multiple of $(t-3)(t-2)$ and $(t-1)(t-2)$ is
$$  (t-1)(t-2)(t-3) $$
As with natural numbers, the LCM of two polynomials is their product divided by their gcd. If you did not notice the common root, the euclidean algorithm can find the gcd
$$  \left(   x^{2}  - 5 x  + 6 \right)  $$ 
$$  \left(   x^{2}  - 3 x  + 2 \right)  $$ 
$$  \left(   x^{2}  - 5 x  + 6 \right)  =  \left(   x^{2}  - 3 x  + 2 \right)  \cdot \color{magenta}{  \left( 1  \right) } +  \left(   - 2 x  + 4 \right)  $$
$$  \left(   x^{2}  - 3 x  + 2 \right)  =  \left(   - 2 x  + 4 \right)  \cdot \color{magenta}{  \left(   \frac{  -  x  + 1 }{ 2 }  \right) } +  \left( 0 \right)  $$
$$ \frac{ 0}{1} $$
$$ \frac{ 1}{0} $$
$$ \color{magenta}{  \left( 1  \right) }  \Longrightarrow  \Longrightarrow  \frac{  \left( 1  \right) }{ \left( 1  \right) } $$
$$ \color{magenta}{  \left(   \frac{  -  x  + 1 }{ 2 }  \right) }  \Longrightarrow  \Longrightarrow  \frac{  \left(   \frac{  -  x  + 3 }{ 2 }  \right) }{ \left(   \frac{  -  x  + 1 }{ 2 }  \right) } $$
$$  \left(   x  - 3 \right)  \left( \frac{ 1}{2 } \right)  -  \left(   x  - 1 \right)  \left( \frac{ 1}{2 } \right)  =  \left( -1  \right)  $$
$$  \left(   x^{2}  - 5 x  + 6 \right)  =  \left(   x  - 3 \right)  \cdot \color{magenta}{  \left(   x  - 2 \right) } +  \left( 0 \right)  $$
$$  \left(   x^{2}  - 3 x  + 2 \right)  =  \left(   x  - 1 \right)  \cdot \color{magenta}{  \left(   x  - 2 \right) } +  \left( 0 \right)  $$
$$  \mbox{GCD} =   \color{magenta}{  \left(   x  - 2 \right) }   $$
$$  \left(   x^{2}  - 5 x  + 6 \right)  \left( \frac{ 1}{2 } \right)  -  \left(   x^{2}  - 3 x  + 2 \right)  \left( \frac{ 1}{2 } \right)  =  \left(   -  x  + 2 \right)  $$ 
