Categories such that $\operatorname{id}=f\circ g\nRightarrow\operatorname{id}=g\circ f$ If $\operatorname{id}_A:A\to A$ is the identity morphism in a category and that there exists $f:B\to A$, $g:A\to B$ such that $f\circ g=\operatorname{id}_A$, is it necessary true that $g\circ f=\operatorname{id}_B$? If it is false, does the existence of $f,g$ imply that $A\cong B$, that there are some other functions $f',g'$ such that $f'\circ g'=\operatorname{id}_A$ and $g'\circ f'=\operatorname{id}_B$?
I cannot think of any examples but I'm pretty sure it is false but I can't think of any easy examples. And I'm curious under what categories can we assume this is true in general, i.e. can we assume this holds for categories of groups, sets, rings?
Thanks for sharing your expertise.
 A: No. The existence of $f,g$ such that $f\circ g=\operatorname{id}$ does neither imply that $g\circ f=\operatorname{id}$ nor that there are functions $f',g'$ such that $f'\circ g'=\operatorname{id}$ and $g'\circ f'=\operatorname{id}$.
As an example consider $A=\{1,2,3\}$, $B=\{2,3\}$ and
$$
f\colon A\to B,\,1\mapsto2,\,2\mapsto3,\,3\mapsto2\quad\text{and}\quad g\colon B\to A,\,2\mapsto2,\,3\mapsto3
$$
Then $f\circ g=\operatorname{id}$, $g\circ f\ne\operatorname{id}$ and $A\not\cong B$ as they are of different cardinality.

What we have here are one-sided inverses. As the general statement does not even hold in the category of sets, chances are low it does hold in more sophisticated categories (such as the category of groups, rings, etc.).
We call $f$ such that $f\circ g=\operatorname{id}$ for some $g$ a split epimorphism (dually, $g$ a split monomorphism). As you might know we do not have monomorphism$+$epimorphism$=$isomorphism in general, but we do have split monomorphism$+$epimorphism$=$isomorphism (as well as monomorphism$+$ split epimorphism$=$isomorphism). This might be as close as one can get to your desired statement, i.e. if you further can  show that $f$ is a monomorphim then the implication in your title holds.
