Tag Archives: jordan canonical form

Compute the matrix exponential of a given matrix

Compute the exponential of the following matrices.

1. $A = \begin{bmatrix} 2 & -2 & 14 \\ 0 & 3 & -7 \\ 0 & 0 & 2 \end{bmatrix}$
2. $B = \begin{bmatrix} 9 & 4 & 5 \\ -4 & 0 & -3 \\ -6 & -4 & -2 \end{bmatrix}$
3. $C = \begin{bmatrix} 1 & 1 & 1 & 1 \\ 0 & 1 & 0 & -1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 1 \end{bmatrix}$

Let $P = \begin{bmatrix} -7 & -1 & -2 \\ 7 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix}$. Evidently, $P^{-1}AP = \begin{bmatrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}$ is in Jordan canonical form. now $P^{-1}\mathsf{exp}(A)P = \begin{bmatrix} e^2 & 0 & 0 \\ 0 & e^2 & 0 \\ 0 & 0 & e^3 \end{bmatrix}$ using this previous exercise. So $\mathsf{exp}(A) = \begin{bmatrix} e^2 & 2e^2-2e^3 & 14e^3-14e^2 \\ 0 & e^3 & 7e^2 - 7e^3 \\ 0 & 0 & e^2 \end{bmatrix}$. (WolframAlpha agrees.)

Now consider $B$; we found in this previous exercise an invertible matrix $Q$ such that $Q^{-1}BQ = \begin{bmatrix} 2 & 1 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}$ is in Jordan canonical form. Again by this previous exercise we have $Q^{-1}\mathsf{exp}(B)Q = \begin{bmatrix} e^2 & e^2 & 0 \\ 0 & e^2 & 0 \\ 0 & 0 & e^3 \end{bmatrix}$, so that $\mathsf{exp}(B) = \begin{bmatrix} 2e^2 + 3e^3 & 4e^2 & 3e^3-e^2 \\ -2e^3 & -e^2 & e^2-2e^3 \\ -2e^2-2e^3 & -4e^2 & e^2-2e^3 \end{bmatrix}$. (WolframAlpha agrees.)

Finally, consider $C$. In this previous exercise, we exhibited an invertible matrix $R$ such that $R^{-1}CR = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \oplus \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}$ is in Jordan canonical form. Now $R^{-1}\mathsf{exp}(C)R = \begin{bmatrix} e & e & 0 & 0 \\ 0 & e & 0 & 0 \\ 0 & 0 & e & e \\ 0 & 0 & 0 & e \end{bmatrix}$, and so $\mathsf{exp}(C) = eC$. (WolframAlpha agrees.)

Compute the exponential of a matrix

Let $D = \begin{bmatrix} 1 & 2 & -4 & 4 \\ 2 & -1 & 4 & -8 \\ 1 & 0 & 1 & -2 \\ 0 & 1 & -2 & 3 \end{bmatrix}$. Compute $\mathsf{exp}(D)$.

Let $P = \begin{bmatrix} 0 & 1 & 2 & 0 \\ 2 & 0 & -2 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}$. Evidently, $P^{-1}DP = \begin{bmatrix} 1 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 1 \end{bmatrix}$ is in Jordan canonical form.

Now $\mathsf{exp}(P^{-1}DP) = \mathsf{exp} \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \oplus \mathsf{exp} \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}$, using this previous exercise. By this previous exercise, we have $\mathsf{exp} \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} e & e \\ 0 & e \end{bmatrix}$. So $P^{-1}\mathsf{exp}(D)P = e P^{-1}DP$, and we have $\mathsf{exp}(D) = eD$.

(WolframAlpha agrees.)

Matrices with square roots over fields of characteristic 2

Let $F$ be a field of characteristic 2. Compute the Jordan canonical form of a Jordan block $J$ of size $n$ and eigenvalue $\lambda$ over $F$. Characterize those matrices $A$ over $F$ which are squares; that is, characterize $A$ such that $A = B^2$ for some matrix $B$.

