## Compute the Jordan canonical form of a given matrix

Compute the Jordan Canonical Forms of the matrices $A = \begin{bmatrix} 5 & 4 & 1 \\ -1 & 0 & 0 \\ -3 & -4 & 1 \end{bmatrix}$ and $B = \begin{bmatrix} 3 & 4 & 2 \\ -2 & -3 & -1 \\ -4 & -4 & -3 \end{bmatrix}$.

Let $P = \dfrac{1}{2} \begin{bmatrix} 0 & 0 & 1 \\ -3 & -4 & -1 \\ -2 & 0 & -2 \end{bmatrix}$ and $Q = \dfrac{1}{2} \begin{bmatrix} 1 & 2 & 0 \\ 1 & 0 & 0 \\ 4 & 4 & 2 \end{bmatrix}$. Evidently then $P^{-1}AP = \begin{bmatrix} 2 & 1 & 0 \\ 0 & 2 & 1 \\ 0 & 0 & 2 \end{bmatrix}$ and $Q^{-1}BQ = \begin{bmatrix} -1 & 0 & 0 \\ 0 & -1 & 1 \\ 0 & 0 & -1 \end{bmatrix}$ are in Jordan canonical form. (We used WolframAlpha for the computations; see here and here.)