# Nilpotent matrix

In linear algebra, a nilpotent matrix is a square matrix N such that
    $N^{k}=0\,$
for some positive integer $k$. The smallest such $k$ is called the index of $N$, sometimes the degree of $N$.
More generally, a nilpotent transformation is a linear transformation $L$ of a vector space such that $L^{k}=0$ for some positive integer $k$ (and thus, $L^{j}=0$ for all $j\geq k$). Both of these concepts are special cases of a more general concept of nilpotence that applies to elements of rings.

## Examples
### Example 1

The matrix
    $A={\begin{bmatrix}0&1\\0&0\end{bmatrix}}$
is nilpotent with index 2, since $A^{2}=0$.

### Example 2

More generally, any $n$-dimensional triangular matrix with zeros along the main diagonal is nilpotent, with index $\leq n$. For example, the matrix
    $B={\begin{bmatrix}0&2&1&6\\0&0&1&2\\0&0&0&3\\0&0&0&0\end{bmatrix}}$
is nilpotent, with
    $B^{2}={\begin{bmatrix}0&0&2&7\\0&0&0&3\\0&0&0&0\\0&0&0&0\end{bmatrix}};\ B^{3}={\begin{bmatrix}0&0&0&6\\0&0&0&0\\0&0&0&0\\0&0&0&0\end{bmatrix}};\ B^{4}={\begin{bmatrix}0&0&0&0\\0&0&0&0\\0&0&0&0\\0&0&0&0\end{bmatrix}}$
The index of $B$ is therefore 4.

### Example 3

Although the examples above have a large number of zero entries, a typical nilpotent matrix does not. For example,
    $C={\begin{bmatrix}5&-3&2\\15&-9&6\\10&-6&4\end{bmatrix}}\qquad C^{2}={\begin{bmatrix}0&0&0\\0&0&0\\0&0&0\end{bmatrix}}$
although the matrix has no zero entries.

### Example 4

Additionally, any matrices of the form
    ${\begin{bmatrix}a_{1}&a_{1}&\cdots &a_{1}\\a_{2}&a_{2}&\cdots &a_{2}\\\vdots &\vdots &\ddots &\vdots \\-a_{1}-a_{2}-\ldots -a_{n-1}&-a_{1}-a_{2}-\ldots -a_{n-1}&\ldots &-a_{1}-a_{2}-\ldots -a_{n-1}\end{bmatrix}}$
such as
    ${\begin{bmatrix}5&5&5\\6&6&6\\-11&-11&-11\end{bmatrix}}$
or
    ${\begin{bmatrix}1&1&1&1\\2&2&2&2\\4&4&4&4\\-7&-7&-7&-7\end{bmatrix}}$
square to zero.

### Example 5

Perhaps some of the most striking examples of nilpotent matrices are $n\times n$ square matrices of the form:
    ${\begin{bmatrix}2&2&2&\cdots &1-n\\n+2&1&1&\cdots &-n\\1&n+2&1&\cdots &-n\\1&1&n+2&\cdots &-n\\\vdots &\vdots &\vdots &\ddots &\vdots \end{bmatrix}}$
The first few of which are:
    ${\begin{bmatrix}2&-1\\4&-2\end{bmatrix}}\qquad {\begin{bmatrix}2&2&-2\\5&1&-3\\1&5&-3\end{bmatrix}}\qquad {\begin{bmatrix}2&2&2&-3\\6&1&1&-4\\1&6&1&-4\\1&1&6&-4\end{bmatrix}}\qquad {\begin{bmatrix}2&2&2&2&-4\\7&1&1&1&-5\\1&7&1&1&-5\\1&1&7&1&-5\\1&1&1&7&-5\end{bmatrix}}\qquad \ldots$
These matrices are nilpotent but there are no zero entries in any powers of them less than the index.

### Example 6

Consider the linear space of polynomials of a bounded degree. The derivative operator is a linear map. We know that applying the derivative to a polynomial decreases its degree by one, so when applying it iteratively, we will eventually obtain zero. Therefore, on such a space, the derivative is representable by a nilpotent matrix.

## Characterization