Let $J = [b_{i,j}]$ be the Jordan block with eigenvalue $\lambda$ and size $n$. That is, $b_{i,j} = \lambda$ if $j = i$, $1$ if $j = i+1$, and 0 otherwise. Now $J^2 = [\sum_k b_{i,k}b_{k,j}]$; if $k \neq i$ or $k \neq i+1$, then $b_{i,k} = 0$. Evidently then we have $(J^2)_{i,j} = \lambda^2$ if $j = i$, $1$ if $j = i+2$, and 0 otherwise, Noting that $2 = 0$. So $J^2 - \lambda^2 I = \begin{bmatrix} 0 & I \\ 0_2 & 0 \end{bmatrix}$, where $0_2$ is the $2 \times 2$ zero matrix and $I$ is the $(n-2) \times (n-2)$ identity matrix. Now let $v = \begin{bmatrix} V_1 \\ V_2 \end{bmatrix}$, where $V_1$ has dimension $2 \times 1$. Now $(J^2 - \lambda^2 I)v = \begin{bmatrix} V_2 \\ 0 \end{bmatrix}$. That is, $J^2 - \lambda^2 I$ ‘shifts’ the entries of $v$– so $e_{i+2} \mapsto e_i$ and $e_1, e_2 \mapsto 0$. In particular, the kernel of $J^2 - \lambda^2 I$ has dimension 2, so that by this previous exercise, the Jordan canonical form of $J^2$ has two blocks (both with eigenvalue $\lambda^2$.

Now $J^2 - \lambda^2 I = (J + \lambda I)(J - \lambda I)$ $= (J - \lambda I)^2$, since $F$ has characteristic 2. Note that $J-\lambda I$ has order $n$, since (evidently) we have $(J - \lambda I)e_{i+1} = e_i$ and $(J - \lambda I)e_1 = 0$. So $J-\lambda I$ has order $n$. If $n$ is even, then $(J^2 - \lambda^2 I)^{n/2} = 0$ while $(J^2 - \lambda^2 I)^{n/2-1} \neq 0$, and if $n$ is odd, then $(J^2-\lambda^2 I)^{(n+1)/2} = 0$ while $(J^2 - \lambda^2 I)^{(n+1)/2-1} \neq 0$. So the minimal polynomial of $J^2$ is $(x-\lambda^2)^{n/2}$ if $n$ is even and $(x-\lambda^2)^{(n+1)/2}$ if $n$ is odd.

So the Jordan canonical form of $J^2$ has two Jordan blocks with eigenvalue $\lambda^2$. If $n$ is even, these have size $n/2,n/2$, and if $n$ is odd, they have size $(n+1)/2, (n-1)/2$.

Now let $A$ be an arbitrary $n \times n$ matrix over $F$ (with eigenvalues in $F$). We claim that $A$ is a square if and only if the following hold.

1. The eigenvalues of $A$ are square in $F$
2. For each eigenvalue $\lambda$ of $A$, the Jordan blocks with eigenvalue $\lambda$ can be paired up so that the sizes of the blocks in each pair differ by 0 or 1.

To see the ‘if’ part, suppose $P^{-1}AP = \bigoplus H_i \oplus K_i$ is in Jordan canonical form, where $H_i$ and $K_i$ are Jordan blocks having the same eigenvalue $\lambda_i$ and whose sizes differ by 0 or 1. By the first half of this exercise, $H_i \oplus K_i$ is the Jordan canonical form of $J_i^2$, where $J_i$ is a Jordan block with eigenvalue $\sqrt{\lambda_i}$. Now $A$ is similar to the direct sum of these $J_i^2$, and so $Q^{-1}AQ = J^2$. Then $A = (Q^{-1}JQ)^2 = B^2$ is square.

Conversely, suppose $A = B^2$ is square, and say $P^{-1}BP = J$ is in Jordan canonical form. So $P^{-1}AP = J^2$. Letting $J_i$ denote the Jordan blocks of $J$, we have $P^{-1}AP = \bigoplus J_i^2$. The Jordan canonical form of $J_i^2$ has two blocks with eigenvalue $\lambda_i^2$ and whose sizes differ by 0 or 1, by the first half of this exercise. So the Jordan blocks of $A$ all have eigenvalues which are square in $F$ and can be paired so that the sizes in each pair differ by 0 or 1.

Matrices with square roots

Let $F$ be a field whose characteristic is not 2. Characterize those matrices $A$ over $F$ which have square roots. That is, characterize $A$ such that $A = B^2$ for some matrix $B$.

We claim that $A$ has a square root if and only if the following hold.

1. Every eigenvalue of $A$ is square in $F$.
2. The Jordan blocks of $A$ having eigenvalue 0 can be paired up in such a way that the sizes of the blocks in each pair differ by 0 or 1.

First we tackle the ‘if’ part. Suppose $P^{-1}AP = \bigoplus J_i \oplus \bigoplus H_i \oplus \bigoplus K_i$ is in Jordan canonical form, where $J_i$ are the Jordan blocks having nonzero eigenvalue $\lambda_i$ and $H_i$ and $K_i$ are the blocks with eigenvalue 0 such that the sizes of $H_i$ and $K_i$ differ by 0 or 1. As we showed in this previous exercise, $J_i = Q_iM_i^2Q_i^{-1}$ is the Jordan canonical form of the square of the Jordan block $M_i$ with eigenvalue $\sqrt{\lambda_i}$, and $H_i \oplus K_i = T_iN_i^2T_i^{-1}$ is the Jordan canonical form of the square of the Jordan block whose size is $\mathsf{dim}\ H_i + \mathsf{dim}\ K_i$ with eigenvalue 0. So we have $P^{-1}AP = C^2$, and so $A = (P^CP^{-1})^2$ $= B^2$ is a square.

Conversely, suppose $A = B^2$ is a square, and say $P^{-1}BP = J$ is in Jordan canonical form. Now $PAP^{-1} = J^2$. Now say $Q^{-1}J^2Q = K$ is in Jordan canonical form; then $Q^{-1}PAP^{-1}Q = K$. By the previous exercise, the nonzero eigenvalues of $K$ are square in $F$, and the Jordan blocks having eigenvalue 0 can be paired so that the sizes in each pair differ by 0 or 1.

On the square of a Jordan block

Let $J$ be a Jordan block of size $n$ and eigenvalue $\lambda$ over a field $K$ whose characteristic is not 2.

1. Suppose $\lambda \neq 0$. Prove that the Jordan canonical form of $J^2$ is the Jordan block of size $n$ with eigenvalue $\lambda^2$.
2. Suppose $\lambda = 0$. Prove that the Jordan canonical form of $J^2$ has two blocks (with eigenvalue 0) of size $n/2, n/2$ if $n$ is even and of size $(n+1)/2, (n-1)/2$ if $n$ is odd.

First suppose $\lambda \neq 0$.

Lemma: Let $e_i$ denote the $i$th standard basis element (i.e. $e_i = [\delta_{i,1}\ \delta_{i,2}\ \ldots\ \delta_{i,n}]^\mathsf{T}$. If $1 \leq i < n-2$, then $(J^2-\lambda^2I)e_{i+2} = 2\lambda e_{i+1} + e_i$, $(J^2-\lambda^2I)e_{2} = 2\lambda e_1$, and $(J^2-\lambda^2I)e_1 = 0$. Proof: We have $J^2-\lambda^2I = (J+\lambda I)(J-\lambda I)$. Evidently, $(J-\lambda I)e_{i+2} = e_{i+1}$. Now $J+\lambda I = [b_{j,k}]$, where $b_{j,k} = 2\lambda$ if $j = k$ and $1$ if $k = j+1$ and 0 otherwise. So $(J+\lambda I)e_{i+1} = [\sum_k b_{j,k} \delta_{k,i+1}]$ $= [b_{j,i+1}]$ $= 2\lambda e_{i+1} + e_i$ if $i > 1$, and similarly $(J^2-\lambda^2 I)(e_2) = 2\lambda e_1$. $\square$

In particular, note that $(J^2 - \lambda^2 I)^{n-1} e_n = 2^{n-1}\lambda^{n-1} e_1$ is nonzero (here we use the noncharacteristictwoness of $K$), while $(J^2 - \lambda^2 I)^n = 0$. So the minimal polynomial of $J^2$ is $(x-\lambda^2)^n$. Thus the Jordan canonical form of $J^2$ has a single Jordan block, of size $n$, with eigenvalue $\lambda^2$.

Now suppose $\lambda = 0$. Evidently, we have $Je_{i+1} = e_i$ and $Je_1 = 0$. Now $J^n = 0$ and $J^{n-1} \neq 0$. If $n$ is even, we have $(J^2)^{n/2} = 0$ and $(J^2)^{n/2-1} = J^{n-2} \neq 0$, so that the minimal polynomial of $J^2$ is $x^{n/2}$. If $n$ is odd, we have $(J^2)^{(n+1)/2} = 0$ while $(J^2)^{(n+1)/2-1} = J^{n-1} \neq 0$, so the minimal polynomial of $J^2$ is $x^{(n+1)/2}$.

Next, we claim that $\mathsf{ker}\ J^2$ has dimension 2. To this end, note that $J^2e_{i+2} = e_i$ is nonzero, while $J^2e_2 = J^2e_1 = 0$. By this previous exercise, $J^2$ has 2 Jordan blocks; thus the blocks of $J^2$ both have eigenvalue 0 and are of size $n/2,n/2$ if $n$ is even, and $(n+1)/2, (n-1)/2$ if $n$ is odd.

A relation between rank and the number of Jordan blocks of a finitely generated module over a PID

Let $F$ be a field, $V$ and $n$-dimensional $F$-vector space, and $T$ a linear transformation on $V$. Suppose the eigenvalues of $T$ are contained in $F$, and let $\lambda$ be one such eigenvalue. Let $k$ be a natural number, and let $r_k = \mathsf{dim}_F\ (T-\lambda I)^k V$. Prove that $r_{k-1} - 2r_k + r_{k+1}$ is the number of Jordan blocks of $T$ with eigenvalue $\lambda$ and having size $k$.

We will use the notation established in this previous exercise. To wit, $\lambda_i$ are the eigenvalues of $T$, and we have $V = \bigoplus_i \bigoplus_j F[x]/(x-\lambda_i)^{a_{i,j}}$, where $a_{i,j}$ is the ‘size’ (that is, dimension over $F$) of its corresponding Jordan block. For brevity we say $V_i = \bigoplus_j F[x]/(x-\lambda_i)^{a_{i,j}}$.

We showed in that previous exercise that $\mathsf{dim}_F\ (T-\lambda_t I)^kV = \sum_{j,a_{t,j} > k} (a_{t,j} - k) + \mathsf{dim}_F\ \bigoplus_{i,i\neq t} V_i$. Thus we have the following.

 $r_{k-1} - 2r_k + r_{k+1}$ = $\sum_{j,a_{t,j} > k-1} (a_{t,j} - k + 1) - 2 \sum_{j,a_{t,j} > k} (a_{t,j} - k) + \sum_{j,a_{t,j} > k+1} (a_{t,j} - k - 1)$ = $\sum_{j,a_{t,j} > k+1} (a_{t,j} - k+1 - 2(a_{t,j}-k) + a_{t,j}-k-1) + \sum_{j,a_{t,j} = k+1} (a_{t,j} - k + 1 - 2(a_{t,j}-k) + \sum_{j,a_{t,j} = k} (a_{t,j} - k + 1)$ = $\sum_{j,a_{t,j} = k} 1$

This final sum is precisely the number of Jordan blocks with eigenvalue $\lambda_t$ and having size $k$, as desired.

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.

Compute the Jordan canonical form of a given matrix over QQ

Compute the Jordan canonical form over $\mathbb{Q}$ of the $n \times n$ matrix whose diagonal entries are 0 and whose off-diagonal entries are 1.

Let $A = [1 - \delta_{i,j}]$. Note the following.

 $(A - (n-1)I)(A + I)$ = $[1 - \delta_{i,j} - \delta_{i,j}(n-1)][1 - \delta_{i,j} + \delta_{i,j}]$ = $[1-\delta_{i,j}n][1]$ = $[\sum_k (1 - \delta_{i,k}n)1]$ = $[\sum_k 1 - \sum_k \delta_{i,k}n]$ = $[n-n]$ = $[0]$

So the minimal polynomial of $A$ divides $(x-(n-1))(x+1)$. Since $A \neq -I$ and $A \neq (n-1)I$, in fact this is the minimal polynomial of $A$.

Suppose now that $v = [v_1\ \ldots\ v_n]$ is an eigenvector with eigenvalue $n-1$. Evidently then for each $i$, we have $\sum_{k \neq i} v_k = (n-1)v_i$, and thus $\sum_k v_k = nv_i$. Since $n \neq 0$, we have $v_i = v_j$ for all $i,j$, so that $v = v_1[1\ \ldots\ 1]^\mathsf{T}$. In particular, the eigenspace with eigenvalue $n-1$ has dimension 1. By the lemma we proved in this previous exercise, $n-1$ has multiplicity 1 in the characteristic polynomial of $A$. So the elementary divisors of $A$ are $x+1$ $n-1$ times and $x-(n-1)$. The Jordan canonical form of $A$ is thus $J = [b_{i,j}]$, where $b_{i,j} = n-1$ if $i=j=n$, $-1$ if $i = j \neq n$, and 0 otherwise.

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

Let $p$ be a prime. Compute the Jordan canonical form over the finite field $\mathbb{F}_p$ of the $n \times n$ matrix whose every entry is 1. ($n \geq 2$.)

Let $A = [1]$. Now the computation in this previous exercise holds over $\mathbb{F}_p$ (indeed, over any ring with 1), and so we have $A(A-nI) = 0$.

If $n$ is not divisible by $p$, then $n$ is a unit in $\mathbb{F}_p$. If $v = [v_1\ \ldots\ v_n]^\mathsf{T}$ is an eigenvector with eigenvalue $n$, then evidently (as we saw in the exercise referenced above) $v = v_1[1\ \ldots\ 1]^\mathsf{T}$. So the eigenspace of $n$ has dimension 1, the characteristic polynomial of $A$ is $x^{n-1}(x-n)$, and the Jordan canonical form of $A$ is $J = [b_{i,j}]$ where $b_{n,n} = n$ and $b_{i,j} = 1$ otherwise.

Suppose $p$ divides $n$. Since $A \neq 0$, the minimal polynomial of $A$ is now $x^2$. We claim that the remaining invariant factors of $A$ are $x$. There is probably a slick linear-algebraic way to argue this, but I don’t see it. Instead I will show explicitly that $A$ is similar to a matrix in Jordan canonical form. (If anyone can offer a simplification of this proof I’d be grateful!)

If $n = 2$, then the minimal polynomial of $A$ is the only invariant factor, so the Jordan form of $A$ is $\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}$. Suppose $n \geq 2$.

Let $U = [1\ \ldots\ 1]^\mathsf{T}$ have dimension $(n-1) \times 1$, and let $W$ be the $(n-1) \times (n-1)$ matrix whose every entry is 1. Note that $UU^\mathsf{T} = W$ and $U^\mathsf{T}U = [n-1]$. Let $P = \begin{bmatrix} 1 & 0 \\ U & I \end{bmatrix}$ and $Q = \begin{bmatrix} 1 & 0 \\ -U & I \end{bmatrix}$. Evidently $QP = I$, so that $Q = P^{-1}$. Moreover, we have $A = \begin{bmatrix} 1 & U^\mathsf{T} \\ U & W \end{bmatrix}$, and $P^{-1}AP = B = \begin{bmatrix} n & U^\mathsf{T} \\ 0 & 0 \end{bmatrix}$ $= \begin{bmatrix} 0 & U^\mathsf{T} \\ 0 & 0 \end{bmatrix}$.

Now let $V = [1\ \ldots\ 1]$ have dimension $1 \times (n-2)$. Let $R = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & -V \\ 0 & 0 & I \end{bmatrix}$ and $S = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & V \\ 0 & 0 & I \end{bmatrix}$. Evidently, $RS = I$, so that $S = R^{-1}$. Now $B = \begin{bmatrix} 0 & 1 & V \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}$, and we have $R^{-1}BR = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}$. If we squint just right, this matrix is in Jordan canonical form, and is similar to $A$.

