## Construct the similarity classes of matrices having a given dimension and minimal polynomial

Construct (representatives of) the similarity classes of $6 \times 6$ matrices over $\mathbb{Q}$ having minimal polynomial $m(x) = (x+2)^2(x-1)$.

Recall that the minimal polynomial of a matrix is its divisibility-largest invariant factor (Prop. 13 in D&F), that the characteristic polynomial of a matrix is the product of its invariant factors (Prop. 20 in D&F) and that the degree of the characteristic polynomial of a matrix is the dimension of the matrix (By the definition of the characteristic polynomial). To construct the rational canonical forms of $6 \times 6$ matrices having minimal polynomial $m(x)$, it suffices to construct all the possible lists of invariant factors which terminate in $m(x)$ and whose product has degree 6.

Note that $m(x)$ has five nontrivial divisors over $\mathbb{Q}$: $x+2$, $(x+2)^2$, $x-1$, $(x+2)(x-1)$, and $(x+2)^2(x-1)$. These are the possible next-to-last entries in a list of invariant factors which terminates in $m(x)$. Note that for each of these divisors, the remaining invariant factors are determined by degree considerations except in the case $(x+2)(x-1)$, where we have two possible choices for the third invariant factor.

The lists of invariant factors are as follows.

1. $x+2$, $x+2$, $x+2$, $(x+2)^2(x-1)$
2. $x+2$, $(x+2)^2$, $(x+2)^2(x-1)$
3. $x-1$, $x-1$, $x-1$, $(x+2)^2(x-1)$
4. $x+2$, $(x+2)(x-1)$, $(x+2)^2(x-1)$
5. $x-1$, $(x+2)(x-1)$, $(x+2)^2(x-1)$
6. $(x+2)^2(x-1)$, $(x+2)^2(x-1)$

The corresponding similarity class representatives (i.e. rational canonical forms) are as follows.

1. $\begin{bmatrix} -2 & 0 & 0 & 0 & 0 & 0 \\ 0 & -2 & 0 & 0 & 0 & 0 \\ 0 & 0 & -2 & 0 & 0 & 0 \\ 0 & 0 &0 & 0 & 0 & 4 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & -3 \end{bmatrix}$
2. $\begin{bmatrix} -2 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & -4 & 0 & 0 & 0 \\ 0 & 1 & -4 & 0 & 0 & 0 \\ 0 & 0 &0 & 0 &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