How to prove that $AB$ is a projection if $(AB)(BA)=AB$? I was trying to solve the following problem:
Assume $A,B\in M_n\left( \mathbb{C} \right)$,satisfy $$AB^2A=AB.$$
I need to proof $$\left( AB \right) ^2=AB.$$
I tried to use some equivalent substitution of matrices, but I did not succeed. I also tried to find some counterexamples of matrices, such as 2nd order matrices, but I did not succeed either.
I don't know if this is a right problem or a wrong problem.
I hope to solve this problem. Thanks!
 A: Fusheng's own answer is elegant. Here I am just trying to find an alternative solution.
Using Fitting's decomposition or Jordan form, we may write $\mathbb C^n=V\oplus W$ where $V$ and $W$ are two invariant subspaces of $BA$ such that $BA$ is nonsingular on $V$ and nilpotent on $W$. Let $(BA)^mW=0$. Then
$$
ABW=ABBAW=(ABBA)BAW=AB(BA)^2W=\cdots=AB(BA)^mW=0.
$$
Therefore, by a change of basis, we may assume that
$$
AB=\pmatrix{X&0\\ Z&0}\quad\text{and}\quad BA=\pmatrix{M\\ &N}
$$
where $M$ is nonsingular, $N$ is nilpotent and $X$ has the same size as $M$. Since $AB$ and $BA$ have the same characteristic polynomial, $X$ and $M$ have the same spectrum. Hence $X$ is nonsingular and the condition $ABBA=AB$ implies that $XM=X$ and in turn $M=I$. Thus $X$ is unipotent (because it has the same spectrum as $M$). However, as $AB-I$ and $BA-I$ have the same rank, we must have $X=I$. Therefore $AB=\pmatrix{I&0\\ Z&0}$ is idempotent.
A: I have solved this problem！！！
Assume $I_n$ is a n-order unit matrix.
From $AB^2A=AB$,we can get $AB(BA-I_n)=0.$
So$$\mathrm{rank}(AB)+\mathrm{rank}(BA-I_n)\leqslant n.$$
Because $\mathrm{rank}(BA-I_n)=\mathrm{rank}(AB-I_n)$, we can get $$\mathrm{rank}(AB)+\mathrm{rank}(I_n-AB)\leqslant n.$$
Because  $$\mathrm{rank}(AB)+\mathrm{rank}(I_n-AB)\geqslant \mathrm{rank}(AB+I_n-AB)=n,$$
we can get $$\mathrm{rank}(AB)+\mathrm{rank}(I_n-AB)=n.$$
Thus from the equivalent condition for idempotent matrixs, we can get
$$(AB)^2=AB.$$
A: So we know that $ABBA=AB$. Supposing that the inverse elements $A^{-1}$ and $B^{-1}$ exist,
we can multiplity this from the left with $A^{-1}$ to get $BBA=B$ and then multiply with
$B^{-1}$ from the left to get $BA=1$.
Insert this into the product $AB^2A=ABBA$ to give $AB(BA)=AB1=AB$ which was to be shown.
