Artificial intelligent assistant

The rank of general inverse of $A$ times $A$? Supposing $X$ is the general inverse of $A$, that $AXA = A$. Then $XA$ is idempotent, that is $(XA)(XA) = XA$. Why is the rank of $XA$ equal to the rank of $A$ ? Thanks.

On the one hand $\text{rank}(XA)\leq \min\left(\text{rank}(X), \text{rank}(A)\right)\leq \text{rank}(A)$.

On the other hand $\text{rank}(A)=\text{rank}(AXA)\leq \min\left(\text{rank}(A), \text{rank}(XA)\right)\leq \text{rank}(XA)$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 01bad0a31e34df9570cc451cb409d5b9