I am trying to solve the following problem using both Jordan canonical form and rational canonical form:
let $A$ and $B$ be $n\times n$ matrices with entries in a field. Suppose that $A^2 = A$ and $B^2 = B$. Prove that there is an invertible matrix $Q$ such that $Q^{-1}AQB = BQ^{-1}AQ$.
Here is my progress: $A^2 = A \implies$ the minimal polynomial for $A$, $m_A(x)$ divides $x^2 - x = x(x-1)$ (the factorization works because every field contains a $-1$, am I right?) So $m_A(x) = x, x-1,$ or $x(x-1)$.
Jordan canonical form approach:
Because the minimal polynomial and the characteristic polynomial of $A$ have the same roots, the eigenvalues of $A$ can only be $0$ or $1$ or both, so they are all contained in this field. Therefore, the Jordan canonical form for $A$ exists. Because $m_A(x)$ has no repeated roots, its Jordan canonical form is actually a diagonal matrix. So there exists a matrix $P$ such that $P^{-1}AP$ is a diagonal matrix. Similarly, we can find a matrix $R$ such that $R^{-1}BR$ is a diagonal matrix. Since diagonal matrices commute with one another, we have $(P^{-1}AP)(R^{-1}BR) = (R^{-1}BR)(P^{-1}AP)$, and rearrangement gives $Q^{-1}AQB = BQ^{-1}AQ$ where $Q = PR^{-1}$.
Can someone check if this approach is correct?
Now the rational canonical form approach:
Because $m_A(x) = x, x-1,$ or $x(x-1)$, the list of invariant factors is one of the following:
$x, x, \dots, x$
$x-1, x-1, \dots, x-1$
$x(x-1), x(x-1), \dots, x(x-1)$
$x, \dots, x, x(x-1) , \dots, x(x-1)$
$x-1, \dots, x-1, x(x-1), \dots, x(x-1)$
The degree of the product of the invariant factors for each list should equal to $n$.
The companion matrix for $x$ is $(0)$, for $x-1$ is $(1)$, and for $x(x-1)$ is \begin{pmatrix} 0 &0\\ 1 &1 \end{pmatrix}. So I know the rational canonical forms for $A$ and $B$ are matrices with all entries to be $0$ except for possibly $1$'s on the diagonal and the subdiagonal. But how do I continue from here?