$\mathbf {The \ Problem \ is}:$ Give an example of a square matrix $A$ such that $\operatorname{rank} A^2 = \operatorname{rank} A$ but $\operatorname{rank} A^3 < \operatorname{rank} A$ where $A \in M_n(\mathbb R) \ or \ M_n(\mathbb C)$ .
$\mathbf {My \ approach} :$ Obviously, if $A$ can be thought of as a linear mapping from a finite dimensional vector space $V$ to $V$, then
$\operatorname{rank} A^2 = \operatorname{rank} A \Rightarrow \operatorname{Range} A \cap \operatorname{Ker} A = \emptyset$ .
Hence, I am trying to find linear maps that satisfies this typical criterion rather than finding matrices in directly computing $A^2$ and $A^3$, but in maximum cases $\operatorname{rank} A^3$ matches $\operatorname{rank} A$ .
This is impossible. Such $A$ does not exist.
Let $V=\mathbb C^n$. Since $A^2$ and $A$ have the same ranks, $\dim(A^2V)=\dim(AV)$. However, as $A^2V=A(AV)\subseteq AV$, we must have $A^2V=AV$. But then $A^3V=A(A^2V)=A(AV)=A^2V=AV$, meaning that $A^3$ and $A$ must also have the same ranks.