Motivation behind the definition of monomorphism and epimorphism in category theory

If in a category $r\circ s={\rm id}$ then $r$ is by definition a retraction and $s$ is by definition a section. So somehow you are wondering: is monomorphism the same concept as section and is epimorphism the same concept as retraction? In category $\textbf{Set}$ where monomorphisms can be described as injective functions and epimorphisms as surjective functions it is indeed true that a function is surjective iff it is a retraction, but it is not true that a function is injective iff it is a section. The 'spoilers' are functions $f:\emptyset\rightarrow X'$ where $X'\neq\emptyset$. They are (vacuously) injective but no function $g:X'\rightarrow\emptyset$ exist. In general sections are special monomorphisms and retractions are special epimorphisms (see the comment of Najib on this answer). Often there are classes that are 'in between'. There is much more to say on this subject, but I am not really an expert and think that there are people on this site who can do much better. This is only showing you one obstacle.


Monomorphisms are defined the way they are because that is what works in many concrete categories of interest: $\mathbf{Set}$, $\mathbf{Grp}$, $\mathbf{Ring}$, etc. Even $\mathbf{Top}$ is an example if you expect monomorphisms to be injective continuous maps (as opposed to, say, topological embeddings). Moreover, with this definition, the Yoneda embedding sends monomorphisms to componentwise injective natural transformations, which is as much as what one can hope for.

By constrast, epimorphisms are defined the way they are because we want duality. It is true that epimorphisms in $\mathbf{Set}$ are surjections. It is also true in some concrete categories like $\mathbf{Ab}$ and $\mathbf{Top}$, but it is not true in other concrete categories: for instance, in the category of Hausdorff spaces and continuous maps, the epimorphisms are precisely the continuous maps with dense image.

I should also mention that a morphism is a split epimorphism if and only if the Yoneda embedding sends it to a componentwise surjective natural transformation. Indeed, the "only if" direction is clear, and if $f : A \to B$ is a morphism such that $$\mathrm{Hom}(T, f) : \mathrm{Hom}(T, A) \to \mathrm{Hom}(T, B)$$ is surjective for every $T$, then taking $T = B$, we find there is a morphism $s : B \to A$ such that $f \circ s = \mathrm{id}_B$, as claimed.


Addendum. There are categories in which morphisms that are simultaneously monomorphisms and epimorphisms are not necessarily isomorphisms. The easiest example is $\mathbf{Top}$: a continuous map that is both injective and surjective is not necessarily a homeomorphism.