## Prove that two matrices are similar

Let $A = \begin{bmatrix} 2 & 0 & 0 & 0 \\ -4 & -1 & -4 & 0 \\ 2 & 1 & 3 & 0 \\ -2 & 4 & 9 & 1 \end{bmatrix}$ and $B = \begin{bmatrix} 5 & 0 & -4 & -7 \\ 3 & -8 & 15 & -13 \\ 2 & -4 & 7 & -7 \\ 1 & 2 & -5 & 1 \end{bmatrix}$. Prove that $A$ and $B$ are similar.

Let $P = \begin{bmatrix} 0 & 0 & 0 & 1 \\ -2 & 4 & 9 & 0 \\ 0 & 1 & 2 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix}$ and $Q = \begin{bmatrix} 0 & 2 & -3 & 2 \\ 2 & -2 & 2 & -5 \\ 1 & 0 & -1 & -2 \\ 0 & 1 & -2 & 1 \end{bmatrix}$. Evidently, $P^{-1}AP = Q^{-1}BQ = \begin{bmatrix} 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 2 \end{bmatrix}$. In particular, $A$ and $B$ are similar.

(Computations performed with WolframAlpha; see here and here.)