## Compute the Jordan canonical form for a given matrix

Let $A = \begin{bmatrix} 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 \end{bmatrix}$ and $B = \begin{bmatrix} 5 & 2 & -8 & -8 \\ -6 & -3 & 8 & 8 \\ -3 & -1 & 3 & 4 \\ 3 & 1 & -4 & -5 \end{bmatrix}$. For each of $A$ and $B$, compute the characteristic polynomial and the Jordan canonical form.

Let $P = \dfrac{-1}{4} \begin{bmatrix} 1 & 1 & 1 & -3 \\ 1 & 1 & -3 & 1 \\ 1 & -3 & 1 & 1 \\ -1 & -1 & -1 & -1 \end{bmatrix}$ and $Q = \dfrac{1}{12} \begin{bmatrix} -3 & -1 & 4 & 8 \\ 3 & 1 & 0 & -4 \\ 6 & 6 & -8 & -8 \\ 9 & 3 & -12 & -12 \end{bmatrix}$. Evidently, we have $P^{-1}AP = Q^{-1}BQ = \begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 3 \end{bmatrix}$, which is clearly in Jordan canonical form. In particular, the characteristic polynomial of $A$ and $B$ is $c(x) = (x+1)^3(x-3)$.

[Computations performed with WolframAlpha; see here and here.]