# A Brief Introduction to Categories, Part 6: Some Examples of Limits and Colimits

This post is part of a series on category theory. See Overview of Blog Posts for a list of all posts. All categories in this post are assumed to be locally small (the morphisms between two objects form a set), unless stated otherwise.

## Introduction

Last time, we studied universal properties and representable functors. A particular class of universal properties and representable functors is given by (co)limits. This class generalizes many known and frequently appearing constructions and is of great importance both for the study of categories themselves and for applications of category theory. Using the notion of limits, we will be able to state and prove a useful criterion for when a functor is representable in a future post. For motivation, we will start be studying particular examples of limits and colimits in familiar categories before giving the general definition in the future. As we shall see in future posts, all general limits and colimits can be constructed from these examples.

## Terminal and Initial Objects

We have already defined initial objects in definition C5.12, but for completeness’s sake, we shall repeat the definition here.

Definition C6.1 Let $\mathcal C$ be a category. Then an object $T$ is called terminal if for any object $x$, there is a unique morphism $x \to T$.

Definition C6.2 Let $\mathcal C$ be a category. Then an object $I$ is called initial if for any object $x$, there is a unique morphism $I \to x$.

Remark From the definitions, it is clear that an initial object is just a terminal object in the opposite category and vice versa.

Remark By lemma C5.13, intial objects (and hence terminal objects, see above) are unique up to unique isomorphisms.

Example C6.3 In the category of sets, the empty set $\varnothing$ is the unique initial object. Indeed, for any set $X$, there is a unique map $\varnothing \to X$, namely the empty map. Every one-point set $\{*\}$ is a terminal object, as for any set $X$, there is a unique map $X \to \{*\}$ that sends everything to $*$. Similarly, in the category $\mathbf{Top}$ of topological spaces, the empty space is an initial object and the one-point space is a terminal object. In the category of small categories $\mathbf{Cat}$, the empty category is an initial object and the category with one object and one morphism (the identity of the one object), i.e. a one-object discrete category, is the terminal object.

Example C6.4 In the category of groups, abelian groups, or modules over a ring $R$, the trivial group (or zero module module) is both an initial and a terminal object.

Example C6.5 In the category of rings, the zero ring $0$ is a terminal object and the ring of integers $\mathbb{Z}$ is an initial object. More generally, let $R$ be a commutative ring and consider the category of $R$-algebras. Then $R$ is an initial object and the zero ring $0$ is a terminal object. This generalizes the last example, as rings are equivalently $\mathbb{Z}$-algebras.

Example C6.6 Let $(A,\leq)$ be a preordered set, considered as a category (cf. example C1.5). Then an initial object is an element $a \in A$, such that $a \leq x$ for all $x \in A$, i.e. a least element. Dually, a terminal object is a greatest element.

Example C6.7 The category of fields does not have an initial object or a terminal object. The reason is that if two fields have different characteristic, there is no field homomorphism between them. If we fix the characteristic to be $0$ or a prime number $p$, then the category of fields of that characteristic has the prime field of that characteristic, i.e. $\mathbb{F}_p$ or $\mathbb{Q}$ as an initial object, but it still has no terminal object, as all field homomorphisms are injective and there are fields of arbitrarily large cardinality.

Remark In the terminology of universal properties and representable functors, an initial object in $\mathcal C$ represents the constant functor $\mathcal C \to \mathbf{Set}$ that sends every object to the terminal object in $\mathbf{Set}$, namely a one-point set. The identity of the initial object is a universal element for this constant functor. Dually, a terminal object represents the constant functor that sends everything to a one-point set, considered as a contravariant functor, i.e. a functor $\mathcal C^{op} \to \mathbf{Set}$. The identity of the terminal object is a universal element.

## Products and Coproducts

Definition C6.8 Let $I$ be a set and let $(X_i)_{i \in I}$ be a collection of objects in a category $\mathcal C$. Then a product is given by the following data:

• An object in $\mathcal C$, denoted by $\prod_{i \in I}X_i$
• A collection of morphisms, for any $j \in I$, a morphism $\pi_j: \prod_{i \in I}X_i \to X_j$, called structure morphisms or canonical projections.

With the following universal property:

• For any object $Y$ in $\mathcal C$ and a collection of morphisms $f_i:Y \to X_i$, there exists a unique morphism $f:Y \to \prod_{i \in I}X_i$ such that $\pi_i \circ f = f_i$ for all $i$.

The property can be visualized via a commutative diagram, here shown in the case of binary products:

