# Is there a counter example for monmorphism

Monomorhism as defined is: A morphism $f: A \to B$ is a monomorphism if for every object $C$ and every pair of morphisms $g,h: C \to A$ the condition $f\circ g = f\circ h$ implies $g = h$.

Applying this to sets, I could not think of counter example where $f\circ g = f\circ h$, but $g\neq h$. What are some examples of this case?

Let $A=\{1,2\}$, $B=C=\{1\}$, $g(1)=1$, $h(1)=2$, and $f(1)=f(2)=1$. Then $f\circ g=f\circ h$ but $g\neq h$. More generally, if $f$ is a constant function, then $f\circ g=f\circ h$ will always be true, no matter what functions $g,h:C\to A$ you have.
Even more generally, if $f$ is any non-injective function, you can find $g$ and $h$ which give a counterexample. I'll leave that as a challenge for you to prove; the idea is similar to the example above, where $f$ failed to be injective because $f(1)=f(2)$.
In $\mathsf{Set}$ we have that a morphism $f$ is a monomorphism if and only if $f$ is injective. So take any map which is not injective to construct appropriate maps $g$ and $k$. For example the mapping $f : x\mapsto x^2$ on the reals and $g = 1$ and $h= -1$.