So the question I want to answer is the following:
Ggive an example of a $10 \times 10$ matrix (over $\mathbb{R}$) whose minimal polynomial is $(x^{4}-2)(x+2)^{2}$ and is not similar to any matrix with rational entries.
Here is my approach and the questions I have. We have that by the decomposition of modules, we have
$$\mathbb{R}[x]/(a_{1}) \bigoplus \cdots \bigoplus \mathbb{R}[x]/(a_{m})$$
where $a_{1}|a_{2}|\dots|a_{m}$.
I read from Dummit and Foote that the minimal polynomial is the largest invariant factor so we get that $a_{m}$ is the minimal polynomial. So my attempt is to consider
$$ \frac{\mathbb{R}[x]}{(x-\sqrt[4]{2})}\bigoplus \frac{\mathbb{R}[x]}{(x^{2}-\sqrt{2})(x+2)} \bigoplus \frac{\mathbb{R}[x]}{(x^{4}-2)(x+2)^{2}} $$
The conditions above are satisfied since clearly $a_{1}|a_{2}|a_{3}$ and $a_{3}$ is the minimal polyomial. From what I read in Dummit and Foote, the rational form is the companion matrices of these 3 factors.
So my first question is, for the 3rd factor, $\frac{\mathbb{R}[x]}{(x^{4}-2)(x+2)^{2}}$, my confusion is: Since we are quotienting by a degree 6, would this be a 6 by 6 companion matrix for our polynomial $(x^{4}-2)(x+2)^{2}$ or would it be a 4x4 companion matrix for $(x^{4}-2)$ followed by another 2x2 block which is the companion matrix of $(x+2)^{2}$. Or since we have that our matrix is over $\mathbb{R}$, our minimal polynomial factors as $$(x^{4}-2)(x+2)^{2}=(x-\sqrt[4]{2})(x+\sqrt[4]{2})(x^{2}+2)(x+2)^{2}$$ so we actually have $1\times1$, $1\times1$, $2\times2$, and $2\times2$ companion matrices.
As for my second question, unless there is a faster way, if there was a rational matrix,B, that was similar to my rational form, call it A, then
$$A=PBP^{-1}$$
But then
$$\det(A) = \det(B)$$
so I just need to show that my matrix (I haven't computed this long determinant for $10 \times 10$ since I am not sure what my matrix is as from my 1st question), has determinant that is not in $\mathbb{Q}$ right? Since the determinant of $B$ is in $\mathbb{Q}$, my hope is by including those 4th roots of $2$, I get $\det(A) \not \in \mathbb{Q}$.
Let $t=\sqrt[4]2$ be the real positive complex number, which is root of the polynomial $X^4-2$.Then $-t$ is the other real root. Consider now a matrix $T$ with the following (block) diagonal entries: $$ \begin{bmatrix} -2 & 1 \\ 0 & -2 \end{bmatrix} \ , \ \begin{bmatrix} 0 & -t \\ t & 0 \end{bmatrix} \ , \ t\ ,\ -t\ ,\ \dots $$ and the dots replace some repetitions of the already listed block, or are the rational value $-2$, so that
The minimal polynomial (in the variable $X$) of such a matrix has the factors $(X-(-2))^2$, $X^2+t^2$, $X^2-t^2$, so it is their product $(X+2)^2(X^4-t^4)=(X+2)^2(X^4-2)$.
The invariant factors of the action of $\Bbb R[X]$ on $\Bbb R^{10}$, where $X$ acts through left multiplication with $T$, depend now on which repetitions we consider in the one or the other example.
The posted attempt works, it corresponds to the list of diagonal blocks $$ \begin{bmatrix} -2 & 1 \\ 0 & -2 \end{bmatrix} \ , \ \begin{bmatrix} 0 & -t \\ t & 0 \end{bmatrix} \ , \ t\ ,\ -t\ ;\ t\ ,\ -t\ ,\ -2\ ;\ t\ . $$ And the determinant is easily computed as the product of all the above block determinants, and is not rational.
Note:
Sage gives for the above $6\times 6$ block matrix the following rational form, which is the companion matrix of the minimal polynomial $(x+2)^2(x^4-2)$: