Show that the matrices $\begin{pmatrix}-1&0&0&0\\0&-1&0&0\\0&0&2&0\\0&0&0&-1\end{pmatrix}$ and $\begin{pmatrix}2&0&0&0\\0&2&0&0\\0&0&2&0\\0&0&0&-1\end{pmatrix}$ have the same minimal polynomials.
Is it correct to say the characteristic polynomials of the two are ($x-2$)($x+1$$)^3$ and ($x-2$$)^3$($x+1$) respectivly and the minimal polynomials are ($x-2)(x+1$) since that's the irreducible factorization of both?
The minimal polynomial of $A$ is the smallest monic polynomial $p$ (by degree) such that $p(A) = 0$. So you suspect that $(x-2)(x+1) = x^2 -x -2$ is the minimal polynomial of each of those matrices (say name them $A$ and $B$). One way to check that would be to