TITLE: Why are epimorphisms in the category of Monoids not necessarily surjections?
QUESTION [6 upvotes]: The book "basic category theory" states that in the category Mon, epimorphisms are not necessarily surjections, but doesn't explain why. Why is this the case?

REPLY [3 votes]: Actually, the situation in the other answers are all instances of a more general phenomenon: If $\mathbb M_A$ is the free monoid generated by a set $A$, and $\mathbb F_A$ is the free group generated by the same set, then the inclusion map $\mathbb M_A \hookrightarrow \mathbb F_A$ is epic! To see why, observe that the image of a monoid homomorphism $h : \mathbb F_A \to M$ is always a group. By the universal property of the free group construction, then, $h$ is determined by its values at the elements of $A$. Given any two homomorphisms $h, g : \mathbb F_A \to M$ that agree on $\mathbb M_A$, since they must also agree on $A$, $h = g$.