# Commutative Algebra/Kernels, cokernels, products, coproducts
## Kernels

Definition 3.1:
Let ${\mathcal {C}}$ be a category with zero objects, and let $f:a\to b$ be a morphism between two objects $a,b$ of ${\mathcal {C}}$. A kernel of $f$ is an arrow $k:o_{k}\to a$, where $o_{k}$ is what we shall call the object associated to the kernel $k$, such that
* $f\circ k=0_{o_{k},b}$, and
* for each object $z$ of ${\mathcal {C}}$ and each morphism $g:z\to a$ such that $f\circ g=0_{z,b}$, there exists a unique $g':z\to o_{k}$ such that $g=k\circ g'$.
The second property is depicted in the following commutative diagram:
Note that here, we don't see kernels only as subsets, but rather as an object together with a morphism. This is because in the category of groups, for example, we can take the morphism just by inclusion. Let me explain.
Example 3.2:
In the category of groups, every morphism has a kernel.
Proof:
Let $G,H$ be groups and $\varphi :G\to H$ a morphism (that is, a group homomorphism). We set
    $o_{k}:=\{g\in G:\varphi (g)=0\}$
and
    $k:o_{k}\to G,k(g)=g$,
the inclusion. This is indeed a kernel in the category of groups. For, if $\theta :K\to G$ is a group homomorphism such that $\varphi \circ \theta =0$, then $\theta$ maps wholly to $o_{k}$, and we may simply write $\theta =k\circ \theta$. This is also clearly a unique factorisation.$\Box$
For kernels the following theorem holds:
Theorem 3.3:
Let ${\mathcal {C}}$ be a category with zero objects, let $f:a\to b$ be a morphism and let $k:o_{k}\to a$ be a kernel of $f$. Then $k$ is a monic (that is, a monomorphism).
Proof:
Let $k\circ s=k\circ t$. The situation is depicted in the following picture:
Here, the three lower arrows depict the general property of the kernel. Now the morphisms $k\circ s$ and $k\circ t$ are both factorisations of the morphism $k\circ s$ over $k$. By uniqueness in factorisations, $s=t$.$\Box$
Kernels are essentially unique:
Theorem 3.4:
Let ${\mathcal {C}}$ be a category with zero objects, let $f:a\to b$ be a morphism and let $k:o_{k}\to a$, ${\tilde {k}}:o_{\tilde {k}}\to a$ be two kernels of $f$. Then
    $o_{k}\cong o_{\tilde {k}}$;
that is to say, $k$ and ${\tilde {k}}$ are isomorphic.
Proof:
From the first property of kernels, we obtain $f\circ k=0$ and $f\circ {\tilde {k}}=0$. Hence, the second property of kernels imply the commutative diagrams
    and .
We claim that $k'$ and ${\tilde {k}}'$ are inverse to each other.
    ${\tilde {k}}k'{\tilde {k}}'=k{\tilde {k}}'={\tilde {k}}={\tilde {k}}1_{o_{\tilde {k}}}$ and $k{\tilde {k}}'k'={\tilde {k}}k'=k=k1_{o_{k}}$.
Since both $k$ and ${\tilde {k}}$ are monic by theorem 3.3, we may cancel them to obtain
    $k'{\tilde {k}}'=1_{o_{\tilde {k}}}$ and ${\tilde {k}}'k'=1_{o_{k}}$,
that is, we have inverse arrows and thus, by definition, isomorphisms.$\Box$

## Cokernels

