## Compute the Jordan canonical form of a given matrix over a finite field

Let $p$ be a prime. Compute the Jordan canonical form over $\mathbb{F}_p$ of the $n \times n$ matrix whose diagonal entries are 0 and whose off-diagonal entries are 1. ($n \geq 2$)

Let $A = [1 - \delta_{i,j}]$. The computation we carried out here shows that $(A - (n-1)I)(A+I) = 0$ over $\mathbb{F}_p$ (indeed, over any ring with 1). So the minimal polynomial of $A$ divides $(x-(n-1))(x+1)$. Note that $A-(n-1)I$ and $A+I$ are nonzero (any off-diagonal entry is 1), so the minimal polynomial of $A$ is precisely $m(x) = (x-(n-1))(x+1)$.

Let $V = \mathbb{F}_p^n$ be an $\mathbb{F}_p[x]$-module via $A$ as usual. Now the invariant factors $m_k(x)$ of $V$ divide $m(x)$, and we have $V = \bigoplus_k \mathbb{F}[x]/(m_k(x))$.

We claim that $(A+I)V$ has dimension 1 over $\mathbb{F}_p$. Indeed, if $v = [v_1\ \ldots\ v_n]^\mathsf{T}$, then $(A+I)v = (\sum v_i)[1\ \ldots\ 1]^\mathsf{T}$.

Using Lemmas 2 and 3 from this previous exercise, we have $(x+1)V = \bigoplus_k (x+1)\mathbb{F}_p[x]/(m_k(x))$ $\cong_{\mathbb{F}_p[x]} \bigoplus_{(x+1)|m_k} \mathbb{F}_p[x]/(m_k/(x+1)) \oplus \bigoplus_{(x+1,m_k) = 1} \mathbb{F}_p[x]/(m_k(x))$. Note that any mapping which realizes an isomorphism as $\mathbb{F}_p[x]$-modules is necessarily also an $\mathbb{F}_p$-vector space isomorphism; since $(A+I)V$ has dimension 1, the right hand side of this isomorphism also has dimension 1 over $\mathbb{F}_p$. Now one of the left summands is $\mathbb{F}_p[x]/(x-(n-1))$, corresponding to the minimal polynomial. Thus the remaining summands must be trivial; that is, there are no invariant factors which are not divisible by $x+1$, and every invariant factor other than the minimal polynomial is exactly $x+1$.

So the elementary divisors of $A$ are $x+1$ ($n-1$ times) and $x-(n-1)$. The corresponding Jordan canonical form is $J = [b_{i,j}]$ where $b_{i,j} = n-1$ if $i=j=n$, $-1$ if $i=j \neq n$, and $0$ otherwise.