Can there be a matrix $M$ such that $M^n\ne0$, but $M^{2n}=0$ for some integer $n>1$? Reading about dual numbers, which can be modeled by a matrix $\varepsilon$ such that $\varepsilon^2=0$, I wonder if it could be generalized to something which gives nonzero square, but e.g. a zero after some $n$ repeated squarings. Namely, I'm interested in a matrix model, so that it'd be easy to experiment with.
Do such matrices $M$ exist, that for some integer $n>1$ we had $M^n\ne0$, but $M^{2n}=0$? If yes, how to construct them?
 A: There is an entire class of matrices that have this property. Consider for instance the $ 4 \times 4 $ matrix
$$
M = \begin{pmatrix}0 & a & b & c\\0 & 0 & d & e\\0 & 0 & 0 & f\\0 & 0 & 0 &0\end{pmatrix}.
$$
Let $ a, d, f \ne 0 $ to simplify the discussion. Then you can work out that $ M^k \ne 0 $ for $ k < 4 $, whereas $ M^4 = 0 $ for any choice of the matrix elements.
This can be generalized to square matrices of any given dimension. Such matrices are said to be strictly upper triangular.
Now, I won't claim this is the most general form of a nilpotent matrix, but it's a quite large class to begin with.
A: In one picture: $$\begin{pmatrix}0&0&\color{red}{\bf1}&0&0&0&\cdots&\cdots&0\\ 0&0&0&\color{red}{\bf1}&0&0&\cdots&\cdots&0\\ 0&0&0&0&\color{red}{\bf1}&0&\cdots&\cdots&0\\ 0&0&0&0&0&\color{red}{\bf1}&\cdots&\cdots&0\\ 0&0&0&0&0&0&\cdots&\cdots&0\\ \vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\ddots&\vdots\\ 0&0&0&0&0&0&\cdots&\cdots&\color{red}{\bf1}\\ 0&0&0&0&0&0&\cdots&\cdots&0\\ 0&0&0&0&0&0&\cdots&\cdots&0\end{pmatrix}\qquad (i=2,d\geqslant3)$$
In more than one word:
Fix a vector basis $(e_k)_{1\leqslant k\leqslant d}$ of $\mathbb R^d$, where $d$ is the size of $M$, and some $1\leqslant i\leqslant d-1$, and assume that $Me_k=e_{k-i}$ for every $i+1\leqslant k\leqslant d$ and $Me_k=0$ for every $1\leqslant k\leqslant i$. 
The corresponding matrices are $M=(M_{k,\ell})_{1\leqslant k,\ell\leqslant d}$ where $M_{k,\ell}=0$ for every $(k,\ell)$ except $M_{k,k+i}=1$ for every $1\leqslant k\leqslant d-i$. If $i=1$, these are known as (nilpotent) Jordan matrices.
Then, for every $n\geqslant0$, $$M^n=0\iff ni\geqslant d.$$
Thus, $$M^n\ne0=M^{2n}\iff \frac{d}{2n}\leqslant i\lt \frac{d}n.$$
Note finally the restriction that if $M^m=0$ for some $m$ then $M^d=0$, thus $M^{2n}=0\ne M^n$ is impossible if $d\leqslant n$.
