# How to compute the change of basis matrix that conjugate a matrix to its rational canonical form

Let $A=\begin{pmatrix} 2&-2&14\\0&3&-7\\0&0&2\end{pmatrix}$, then its rational canonical form is $R=\begin{pmatrix}2&0&0\\0&0&-6\\0&1&5\end{pmatrix}$. How can I compute a matrix $P$ such that $P^{-1}AP=R$? And in general what is the algorithm?

-
I think that's wrong. The characteristic polynomial of $A$ is $(x-3)(x-2)^2$, so the rational canonical form should either be diagonal, or have one $1\times 1$ block associated to $3$ and one $2\times 2$ block that is the companion matrix of $(x-2)^2$. Instead, you have one block associated to $2$ and one block that is the companion matrix of $(x-2)(x-3)$. – Arturo Magidin Jan 6 '12 at 3:54
I think it's correct. The invariant factors are $(x-2),(x-2)(x-3)$. Also if you conjugate by the matrix $\begin{pmatrix}-7&-1&4\\7&1&3\\1&0&0\end{pmatrix}$ you obtain $R$, and so by uniqueness that is the rational canonical form, right? – John Jan 6 '12 at 4:16
What definition of Rational Canonical Form are you using? In the one I know, if the matrix is diagonalizable, the Rational Canonical Form is diagonal; and the blocks are always companion matrices of powers of irreducible factors of the characteristic polynomial. Your answer does not satisfy either of these conditions. Uniqueness depends on what kind of companion matrices you allow. If you change the allowable companion matrices, you change the representative of the equivalence class. – Arturo Magidin Jan 6 '12 at 4:20
I would expect your book to cover how to find a basis for the Rational Canonical basis as well; assuming your blocks were correct, you find a basis for the nullspace of $2$, $\mathbf{v}_1$ and $\mathbf{v}_2$; and a basis for the nullspace of $3$, $\mathbf{v}_3$. You then take $\mathbf{v}_1$, $\mathbf{v}_2+\mathbf{v}_3$, and $A(\mathbf{v}_2+\mathbf{v}_3)$. – Arturo Magidin Jan 6 '12 at 4:27
P.S. It's incorrect to talk about the matrix that conjugates. There are infinitely many matrices $P$ that work. – Arturo Magidin Jan 6 '12 at 4:29

As with the Jordan case, you need to find a Rational Canonical basis; your matrix $P$ will have the rational canonical basis as its columns.

Your computation is incorrect, though, at least under the definition I am familiar with. In the definition I am familiar with, each block in the Rational Canonical Form is the companion matrix of a polynomial of the form $\phi^k(t)$, where $\phi(t)$ is an irreducible factor of the characteristic polynomial.

The characteristic polynomial is $(x-2)^2(x-3)$. The minimal polynomial is either $(x-2)(x-3)$ or $(x-2)^2(x-3)$. The Rational Canonical form deals with the irreducible factors separately, so you will have that the Rational Canonical form of $A$ is either \begin{align*} \left(\begin{array}{ccc} 2 & 0 & 0\\ 0 & 2 & 0\\ 0 & 0 & 3 \end{array}\right) &\text{if the minimal polynomial is }(x-2)(x-3);\\ \left(\begin{array}{ccc} 0 & -4 & 0\\ 1 & 4 & 0\\ 0 & 0 & 3 \end{array}\right) & \text{if the minimal polynomial is }(x-2)^2(x-3). \end{align*}

It is not hard to check that $A-2I$ has rank $1$, so the nullspace is 2-dimensional; hence the eigenspace corresponding to $2$ is two dimensional, so the geometric multiplicity of $2$ equals the algebraic multiplicity. The matrix is diagonalizable, and the Rational Canonical form of $A$ is the diagonal matrix.

Find a basis of eigenvectors, that gives you the $P$.

In general, you need to find a Rational Canonical Basis, and a matrix whose columns are the elements of the Rational Canonical Basis will work as $P$.

To find them, you need to determine the size of the blocks associated to each irreducible factor of the characteristic polynomial. If you have a block of size $kd$, where $d$ Is the degree of the irreducible factor $\phi(t)$, then you need to find an element $\mathbf{v}$ of the nullspace of $\phi^k(A)$ that is not an element of the nullspace of $\phi^{k-1}(A)$. Then the basis vectors corresponding to that particular block are $\mathbf{v}$, $A\mathbf{v},A^2\mathbf{v},\ldots,A^{kd-1}\mathbf{v}$.

-