Suppose that $f$ is a monomorphism.
It follows for the canonical morphism $k \colon \ker(f) \to X$ from the equalities $f ∘ k = 0 = f ∘ 0$ that $k = 0$.
But $k$ is itself a monomorphism (by the universal property of the kernel), whence it further follows from $\newcommand{\id}{\mathrm{id}} k ∘ \id_{\ker(f)} = 0 ∘ \id_{\ker(f)} = 0 = k ∘ 0$ that $\mathrm{id}_{\ker(f)} = 0$.
This shows that $\ker(f) = 0$.
Suppose conversely that $\ker(f) = 0$.
If $g, h \colon K \to X$ are two morphisms with $f ∘ g = f ∘ h$, then $f ∘ (g - h) = 0$ and it follows that $g - h$ factors through $\ker(f)$. Since $\ker(f) = 0$, this means that $g - h = 0$ and thus $g = h$.
This shows that $f$ is a monomorphisms.
This shows the first statement.
We note that by duality, we have also proven the following statement:
- The morphism $f$ is an epimorphism if and only if $\newcommand{\coker}{\operatorname{coker}} \coker(f) = 0$.
The image of $f$ is defined as the kernel of its cokernel.
More explicitly, $\newcommand{\im}{\operatorname{im}} i \colon \im(f) \to Y$ is the kernel of $c \colon Y \to \coker(f)$.
Let us recall two observations about kernels and equalizers:
For every morphism $g \colon A \to B$ in a category with zero morphisms, the kernel $\ker(g) \to A$ is precisely the equalizer of $g$ and the zero morphism.
Given any two morphisms $g, h \colon A \to B$ in an arbitrary category, we have $g = h$ if and only if the equalizer $\mathrm{eq}(g, h)$ exists and $\mathrm{eq}(g, h) \to A$ is an isomorphism.
We now find that $f$ is an epimorphism if and only if $\coker(f) = 0$ (by statement 3), if and only if $c \colon Y \to \coker(f)$ is the zero morphism (because $c$ is an epimorphism, dually to the argumentation for $\ker(f)$ in the first paragraph), if and only if $\ker(c) \to Y$ is an isomorphism (by the above two observations), if and only if $i \colon \im(f) \to Y$ is an isomorphism (by definition of the image).
This shows the second statement.