An analogous notion is that of a cokernel. This notion is actually common in mathematics, but not so much at the undergraduate level.
Definition 3.5:
Let ${\mathcal {C}}$ be a category with zero objects, and let $f:a\to b$ be a morphism between two objects $a,b$ of ${\mathcal {C}}$. A cokernel of $f$ is an arrow $u:b\to o_{u}$, where $o_{u}$ is an object of ${\mathcal {C}}$ which we may call the object associated to the cokernel $u$, such that
* $u\circ f=0_{a,o_{u}}$, and
* for each object $c$ of ${\mathcal {C}}$ and each morphism $h:b\to c$ such that $h\circ f=0_{a,c}$, there exists a unique factorisation $h=h'\circ u$ for a suitable morphism $h'$.
The second property is depicted in the following picture:
Again, this notion is just a generalisation of facts observed in "everyday" categories. Our first example of cokernels shall be the existence of cokernels in Abelian groups. Now actually, cokernels exist even in the category of groups, but the construction is a bit tricky since in general, the image need not be a normal subgroup, which is why we may not be able to form the factor group by the image. In Abelian groups though, all subgroups are normal, and hence this is possible.
Example 3.6:
In the category of Abelian groups, every morphism has a cokernel.
Proof:
Let $G,H$ be any two Abelian groups, and let $\varphi :G\to H$ be a group homomorphism. We set
    $o_{u}:=H/\operatorname {im} \varphi$;
we may form this quotient group because within an Abelian group, all subgroups are normal. Further, we set
    $u:H\to H/\operatorname {im} \varphi ,u(h)=h+\operatorname {im} \varphi$,
the projection (we adhere to the custom of writing Abelian groups in an additive fashion). Let now $\eta :H\to I$ be a group homomorphism such that $\eta \circ \varphi =0$, where $I$ is another Abelian group. Then the function
    $\eta ':H/\operatorname {im} \varphi \to I,\eta '(h+\operatorname {im} \varphi ):=\eta (h)$