Remark C6.9 Let $I=\varnothing$ be the empty set. Then a product $\prod_{\varnothing}$ is exactly a terminal object.

Example C6.10 Consider the category of sets $\mathbf{Set}$. For a family of sets $(X_i)_{i \in I}$, one can construct the Cartesian product $\prod_{i \in I}X_i$ and let $\pi_j:\prod_{i \in I}X_i \to X_j$ be the projection onto the $j$-th coordinate. This clearly satisfies the universal property for a product, as for any set $Y$ and maps $f_i:Y \to X_i$, the obvious definition $f:Y \to \prod_{i \in I}X_i, y \mapsto (f_i(y))_{i \in I}$ yields the unique map $Y \to \prod_{i \in I}X_i$ such that $\pi_i \circ f=f_i$ for all $i$. If we have the category of semigroups, of monoids,  of groups, of abelian groups, of rings, of $R$-modules or of $R$-algebras etc. with their respective homomorphisms as morphisms, then equipping the cartesian product with coordinate-wise operations yields the product in that category. (Note that as the operation in the product is defined coordinate-wise, the projections are homomorphisms of the respective type of algebraic structure.)
In the category of topological spaces $\mathbf{Top}$, one takes the Cartesian product and equips it with the product topology to obtain the categorical product.

Example C6.11 Let $(A,\leq)$ be a preordered set. Then the product of a family of objects, if if it exists, is the infimum. The universal property of the product turns into the universal property of the infimum: $\forall x \in X:(\forall i \in I: x \leq a_i \Leftrightarrow x \leq \inf_{i \in I}a_i)$. For example, if $A$ is an integral domain and we define $a \leq b$ if and only if $a$ divides $b$, then the product will be the greatest common divisor of a family of objects, if it exists.

Example C6.12 Consider the category of small categories $\mathbf{Cat}$. Then for a family of categories $(\mathcal C_i)_{i \in I}$, there’s the product category $\mathcal C=\prod_{i \in I} \mathcal C_i$ together with projection functors $\pi_i:\mathcal C \to \mathcal C_i$ for all $i$. The objects are given by $\mathrm{Obj}(\mathcal C)=\prod_{i \in I}\mathrm{Obj}(\mathcal C_i)$ and the morphisms are given by $\mathrm{Hom}_{\mathcal C}((A_i)_{i \in I},(B_i)_{i \in I})=\prod_{i \in I}\mathrm{Hom}_{\mathcal C_i}(A_i,B_i)$ with composition defined component-wise. We have already seen the special case for binary products in definition C3.7.

Remark Let $\mathcal C$ be a category and let $(X_i)_{i \in I}$ be a family of objects indexed by a set $I$. Then if the product $(X:=\prod_{i \in I}X_i,\pi_i)$, exists, we have a bijection for any object $Y$,$\mathrm{Hom}_{\mathcal C}(Y,X) \to \prod_{i \in I} \mathrm{Hom}_{\mathcal C}(Y,X_i)$, given by $f \mapsto \pi_i \circ f$, where the $\pi_i$ are the structure morphisms of the product. One checks that this is natural in $Y$. This means that the functor $\mathcal{C}^{op} \to \mathbf{Set}, Y \mapsto \prod_{i \in I} \mathrm{Hom}_{\mathcal C}(Y,X_i)$ is represented by $X$ and that the family of structure morphisms $(\pi_i)_{i \in I} \in \prod_{i \in I}\mathrm{Hom}_{\mathcal C}(X,X_i)$ is a universal element. Thus we have shown that the “universal property” of the product is indeed a universal property in the formal sense defined in the last entry.
Conversely, given a representation of the functor $\prod_{i \in I}\mathrm{Hom}_{\mathcal C}(-,X_i)$, the representing object is a product of the $X_i$ and the universal element is the family of structure morphisms.
Being representing object of a functor, a product is uniquely determined up to unique isomorphism in the following sense: If $X$ and $X'$ are products for the family $(X_i)_{i \in I}$ with structure morphisms $\pi_i:X \to X_i$ and $\pi_i':X' \o X_i$, then there exists a unique isomorphism $f:X \to X'$ such that $\pi_i' \circ f= \pi_i$ for all $i$.

As with any notion defined for a category, we can dualize the concept of a product.

Definition C6.13 Let $\mathcal C$ be a category, let $I$ be a set and let $(X_i)_{i \in I}$ be a family of objects in $\mathcal C$. Then a coproduct of $(X_i)_{i \in I}$ is a product of $(X_i)_{i \in I}$ in $\mathcal C^{op}$. The coproduct is denoted by $\coprod_{i \in I}X_i$, the structure morphisms $\iota_j:X_j \to \coprod_{i \in I}X_i$ are also called canonical inclusions.

