Nilpotent operator of index $n$ Let $T: \mathbb R^n \to \mathbb R^n$ be a linear operator such that $T^{n-1} \neq 0$ but $T^n = 0$. Prove that $\text{rank}(T)=n-1$ and give an example of such operator.
PS. This was on a homework, I searched a lot but couldn't find the solution/hint. The point is the problem can be solved in an elementary way (i.e. no use of characteristic polynomials, eigenvalues, etc.). I tried $\text{rank}(T) + \text{nullity}(T) = n$ which gives $\text{nullity}(T)=1$, but no results...

$T^{n-1}\neq 0$ so, there is a $x$ such that $T^{n-1}(x) \neq 0$. It's easy to see that every power $T^1(x), T^2(x), ..., T^{n-2}(x)$ are also different from 0 otherwise the n-1 power would be immediately 0.
Now let's prove that the family $(T^1(x), T^2(x), ... , T^{n-1}(x))$ is linearly independent.
For $\lambda_1, ..., \lambda_{n-1} \in \mathbb{R}$ :
$$\sum_{k=1}^{n-1} \lambda_k T^k(x) = 0$$
Now if you apply $T$ $n-2$ times to this, you will find that $\lambda_1 = 0$. Then you can apply $T$ $n-3$ times and you find that $\lambda_2=0$. Do this until you find that all $\lambda_k$ are 0 and you have that your family is linearly independent.
We now proved that $\dim (Im(T)) \geq n-1$. Obiously it cannot be $n$ because there is a non-zero vector ($T^{n-1}(x)$) that is sent to 0 by $T$. So it has to be exactly $n-1$.
An example would be any matrix that sends the canonical $(e_1, e_2, ..., e_n)$ base like this :
$$T(e_1)=0$$
And for i greater than 2 :
$$T(e_i) = e_{i-1}$$
It woud look like this :
$T =
 \begin{pmatrix}
  0 & 1 & 0 & 0 \\
  0 & 0 & 1 & 0 \\
  0  & 0  & 0 & 1  \\
  0 & 0 & 0 & 0
 \end{pmatrix}$
