Let $M\left(X\right)=\left\{X^{k}\mid k\in \mathbb{N}^{*}\right\}$ for every $n×n$ matrix $X$ with complex entries. If $A$ is an $n×n$ matrix with complex entries and $M\left(A\right)$ is finite, show that $\mathrm{rank}(A)=\mathrm{rank}(A^{k})$ for every $k\geq1$ if and only if there exists $m\geq2$ such that $A^{m}=A$.
Since $M\left(A\right)$ is finite we have $A^{r}=A^{s}$ with $r<s$ and $s,r$ are minimal. If $t=s-r$ then $A^{r}(A^{t}-I)=0$. From that the minimal polynomial is $x^{r}q(x)$, where $q(x)|x^{t}-1$.
I tried to apply Sylvester Inequality on $A^{r}(A^{t}-I)$ and we get $n \ge \operatorname{rank}(A^{r})+\operatorname{rank}(A^{t}-I)$. If we want to solve for the direct case we know $\operatorname{rank}(A^{r})=\operatorname{rank}(A)$ and we get $n \ge \operatorname{rank}(A)+\operatorname{rank}(A^{t}-I)$.
From here I dont know how to continue. Maybe we should write $A=PQ$, where $P$ is $(n×l)$ and $Q$ is $(l×n)$ and $l=\operatorname{rank}(A)$? (PS: The idea with the minimal polynomial is from the previous question and it is Zerox's idea).