Exercise Write out the universal property of coproducts as in definition C6.8.

Remark Dualizing a previous remark, a coproduct over an empty set is equivalently an inital object.

Example C6.14 Consider the category of sets $\mathbf{Set}$. The coproduct of a familiy of sets $(X_i)_{i \in I}$ is given by the disjoint union $\bigsqcup_{i \in I} X_i$ and the structure morphisms are given by the inclusions $\iota_j:X_j \to \bigsqcup_{i \in I} X_i$. The universal property of the coproduct says that having a map defined on a disjoint union $\bigsqcup_{i \in I}X_i \to Y$ is equivalent to having a map $X_i \to Y$ for each $i$. The correspondence is given by composing with inclusion, i.e. restricting to each component of the disjoint union.
In the category of topological spaces, we can also take the disjoint union with the finest topology that makes all inclusions continuous.
Similarly, in the category of small categories, one can take the disjoint union of objects and the disjoint union of morphisms to get coproducts. (E.g. any discrete category is a disjoint union of copies of the terminal category. The category of fields is a disjoint union of the categories of fields of a fixed characteristic $c$, where $c$ varies over all primes and $0$.)

Example C6.15 Let $R$ be a ring and consider the category of left $R$-modules $R\textrm{-}\mathrm{Mod}$. For a family of left $R$-modules $(M_i)_{i \in I}$, the direct sum $\bigoplus_{i \in I}M_i$ (i.e. the submodule of the product consisting of all tuples in which all but finitely many entries are $0$) is the coproduct with the structure morphisms $\iota_j:M_j \to \bigoplus_{i \in I}M_i$ given by the inclusion in the j-th coordinate. Note that for a finite family, product and coproduct agree, although the structure morphisms are different.

Example C6.16 Consider the categeory of groups $\mathbf{Grp}$. Here the coproduct is given by the so-called free product. For simplicity, let us define the free product in terms of presentations (as it satisfies a universal property, it is unique up to unique isomorphism and hence doesn’t depend on the presentation.) If $(G_i)_{i \in I}$ is a family of groups with presentations $G_i=\langle S_i \mid R_i\rangle$, then the free product has a presentation $\large{*}_{i \in I} G_i=\langle \bigsqcup_{i \in I} S_i \mid \bigsqcup_{i \in I} R_i\rangle$ and the structure morphisms are induced by the inclusion of generators $S_j \to \bigsqcup_{i \in I} S_i$. (cf. example C5.5 for the universal property of presentations.)

Example C6.17 Dualizing example C6.11, if we consider a preordered set $(A,\leq)$ as a category, then the coproduct of a family of objects is given by the supremum, if it exists. For the divisibility relation in an integral domain, this is the least common multiple.

Remark Just like with products, coproducts can be understood in terms of representable functors (they are just products in the opposite category, after all). Explicitly, for a family of objects $(X_i)$ in a category $\mathcal C$, we can form the product of Hom-functors $\prod_{i \in I}(X_i,-):\mathcal C \to \mathbf{Set}$. A representation of this functor is equivalently a coproduct, with the universal element being the family of structure morphisms. (cf. the corresponding remark for products.)

## Equalizers and Coequalizers

Definition C6.17 Let $\mathcal{C}$ be a category, let $X,Y$ be objects and let $(f_i)_{i \in I}:X \to Y$ be a family of morphisms. Then an equalizer $\mathrm{Eq}((f_i)_{i \in I})$ consists of the following data:

• An object $E=\mathrm{Eq}((f_i)_{i \in I})$ in $\mathcal{C}$
• A morphism $\iota:E \to X$, called structure morphism or -by abuse of terminology- also the equalizer of the $f_i$, which satisfies $\forall i,j \in I: f_i \circ \iota=f_j \circ \iota$.

Such that the following universal property holds:

• For any object $Z$ and every morphism $f:Z \to X$ such that $\forall i,j \in f_i \circ f=f_j \circ f$, there is a unique morphism $f':Z \to E$ such that $\iota \circ f'=f$

The universal property can be visualized via a commutative diagram, here shown in the case of binary equalizers:

Remark Equalizers are terminal objects in a suitable chosen category: in the situation of definition C6.17, define the following category $\mathcal D$:

