Are these morphisms isomorphisms?

This question is inspired by exercise 1.1.19(vii) in "Basic Algebraic Topology" by Shastri.

Assume we are working in some category $\mathsf{C}$. Let $f: X \to Y$ and $g: Y \to X$ be morphisms, having the property that $f \circ g$ and $g \circ f$ are isomorphisms. Are $f$ and $g$ necessarily isomorphisms?

I think we can show that $f$ and $g$ are epimorphisms. Let $A$ be an object, and consider two maps $a,b: Y \to A$. Then, if $a \circ f = b \circ f$, we have $a \circ f \circ g = b \circ f \circ g$, and so $a=b$ (because $f \circ g$ is an isomorphism). Therefore, $f$ is an epimorphism. Similarly, $g$ is an epimorphism.

We can also argue that $f$ and $g$ are monomorphisms. Again let $A$ be an object, and consider two maps $c,d: A \to X$. Then, if $f \circ c = f \circ d$, we have $g \circ f \circ c= g \circ f \circ d$, and so $c=d$ (because $g \circ f$ is an isomorphism). Therefore, $f$ is a monomorphism. Similarly, $g$ is a monomorphism.

However, sometimes it can be the case that a morphism is both an epimorphism and a monomorphism but not an isomorphism. Are $f$ and $g$ forced to be isomorphisms here?


You have $(f \circ g)^{-1}$ and $(g \circ f)^{-1}$, so one is tempted to try to construct inverses for $f$ and $g$ explicitly as e.g. $f^{-1} := g \circ (f \circ g)^{-1}.$ And indeed, $f \circ f^{-1} = f \circ g \circ (f \circ g)^{-1} = 1,$ whereas $f^{-1} \circ f = g \circ (f \circ g)^{-1} \circ f.$ To show that the latter is $1$, you can show that it's precomposition with $g,$ which you showed epimorphic, is $1 \circ g = g$. This is immediate.