## Two nonscalar matrices of dimension 3 over a field are similar if and only if they have the same characteriscic and the same minimal polynomials

Let $A, B \in \mathsf{Mat}_3(F)$ be matrices over a field $F$. Prove that $A$ and $B$ are similar if and only if they have the same characteristic and minimal polynomials. Show, via an explicit counterexample, that this result does not hold for matrices of dimension 4.

In this previous exercise, we showed that similar matrices have the same characteristic and minimal polynomials.

Let $A$ and $B$ be nonscalar matrices of dimension 3 over a field $F$, and suppose $A$ and $B$ have the same characteristic ($c(x)$) and minimal ($m(x)$) polynomials. Recall (Proposition 20 in D&F) that the characteristic polynomial of a matrix divides some power of its minimal polynomial. To show that $A$ and $B$ are similar, it suffices to show that the invariant factors of $A$ (and of $B$) are in this case uniquely determined by $c(x)$ and $m(x)$. Then $A$ and $B$ will have the same rational canonical form, and so will be similar.

Suppose $m(x)$ has degree 3. Then the (only) invariant factor of $A$ and of $B$ is $m(x)$, whose companion matrix is the rational canonical form of $A$ and $B$. So $A$ and $B$ are similar.

Suppose $m(x)$ has degree 2. Now $c(x)|m(x)^t$ for some $t$; say $c(x)d(x) = m(x)^t$. If $m(x)$ is irreducible, we have $c(x)|m(x)$, a contradiction since $c(x)$ has degree 3. If $m(x)$ is reducible, we have $m(x) = (x-\alpha)(x-\beta)$ for some $\alpha,\beta \in F$ (not necessarily distinct). Since $c(x)$ is the product of the invariant factors of $A$, and since the invariant factors (one of which is $m(x)$) divide $m(x)$, without loss of generality the invariant factors of $A$ are $(x-\alpha)$ and $(x-\alpha)(x-\beta)$. Now $c(x) = (x-\alpha)^2(x-\beta)$, and in fact the invariant factors of $B$ are also $(x-\alpha)$ and $(x-\alpha)(x-\beta)$. So $A$ and $B$ have the same rational canonical form and are thus similar.

Suppose $m(x) = x-\alpha$ has degree 1. Now the invariant factors of $A$ (and of $B$) are all $x-\alpha$, so that $A$ and $B$ are similar to scalar matrices, and thus are themselves scalar.

To construct a counterexample for dimension 4 matrices, it suffices to exhibit two matrices $A$ and $B$ which have the same minimal polynomial and characteristic polynomial but different lists of invariant factors. For example, consider matrices whose invariant factors are $\{(x-\alpha)^2, (x-\alpha)^2\}$ and $\{x-\alpha,x-\alpha, (x-\alpha)^2\}$.