• Objects are pairs $(A,f)$ where $A$ is an object in $\mathcal C$ and $f:A \to X$ is a morphism such that $\forall i,j \in I: f_i \circ f= f_j \circ f$.
• Morphisms $(A,f) \to (B,g)$ are morphisms $h:A \to B$ in $\mathcal C$ such that $g \circ h = f$
• Composition is inherited from $\mathcal C$

Then one may restate the definition of an equalizer by saying that an object $(E, \iota) \in \mathcal D$ is a terminal object if and only if $E$ is an equalizer with structure morphism $\iota$. This implies that an equalizer is unique up to unique isomorphism in the following sense: If $\iota:E \to X$ and $\iota':E' \to X$ are both equalizers of the same family of morphisms $X \to Y$, then there exists a unique isomorphism $f:E \to E'$ such that $\iota' \circ f=\iota$.

Example C6.18 Consider the category of sets $\mathbf{Set}$. Then an equalizer of a family of maps $f_i:X \to Y$ can be realized as the largest subset of $X$ on which they agree: If we let $E$ be the subset of $X$ consisting of all $x$ such that $\forall i,j: f_i(x)=f_j(x)$ and take $\iota:E \to X$ to be the subset inclusion, then any map $f:Z \to X$ such that $\forall i,j \in I: f_i \circ f = f_j \circ f$ has its image contained in $E$. Hence it factorizes uniquely through the subset inclusion $\iota$, showing that $\iota:E \to X$ satisfies the universal property. If all sets involved are semigroups, monoids, groups, rings or $R$-modules etc. and the maps are homomorphisms of the respective type, then $E$ will be a subsemigroup, submonoid, subgroup, subring or submodule, respectively and by the same argument, $\iota:E \to X$ satisfies the universal property of the equalizer.
Suppose a group $G$ acts on a set $X$, then we can consider the action as a collection of maps $X \to X$. In this case, one checks that the set $E$ is given by the set of invariants $X^G=\{x \in X \mid \forall g \in G:gx=x\}$.

One can think the equalizer as measuring “how equal” a collection of morphisms are.

Definition C6.19 A coequalizer in a category $\mathcal{C}$ is an equalizer in the opposite category $\mathcal{C}^{op}$.

Exercise Write out the universal property for coequalizers.

Example C6.20 Consider the category of sets $\mathbf{Set}$, then a coequalizer of a family of morphisms $f_i:X \to Y$, $i \in I$ can be constructed as follows: Consider the equivalence relation $\sim$ on $Y$ generated by $f_i(x) \sim f_j(x)$ for all $x \in X$ and $i,j \in I$. (Given a relation on a set, the intersection of all equivalence relations containing it is again an equivalence relation, called the equivalence relation generated by it.) Then the quotient map $Y \to Y/\sim$ is a coequalizer. If a group $G$ acts on a set $X$, then if we consider the coequalizer of the family of maps by which $G$ acts, this is the quotient space $X/G$. If we use the quotient topology, the same construction works in the category of topological spaces.

Example C6.21 If we work in the category of $R$-modules and we have a family of $R$-linear maps $(f_i)_{i \in I}:M \to N$, then one can take the quotient of $N$ by the submodule generated by the set $f_i(m)-f_j(m)$ where $i,j$ vary over $I$ and $m$ varies over $M$. The quotient module with the quotient map is then a coequalizer in the category of $R$-modules.

If one thinks of an equalizer as a universal solution to the problem of making maps equal from the left (i.e. by precomposing with a map), then dually a coequalizer is a universal solution to the problem of making maps equal from the right (i.e. by postcomposing with a map).

## Pullbacks and Pushouts

Definition C6.22 Let $\mathcal C$ be a category, let $X,Y,Z$ be objects and let $f:X \to Z$ and $g:Y \to Z$ be morphisms. Then a pullback consists of the following data:

• An object $X \times_Z Y$
• Morphisms $\pi_1:X \times_Z Y \to X, \pi_2:X \times_Z Y \to Y$

Such that the following universal property holds:

• $f \circ \pi_1 = g \circ \pi_2$
• For every object $W$ and morphisms $f':W \to X$ and $g':W \to Y$ such that $f \circ f'= g \circ g'$, there exists a unique morphism $u:W \to X \times_Z Y$ such that $\pi_1 \circ u = f'$ and $\pi_2 \circ u = g'$

The universal property can be visualized by the following commutative diagram:

Exercise Generalize this definition to the case of a family of objects $(X_i)_{i \in I}$ and a family of morphisms $(f_i)_{i \in I}:X_i \to Z$.

