If $G$ is a generalized inverse of a matrix $A$ (i.e. $AGA=A$), then is it true that every generalized inverse of $A$ can be written in the form $G+B-GABAG$ for some matrix $B$ of same order as $G$?
I could show that this matrix is a generalized inverse for every matrix $B$, since \begin{align} A(G+B-GABAG)A&=AGA+ABA-AGABAGA\\ &=A+ABA-ABA\\ &=A \end{align} But I couldn't conclude that every generalized inverse of $A$ can be written in this form. Any ideas on that?
Let $f(X)=AXA,\,g(X)=GAXAG$ and $\pi=\operatorname{id}-g$. One can verify that $g$ and in turn $\pi$ are idempotent. Also, $f\pi=0$. Therefore $$ \operatorname{range}(\pi)\subseteq\ker(f)\subseteq\ker(g). $$ However, as $\pi$ is $g$ are complementary projections to each other, we have $\operatorname{range}(\pi)=\ker(g)$. Thus $\operatorname{range}(\pi)=\ker(f)=\ker(g)$ by the sandwich principle.
Now, for any generalised inverse $X$ of $A$, we have $X-G\in\ker(f)=\operatorname{range}(\pi)$. Hence $X=G+\pi(B)$ for some matrix $B$.