If the rank of $A$ is equal to the number of non-zero eigenvalues, do $A$ and $A^2$ have the same rank? Let $A$ be an $n$-by-$n$ matrix over some field. If it happens that $\operatorname{rank}(A)=$ number of non-zero eigenvalues of $A$, can we say that $\operatorname{rank}(A^2)=\operatorname{rank}(A)$?


I believe we can say this (thinking about idempotent matrices) but I am not sure about the proof.  Please give some hints to get started and the main idea.
Let $J= \operatorname{diag}(J_1,...,J_k)$ be the Jordan normal form.

Note that $J^2= \operatorname{diag}(J_1^2,...,J_k^2)$ 

The rank of $J$ is given by the sum of the
ranks of the blocks that is, $\operatorname{rk} J = \sum_k \operatorname{rk} J_k$.
Similarly,
 $\operatorname{rk} J^2 = \sum_k \operatorname{rk} J_k^2$.

It follows from the hypothesis that the rank of the Jordan block
 corresponding to the zero eigenvalue is zero. That is, the Jordan
block is identically zero (and so is the square of the Jordan block).

For the blocks $J_k$ corresponding to non zero eigenvalues, we have
$\operatorname{rk} J_k = \operatorname{rk} J_k^2$.

It follows that $\operatorname{rk} J = \operatorname{rk} J^2$.

Alternative:

Let $N = \ker A$. We see that $z=\dim N$ is the number of zero eigenvalues of $A$. Let $b_1,..,b_z$ be a basis for $N$ and complete the basis with $b_{z+1},...,b_n$. Note that $N$ is $A$ invariant and so in this basis, $A$ has the form
$\begin{bmatrix} 0 &amp; A_{12} \\ 0 &amp; A_{22}\end{bmatrix}$. Furthermore, we
must have $\det A_{22} \neq 0$ otherwise $A$ would have more that $ z$ zero eigenvalues.

Then we want to show that $\ker A^2 = N$. Note that $A^2$ has the form
$\begin{bmatrix} 0 &amp; A_{12}A_{22} \\ 0 &amp; A_{22}^2\end{bmatrix}$ and it follows from
this that if $x \in \ker A^2$ then $x \in \ker A$.
No. Let for example $A$ the nilpotent matrix

$$A=\begin{pmatrix}0&amp;1\\0&amp;0\end{pmatrix}$$
then we have $\operatorname{rank}(A)=1$ and $\operatorname{rank}(A^2)=\operatorname{rank}(0)=0$.

Edit I used in my above answer the classic definition of the rank of matrix which is the dimension of the image of the matrix. For the definition of the rank given by the OP, the answer is yes in the field $\Bbb C$ and to see this we use that every matrix is similar to a triangular matrix.