One can think of pullbacks as a “mix” of products and equalizers. For products, we had multiple objects but no morphisms between them as a given datum, whereas for equalizers, we had multiple morphisms, but all with the same source and target. For pullbacks, we have different objects and morphisms from those objects to a common target. The following lemmata make the relation of pullbacks to equalizers and products precise.

Lemma C6.23 In the situation of definition C6.22, suppose that the product $X \times Y$ exists and suppose that for the structure morphisms of the product $\pi_1:X \times Y \to X$ and $\pi_2:X \times Y \to Y$, the equalizer $P=Eq(f \circ \pi_1,g \circ \pi_2)$ exists with structure morphism $\iota: P \to X \times Y$. Then this equalizer is a pullback with structure morphisms $\pi_1 \circ \iota: P \to X$ and $\pi_2 \circ \iota: P \to Y$.

Proof We verify the universal property. We have $f \circ \pi_1 \circ \iota=g \circ \pi_2 \circ \iota$ from the definition of an equalizer. Let $W$ be an object and let $f':W \to X$ and $g':W \to Y$ be morphisms such that $f \circ f'=g \circ g'$. Then by the universal property of the product, there is a unique morphism $f' \times g':W \to X \times Y$ such that $\pi_1 \circ (f' \times g')=f$ and $\pi_2 \circ (f' \times g') =g'$. Then we get that $(f \circ \pi_1) \circ (f' \times g') = f \circ f'=g \circ g' = (g \circ \pi_2) \circ (f' \times g')$, so that by the universal property of the equalizer, there is a unique map $u:W \to Eq(f \circ \pi_1,g \circ \pi_2)$ with the required property.

Lemma C6.24 Suppose that a category $\mathcal C$ has a terminal object $1$. Then, if for two objects $X,Y$, the pullback $X \times_1 Y$ (along the unique morphisms $X \to 1, Y \to 1$), exists, it is a product of $X$ and $Y$.

Lemma C6.25 Suppose that in a category $\mathcal C$, the product $Y \times Y$ for an object $Y$ exists. Let $f,g:X \to Y$ be two morphisms from another object $X$ and let $\Delta_Y:Y\to Y \times Y$ be the unique morphism such that $\pi_1 \circ \Delta_Y= \mathrm{id}_Y$ and $\pi_2 \circ \Delta_Y = \mathrm{id}_Y$. Furthermore, let $f \times g:X \to Y \times Y$ be the unique morphism such that $\pi_1 \circ (f \times g) = f$ and $\pi_2 \circ (f \times g)=g$. Then if the pullback $Y \times_{Y \times Y} X$ exists, it is an equalizer $Eq(f,g)$ with structure morphism defined via the projection $Y \times_{Y \times Y} X \to X$.

Exercise Prove the preceeding two lemmata. (This is a nice exercise in getting used to working with universal properties.)

Exercise If a pullback exists, it is unique up to unique isomorphism in a certain sense. Specify what that means and prove it. (There are a couple of different ways to see this, one can define a category such that a pullback is a terminal object (as we did for equalizers), one can define a functor such that a pullback is a representation of that functor (as we did for products), or one can work with the universal property directly.)

Example C6.26 Lemma C6.23 tells us what pullbacks look like, given that we know products and equalizers. For example, in the category of sets, a pullback of two maps $f:X \to Z$ and $g:Y \to Z$ can be realized as a subset of the product $X \times_Z Y := \{(x,y) \in X \times Y \mid f(x)=g(y)\}$. The same construction works for semigroups, monoids, groups, rings etc.

As you might expect, we can dualize this notion, giving rise to the notion of pushouts.

Definition C6.27 A pushout in a category $\mathcal C$ is a pullback in the opposite category $\mathcal{C}^{op}$

Example C6.28 Consider the category of commutative rings. Given commutative rings $A,R,B$ and ring homomorphisms $f:R \to A$, $g:R \to B$, we can consider both $A$ and $B$ as $R$-modules via $f$ and $g$, respectively, so we can consider the tensor product $A \otimes_R B$. Via the definition $(a \otimes b) \cdot (a' \otimes b')=(aa' \otimes bb')$ on elementary tensors, one obtains a multiplication (using the universal property of tensor products to see that it is well-defined) that turns $A \otimes_R B$ into a commutative ring. The structure morphisms are given by $A \to A \otimes_R B, a \mapsto a \otimes 1$ and $B \to A \otimes_R B, b \mapsto 1 \otimes b$. Using the dualized version of lemma C6.24, we see that the coproduct of two commutative rings $A$ and $B$ is given by $A \otimes_{\mathbb Z} B$.

This concludes this post on examples of limits and colimits, next time we will look into the general definition.