## Kernels and cokernels

A null object in category $C$ is an object that is both initial and final. If $C$ has a null object, then to any $a, b \in C$, there exist unique arrows $a \rightarrow z$, and $z \rightarrow b$. A null object is unique upto isomorphism.

Let $C$ have a null object. The kernel of arrow $f : a \rightarrow b$ is defined to be an equalizer of arrows $f, 0 : a \rightrightarrows b$. Put more directly, $k : s \rightarrow a$ is the kernel of $f : a \rightarrow b$ when $fk = 0$, and every arrow $h$ such that $fh = 0$ factors uniquely through $k$:

$$ \begin{xy} \xymatrix{ s\ar[dr]_k\ar[drr]^0 & & \\ & a\ar[r]^<<{f} & b \\ c\ar[ur]^h\ar[urr]_0\ar@{.>}[uu]|{\exists!} & & } \end{xy} $$

Thus, any category with equalizers, or more generally finite limits, and with zero has kernels for all arrows, and the arrow $k : s \rightarrow a$ is unique upto isomorphism of $s$. Like all equalizers, the kernel is necessarily a [monic](/category/1#monics-epis-and-zeros). It is convenient, therefore, to think of the kernel as a subobject of $a$, or the equivalence class of monics $s \rightarrow a$.

For example, in $\textbf{Grp}$ with just one element (the identity element $I$) is a null object, and for any two groups with zero morphism, $G \rightarrow H$ is the unique morphism which sends all of $G$ to the identity in $H$. The kernel of an arbirary morphism $f : G \rightarrow H$ is the insertion $N \rightarrow G$ of the usual kernel $N =$ all $x$ in $G$ with $fx = 1$. Note that $N$ is the normal subgroup, and that in $\textbf{Grp}$, all kernels are monic, but there are monics which are not kernels.

In the category $\textbf{Set}_*$ of pointed sets, the one-point set is a null object, and zero map $P \rightarrow Q$ is the function taking all of $P$ to the base $*_Q$ in $Q$. For any morphism $f : P \rightarrow Q$ of pointed sets, its kernel $S \rightarrow P$ is the insertion of the subset $S$ of those $S \in P$ with $fx = *_Q$, where base point of $S$ is identical with base point $P$. The same discussion gives kernels in $\textbf{Top}_*$. In $\textbf{Grp}$, an epimorphism is determined by its kernel, but this is not the case for $\textbf{Set}_*$ or $\textbf{Top}_*$.

In an $\text{Ab}$-category $A$, all equalizers are kernels. Indeed, in such a category, each hom-set $A(b, c)$ is an abelian group. Given parallel arrows $f, g : b \rightarrow c$ and arrow $h : a \rightarrow b$, such that $fh = gh$ iff $(f - g)h = 0$. Therefore, the universal $h$ can either be described as the equalizer of $f, g$, or kernel of $f - g$. The dual notion gives rise to cokernel, as [already discussed](/category/2#coproducts-and-colimits).