Let be matrices over a field . Prove that and 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 and be nonscalar matrices of dimension 3 over a field , and suppose and have the same characteristic () and minimal () polynomials. Recall (Proposition 20 in D&F) that the characteristic polynomial of a matrix divides some power of its minimal polynomial. To show that and are similar, it suffices to show that the invariant factors of (and of ) are in this case uniquely determined by and . Then and will have the same rational canonical form, and so will be similar.

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

Suppose has degree 2. Now for some ; say . If is irreducible, we have , a contradiction since has degree 3. If is reducible, we have for some (not necessarily distinct). Since is the product of the invariant factors of , and since the invariant factors (one of which is ) divide , without loss of generality the invariant factors of are and . Now , and in fact the invariant factors of are also and . So and have the same rational canonical form and are thus similar.

Suppose has degree 1. Now the invariant factors of (and of ) are all , so that and are similar to scalar matrices, and thus are themselves scalar.

To construct a counterexample for dimension 4 matrices, it suffices to exhibit two matrices and which have the same minimal polynomial and characteristic polynomial but different lists of invariant factors. For example, consider matrices whose invariant factors are and .