For an $n\times n$ square matrix $N$ with real (or complex) entries, the following are equivalent:
* $N$ is nilpotent.
* The characteristic polynomial for $N$ is $\det \left(xI-N\right)=x^{n}$.
* The minimal polynomial for $N$ is $x^{k}$ for some positive integer $k\leq n$.
* The only complex eigenvalue for $N$ is 0.
The last theorem holds true for matrices over any field of characteristic 0 or sufficiently large characteristic. (cf. Newton's identities)
This theorem has several consequences, including:
* The index of an $n\times n$ nilpotent matrix is always less than or equal to $n$. For example, every $2\times 2$ nilpotent matrix squares to zero.
* The determinant and trace of a nilpotent matrix are always zero. Consequently, a nilpotent matrix cannot be invertible.
* The only nilpotent diagonalizable matrix is the zero matrix.
See also: Jordan–Chevalley decomposition#Nilpotency criterion.

## Classification

Consider the $n\times n$ (upper) shift matrix:
    $S={\begin{bmatrix}0&1&0&\ldots &0\\0&0&1&\ldots &0\\\vdots &\vdots &\vdots &\ddots &\vdots \\0&0&0&\ldots &1\\0&0&0&\ldots &0\end{bmatrix}}.$
This matrix has 1s along the superdiagonal and 0s everywhere else. As a linear transformation, the shift matrix "shifts" the components of a vector one position to the left, with a zero appearing in the last position:
    $S(x_{1},x_{2},\ldots ,x_{n})=(x_{2},\ldots ,x_{n},0).$
This matrix is nilpotent with degree $n$, and is the canonical nilpotent matrix.
Specifically, if $N$ is any nilpotent matrix, then $N$ is similar to a block diagonal matrix of the form
    ${\begin{bmatrix}S_{1}&0&\ldots &0\\0&S_{2}&\ldots &0\\\vdots &\vdots &\ddots &\vdots \\0&0&\ldots &S_{r}\end{bmatrix}}$
where each of the blocks $S_{1},S_{2},\ldots ,S_{r}$ is a shift matrix (possibly of different sizes). This form is a special case of the Jordan canonical form for matrices.
For example, any nonzero 2 × 2 nilpotent matrix is similar to the matrix
    ${\begin{bmatrix}0&1\\0&0\end{bmatrix}}.$
That is, if $N$ is any nonzero 2 × 2 nilpotent matrix, then there exists a basis b$_1$, b$_2$ such that Nb$_1$ = 0 and Nb$_2$ = b$_1$.
This classification theorem holds for matrices over any field. (It is not necessary for the field to be algebraically closed.)

## Flag of subspaces

A nilpotent transformation $L$ on $\mathbb {R} ^{n}$ naturally determines a flag of subspaces
    $\{0\}\subset \ker L\subset \ker L^{2}\subset \ldots \subset \ker L^{q-1}\subset \ker L^{q}=\mathbb {R} ^{n}$
and a signature
    $0=n_{0}<n_{1}<n_{2}<\ldots <n_{q-1}<n_{q}=n,\qquad n_{i}=\dim \ker L^{i}.$
The signature characterizes $L$ up to an invertible linear transformation. Furthermore, it satisfies the inequalities
    $n_{j+1}-n_{j}\leq n_{j}-n_{j-1},\qquad {\mbox{for all }}j=1,\ldots ,q-1.$
Conversely, any sequence of natural numbers satisfying these inequalities is the signature of a nilpotent transformation.

## Additional properties

* If $N$ is nilpotent of index $k$ , then $I+N$ and $I-N$ are invertible, where $I$ is the $n\times n$ identity matrix. The inverses are given by
    ${\begin{aligned}(I+N)^{-1}&=\displaystyle \sum _{m=0}^{k}\left(-N\right)^{m}=I-N+N^{2}-N^{3}+N^{4}-N^{5}+N^{6}-N^{7}+\cdots +(-N)^{k}\\(I-N)^{-1}&=\displaystyle \sum _{m=0}^{k}N^{m}=I+N+N^{2}+N^{3}+N^{4}+N^{5}+N^{6}+N^{7}+\cdots +N^{k}\\\end{aligned}}$
* If $N$ is nilpotent, then Conversely, if $A$ is a matrix and for all values of $t$, then $A$ is nilpotent. In fact, since $p(t)=\det(I+tA)-1$ is a polynomial of degree $n$, it suffices to have this hold for $n+1$ distinct values of $t$.
    $\det(I+N)=1.$
    $\det(I+tA)=1\!\,$
* Every singular matrix can be written as a product of nilpotent matrices.
* A nilpotent matrix is a special case of a convergent matrix.

## Generalizations

A linear operator $T$ is locally nilpotent if for every vector $v$, there exists a $k\in \mathbb {N}$ such that
    $T^{k}(v)=0.\!\,$
For operators on a finite-dimensional vector space, local nilpotence is equivalent to nilpotence.