is well-defined (because of the rules for group morphisms) and the desired unique factorisation of $h$ is given by $h=\eta '\circ u$.$\Box$
Theorem 3.7:
Every cokernel is an epi.
Proof:
Let $f$ be a morphism and $u$ a corresponding cokernel. Assume that $t\circ u=s\circ u$. The situation is depicted in the following picture:
Now again, $t\circ u\circ f=0$, and $t\circ u$ and $s\circ u$ are by their equality both factorisations of $t\circ u$. Hence, by the uniqueness of such factorisations required in the definition of cokernels, $s=t$.$\Box$
Theorem 3.8:
If a morphism $f$ has two cokernels $u$ and ${\tilde {u}}$ (let's call the associated objects $o_{u}$ and $o_{\tilde {u}}$), then $u\cong {\tilde {u}}$; that is, $u$ and ${\tilde {u}}$ are isomorphic.
Proof:
Once again, we have $u\circ f=0$ and ${\tilde {u}}\circ f=0$, and hence we obtain commutative diagrams
    and .
We once again claim that $u'$ and ${\tilde {u}}'$ are inverse to each other. Indeed, we obtain the equations
    $u'{\tilde {u}}'u=u'{\tilde {u}}=u=1_{o_{u}}u$ and ${\tilde {u}}'u'{\tilde {u}}={\tilde {u}}'u={\tilde {u}}=1_{o_{u'}}{\tilde {u}}$
and by cancellation (both $u$ and ${\tilde {u}}$ are epis due to theorem 8.7) we obtain
    $u'{\tilde {u}}'=1_{o_{u}}$ and ${\tilde {u}}'u'=1_{o_{u'}}$
and hence the theorem.$\Box$

## Interplay between kernels and cokernels

Theorem 3.9:
Let ${\mathcal {C}}$ be a category with zero objects, and let $k$ be a morphism of ${\mathcal {C}}$ such that $k$ is the kernel of some arbitrary morphism $f$ of ${\mathcal {C}}$. Then $k$ is also the kernel of any cokernel of itself.
Proof:
$k=\ker f$ means
We set $q:=\operatorname {coker} k$, that is,
In particular, since $fk=0$, there exists a unique $f'$ such that $f=f'q$. We now want that $k$ is a kernel of $p$, that is,
Hence assume $ql=0$. Then $fl=f'ql=0$. Hence, by the topmost diagram (in this proof), $l=kl'$ for a unique $l'$, which is exactly what we want. Further, $qk=0$ follows from the second diagram of this proof. $\Box$
Theorem 3.10:
Let ${\mathcal {C}}$ be a category with zero objects, and let $q$ be a morphism of ${\mathcal {C}}$ such that $q$ is the kernel of some arbitrary morphism $r$ of ${\mathcal {C}}$. Then $q$ is also the cokernel of any kernel of itself.
Proof:
The statement that $q$ is the cokernel of $r$ reads
We set $k:=\ker q$, that is
In particular, since $qr=0$, $r=kr'$ for a suitable unique morphism $r'$. We now want $q$ to be a cokernel of $k$, that is,
Let thus $mk=0$. Then also $mr=mkr'=0$ and hence $m$ has a unique factorisation $m=m'q$ by the topmost diagram.$\Box$
Corollary 3.11:
Let ${\mathcal {C}}$ be a category that has a zero object and where all morphisms have kernels and cokernels, and let $f$ be an arbitrary morphism of ${\mathcal {C}}$. Then
    $\ker f=\ker(\operatorname {coker} (\ker f))$
and
    $\operatorname {coker} f=\operatorname {coker} (\ker(\operatorname {coker} f))$.
The equation
    $\ker f=\ker(\operatorname {coker} (\ker f))$
is to be read "the kernel of $f$ is a kernel of any cokernel of itself", and the same for the other equation with kernels replaced by cokernels and vice versa.
Proof:
$k:=\ker f$ is a morphism which is some kernel. Hence, by theorem 3.9
    $k=\ker(\operatorname {coker} (k))$
(where the equation is to be read "$k$ is a kernel of any cokernel of $k$"). Similarly, from theorem 3.10
    $q=\operatorname {coker} (\ker(q))$,
where $q:=\operatorname {coker} f$.$\Box$

## Products

Definition 3.12:
Let ${\mathcal {C}}$ be a category, and let $a,b$ be two objects of ${\mathcal {C}}$. A product of $a$ and $b$, denoted $a\times b$, is an object of ${\mathcal {C}}$ together with two morphisms
    $\pi _{a}:a\times b\to a$ and $\pi _{b}:a\times b\to b$,
called the projections of $a\times b$, such that for any morphisms $f:c\to a$ and $g:d\to b$ there exists a unique morphism $$ such that the following diagram commutes:
Example 3.13:
Theorem 3.14:
If ${\mathcal {C}}$ is a category, $a,b$ are objects of ${\mathcal {C}}$ and $p,q$ are products of $a$ and $b$, then
    $p\cong q$,
that is, $p$ and $q$ are isomorphic.
Theorem 3.15:
Let ${\mathcal {C}}$ be a category, $a,b$ objects of ${\mathcal {C}}$ and $a\times b$ a product of $a$ and $b$. Then the projection morphisms $$ and $$ are monics.

## Coproducts

Definition 3.16:
Let ${\mathcal {C}}$ be a category, and let $a$ and $b$ be objects of ${\mathcal {C}}$. Then a coproduct of $a$ and $b$ is another object of ${\mathcal {C}}$, denoted $a\coprod b$, together with two morphisms $$ and $$ such that for any morphisms $$ and $$, there exist morphisms such that $$ and $$.
Example 3.17:
Theorem 3.18:
Theorem 3.19:

## Biproducts

Definition 3.20:
Let ${\mathcal {C}}$ be a category that contains two objects $a$ and $b$. Assume we are given an object $c$ of ${\mathcal {C}}$ together with four morphisms that make it into a product, and simultaneously into a coproduct. Then we call $c$ a biproduct of the two objects $a$ and $b$ and denote it by
    $c=a\oplus b$.
Example 3.21:
Within the category of Abelian groups, a biproduct is given by the product group; if $G,H$ are Abelian groups, set the product group of $G$ and $H$ to be
    $G\times H$,
the cartesian product, with component-wise group operation.
Proof: