If we have $A = AB$, what can we conclude about $B$?
Solution 1:
The rank of $B$ is at least equal to the rank of $A$, because $$ \operatorname{rank}(A)=\operatorname{rank}(AB)\le\operatorname{rank}(B) $$
Now, in order to analyze further the problem, you can assume $A$ is in reduced row echelon form, because if $E$ is an invertible matrix such that $EA$ is in RREF, then $EAB=EA$.
Now consider a permutation matrix $P$ such that $AP$ has the block form $$ AP=\left[\begin{array}{c|c} I_r & C \\ \hline 0 & 0 \end{array}\right] $$ (permute the columns in such a way that the pivot columns are at the beginning in the right order to form the block $I_r$, where $r$ is the rank of $A$). Then you have $$ AP=APP^{-1}BP $$ and if we decompose $P^{-1}BP$ in compatible blocks $$ P^{-1}BP=\left[\begin{array}{c|c} B_1 & B_2 \\ \hline B_3 & B_4 \end{array}\right] $$ we have $$ \left[\begin{array}{c|c} I_r & C \\ \hline 0 & 0 \end{array}\right]= \left[\begin{array}{c|c} B_1+CB_3 & B_2+CB_4 \\ \hline 0 & 0 \end{array}\right] $$ and so we need $B_1+CB_3=I_r$ and $B_2+CB_4=C$.
Note: the block $C$ does not exist if $A$ has full column rank; in this case $A$ has a left inverse and $AB=A$ implies $B$ is the identity.
The condition $AB=A$ can also be expressed as $A(B-I)=0$; if $A$ hasn't full column rank then its null space is nonzero; take $v\ne0$ such that $Av=0$ and build the matrix $$ B=[v\ v\ \dots \ v]+I $$ Then $AB=A$ and $B\ne I$.