Compute the Jordan canonical form of a given matrix over QQ

Compute the Jordan canonical form over $\mathbb{Q}$ of the $n \times n$ matrix whose every entry is equal to 1.

Let $A = [1]$ be an $n \times n$ matrix. Note the following.

 $A(A-nI)$ = $[1][1-\delta_{i,j}n]$ = $[\sum_k 1_{i,k}(1_{k,j} - \delta_{k,j}n)]$ = $[\sum_k 1 - \sum_k \delta_{k,j} n]$ = $[n-n]$ = $[0]$

So we have $A(A-nI) = 0$, and thus the minimal polynomial of $A$ divides $x(x-n)$. Since $A \neq 0$ and $A \neq nI$, the minimal polynomial of $A$ is $x(x-n)$.

Next we prove a lemma.

Lemma: Let $A$ be an $n \times n$ matrix over a field $F$ containing the eigenvalues of $A$, and let $\lambda$ be an eigenvalue of $A$ with eigenspace $W \subseteq F^n$. If the minimal polynomial of $A$ over $F$ is a product of distinct linear factors, then the dimension of $W$ (over $F$) is precisely the multiplicity of $\lambda$ among the roots of the characteristic polynomial of $A$. Proof: Let $V = F^n$. As an $F[x]$ module via $A$, we have $V = \bigoplus_{i=1}^n F[x]/(x-\lambda_i)$, where $\lambda_i$ are the eigenvalues of $A$. The eigenspace of $\lambda$ consists precisely of those direct factors with $\lambda_i = \lambda$, each of which has dimension 1 over $F$. $\square$

For our given matrix $A$, we claim that the eigenspace $W$ of the eigenvalue $n$ has dimension 1 over $F$. To see this, let $v = [v_1\ \ldots\ v_n]^\mathsf{T}$ and suppose $Av = nv$. Evidently, every entry of $Av$ is $\sum_k v_k$, and so we have $nv_i = nv_j$ for all $i,j$. Since $n \neq 0$, we have $v_i = v_j$ for all $i,j$, and so $v = v_1[1\ \ldots\ 1]^\mathsf{T}$. So $W$ has a basis containing one element, and so has dimension 1 over $F$ as desired.

By the lemma, $n$ has multiplicity 1 among the roots of the characteristic polynomial of $A$. Since the remaining roots are 0, the invariant factors of $A$ are $x$ $n-2$ times and $x(x-n)$. The corresponding Jordan canonical form matrix is $J = [b_{i,j}]$, with $b_{n,n} = n$ and $b_{i,j} = 0$ otherwise.