TITLE: Is every monomorphism an injection?
QUESTION [18 upvotes]: We say a morphism is a monomorphism if $fg=fh$ implies $g=h$.
So if $f$ is a monomorphism, is it necessarily an injection? i.e. $f(x)=f(y)$ implies $x=y$.
My approach is to consider a specific morphism $g_x$ who map every elements to $x$, thus $f(x)=f(y) \Rightarrow fg_x=fg_y \Rightarrow g_x=g_y \Rightarrow x=y$. But not every category allows this $g_x$. For exemple, the category of linear space.
Although in the category of linear space this question can be solved in another way, I want to know some general approach about the question.

REPLY [4 votes]: Recall that a morphism $f : A \to B$ is a monomorphism if it's left-cancellative. This is equivalent to saying that the map $$(f \circ -) : \operatorname{Hom}(-,A) \to \operatorname{Hom}(-,B)$$ is injective.
Of course, whether or not this map is injective has little to do with $f$'s concrete representation as a function of sets, and as D_S's answer shows, it's easy to engineer an example that demonstrates this.
You could say that what prevents this pathology from arising in $\mathbf{Set}$ is that every point of a set $X$ corresponds to a map from the terminal object $1$ pointing at that point.