## Show explicitly that two matrices are similar

Let $B = \begin{bmatrix} 0 & -4 & 85 \\ 1 & 4 & -30 \\ 0 & 0 & 3 \end{bmatrix}$ and let $C = \begin{bmatrix} 2 & 2 & 1 \\ 0 & 2 & -1 \\ 0 & 0 & 3 \end{bmatrix}$. Find matrices $P$ and $Q$ such that $P^{-1}BP$ and $Q^{-1}CQ$ are in Jordan Canonical Form. Give an explicit matrix $R$ such that $R^{-1}BR = C$.

We will follow the algorithm given on page 496 of D&F.

We begin by finding a sequence of ERCOs which transforms the matrix $xI-B$ into Smith Normal Form. Evidently the following sequence works.

1. $xR_2 + R_1 \rightarrow R_1$
2. $-C_1 \rightarrow C_1$
3. $(4-x)C_1 + C_2 \rightarrow C_2$
4. $-30C_1 + C_3 \rightarrow C_3$
5. $-30R_3 + R_1 \rightarrow R_1$
6. $-\frac{1}{5}(x-2)^2C_3 + C_2 \rightarrow C_2$
7. $\frac{1}{5}R_1 \rightarrow R_1$
8. $(3-x)R_1 + R_3 \rightarrow R_3$
9. $C_1 \leftrightarrow C_3$
10. $C_2 \leftrightarrow C_3$
11. $-5C_3 \rightarrow C_3$

The result is $\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & (x-2)^2(x+3) \end{bmatrix}$.

In particular, the elementary divisors of $B$ are $(x-2)^2$ and $x-3$, so that the Jordan canonical form of $B$ is $\begin{bmatrix} 2 & 1 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}$.

We used four row operations, whose corresponding column operations are as follows.

1. $C_2 - BC_1 \rightarrow C_2$
2. $C_3 + 30C_1 \rightarrow C_3$
3. $C_1 + (B-3I)C_3 \rightarrow C_1$
4. $5C_1 \rightarrow C_1$

We now perform this sequence of column operations (in order) on the identity matrix. The result is $\begin{bmatrix} 0 & 0 & 30 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}$. Multiplying the only nonzero column by each of $(B-2I)(B-3I)$, $B-3I$, and $B-2I$ to construct a matrix $P$, we have $P = \begin{bmatrix} 10 & -5 & 35 \\ -5 & 0 & -5 \\ 0 & 0 & 1 \end{bmatrix}$. Using Gauss-Jordan elimination on $[P|I]$, we can compute $P^{-1} = \frac{1}{5}\begin{bmatrix} 0 & -1 & -5 \\ -1 & -2 & 25 \\ 0 & 0 & 5 \end{bmatrix}$. We can easily verify that $P^{-1}BP$ is in Jordan Canonical Form. (WolframAlpha agrees.)

Next we consider $C$. Evidently $xI-C$ is put into Smith normal form by the following sequence of ERCOs.

1. $R_2 + R_1 \rightarrow R_1$
2. $-C_1 + C_2 \rightarrow C_2$
3. $-\frac{1}{2}C_2 \rightarrow C_2$
4. $(2-x)C_2 + C_1 \rightarrow C_1$
5. $\frac{1}{2}(x-2)R_1 + R_2 \rightarrow R_2$
6. $-\frac{1}{2}(x-2)^2C_3 + C_1 \rightarrow C_1$
7. $(3-x)R_2 + R_3 \rightarrow R_3$
8. $C_1 \leftrightarrow C_2$
9. $C_2 \leftrightarrow C_3$
10. $-2C_3 \rightarrow C_3$

The resulting matrix is $\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & (x-2)^2(x-3) \end{bmatrix}$, so that the elementary divisors of $C$ are $(x-2)^2$ and $x-3$. At this point, we know that $B$ and $C$ are similar since they have the same elementary divisors.

We used three elementary row operations, whose corresponding column operations are as follows.

1. $C_1 - C_2 \rightarrow C_2$
2. $C_1 - \frac{1}{2}(C-2I)C_2 \rightarrow C_1$
3. $C_2 + (C-3I)C_3 \rightarrow C_2$

Performing these operations (in order) on the identity matrix yields $\begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}$. Multiplying the only nonzero column of this matrix by $(C-2I)^2$, $(C-2I)(C-3I)$, and $C-3I$ to construct a matrix $Q$, we have $Q = \begin{bmatrix} -2 & 1 & -1 \\ 0 & -1 & -1 \\ 0 & 0 & 1 \end{bmatrix}$. Evidently $Q^{-1} = \frac{1}{2} \begin{bmatrix} -1 & -1 & -2 \\ 0 & -2 & -2 \\ 0 & 0 & 2 \end{bmatrix}$, and $Q^{-1}CP$ is in Jordan Canonical Form. (WolframAlpha agrees.)

In particular, we have $P^{-1}BP = Q^{-1}CQ$, so that $(PQ^{-1})^{-1}B(PQ^{-1}) = C$.