## A Brief Introduction to Categories, Part 7: General Limits and Colimits

This post is part of a series on category theory, see Overview of Blog Posts for all posts. All categories are assumed to be locally small, unless stated otherwise.

## Introduction

Previously, we have studied particular examples of limits and colimits. This time, we will go into the general theory. Using the close relation between limits and representable functors and the previous results on universal elements and representability, we are able to provide different perspectives on limits.

## Limits as Universal Cones

Definition C7.1 Let $I$ be a small category, let $\mathcal C$ be any category, then the diagonal functor $\Delta:\mathcal C \to [I,\mathcal C]$ is defined as follows:

• For any object $x \in \mathcal C$, $\Delta(x):I \to \mathcal C$ is the constant functor with values in $x$, i.e. the functor which sends every object of $I$ to $x$ and every morphism in $I$ to $\mathrm{id}_x$
• For any morphism $f: x \to y$ in $\mathcal C$, we define $\Delta(f):\Delta(x) \Rightarrow \Delta(y)$ to be the natural transformation that has for any object $i \in I$, the component $\Delta(f)_i=f:\Delta(x)(i)=x \to \Delta(y)(i)=y$

Definition C7.2 Let $I$ be a small category, let $\mathcal C$ be any category and let $F:I \to \mathcal C$ be a functor. Then a cone over $F$ consists of an object $x \in \mathcal C$ -called apex- and a natural transformation $\eta: \Delta(x) \Rightarrow F$. The naturality condition can be stated by saying that the following diagram commutes for any morphism $f:i \to j$ in $I$:

Given two cones $\eta:\Delta(x) \Rightarrow F$ and $\varepsilon:\Delta(y) \Rightarrow F$, a morphism of cones is a morphism $f:x \to y$ such that $\varepsilon \circ \Delta(f) = \eta$. Morphisms of cones can be composed and so we obtain a category of cones over $F$, denoted by $\mathrm{Cone}(F)$.

Definition C7.3 A limit $\displaystyle \varprojlim_{i \in I}F(i)$ is a terminal object in the category of cones $\mathrm{Cone}(F)$.

If the limit $\varprojlim_{i \in I}F(i)$ is given by a cone consisting of an object $x \in \mathcal C$ and a natural transformation $\eta:\Delta(x) \Rightarrow F$, then we call $x$ the limit object (or just limit, by abuse of language) and the components of $\eta$ the structure morphisms.

Remark Being a terminal object, a limit is unique up to unique isomorphism of cones.

Example C7.4 Let $I$ be a discrete category, then a functor $I \to \mathcal C$ is nothing but a family of objects $(X_i)_{i \in I}$. In this case, a limit is just a product of the objects $(X_i)_{i \in I}$. As a special case, a limit over the empty functor $\varnothing \to \mathcal C$ is a terminal object.

Example C7.5 Let $I$ be a set and consider the following category $J$, having two objects $a,b$ and for every $i \in I$, a morphism $i:a \to b$ (and of course the identities for $a$ and $b$). There’s a unique way to define composition to turn this into a category. Then having a functor $F:J \to \mathcal C$ is equivalent to having a family of morphisms $(f_i)_{i \in I}:X \to Y$ in $\mathcal C$ with common source and target. In this case, a limit over $F$ is equivalently an equalizer for the family of morphisms $f_i$.

Example C7.6 Let $I$ be the category with three objects $a,b,c$ and as morphisms (aside from the identities) a unique morphism $a \to c$ and a unique morphism $b \to c$. Then a functor $I \to \mathcal C$ is equivalently a triple of objects $X,Y,Z$ and two morphisms $f:X \to Z$ and $g:Y \to Z$. As one might guess, a limit over such a functor is equivalently a pullback $X \times_Z Y$.

Example C7.7 Consider $(\mathbb N, \leq)$ with the usual ordering as a category $I$ (this is in particular a preorder). Suppose that we have a descending sequence of sets $U_1 \supset U_2 \supset \dots$. Then we can define a contravariant functor $F:I^{op} \to \mathbf{Set}$ given by $F(i)=U_i$ on objects and for two natural numbers $n,m$ with $n \leq m$, i.e. a morphism $f:m \to n$ in $I^{op}$ we let $F(f)$ to be subset inclusion $U_m \hookrightarrow U_n$. Then the limit of the functor $F$ is the intersection $\bigcap_{i=1}^n U_i$, with structure morphisms being the inclusions $\bigcap_{i=1}^n U_i \hookrightarrow U_j$. Indeed, for a collection of maps from an object $X$,$(f_i)_{i \in I}:X \to U_i$ such that for $i \leq j$, we have that $f_i$ and $f_j$ agree, we see that all the $f_i$ are equal. Hence the image is contained in $\bigcap_{i=1}^n U_i$ and there’s a unique map $f:X \to \bigcap_{i=1}^n U_i$ that makes the necessary triangles commute. Thus we have found a terminal object in the category of cones over $F$.

Definition C7.8 Given a functor $F: I \to \mathcal C$ from a small category $I$ to a category $\mathcal C$, then $F$ can also be considered as a functor $F^{op}:I^{op} \to \mathcal C^{op}$, then a cocone over $F$ is defined as a cone over $F^{op}$. A colimit is defined as an initial object in the category of cocones. Explicitly, a cocone is an object $x \in \mathcal C$ with a natural transformation $\eta:F\Rightarrow \Delta(x)$. The colimit is denoted by $\varinjlim F$.

Remark A limit in $\mathcal C^{op}$ is a colimit in $\mathcal C$ and vice versa.

## Limits as Adjoints to the Diagonal Functor

Let $I$ be a small category, let $\mathcal C$ be any category, then consider the following functor $\mathcal C^{op} \to \mathbf{Set}, x \mapsto \mathrm{Hom}_{[I,\mathcal C]}(\Delta(x),F)$, denoted by $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F)$.
Suppose that this functor is representable, then take a representation $\eta:\mathrm{Hom}_{\mathcal C}(-,L) \cong \mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F)$. Then $L$ is a limit object of $F$ and $\eta_L(\mathrm{id}_L):\Delta(L) \Rightarrow F$ are the structure morphisms, i.e. $(L,\eta_L)$ is a terminal object in the category of cones. This is just a special case of general theorems we have proved on representable functors in virtue of the following observation:

Remark The category of cones $\mathrm{Cone}(F)$ is the opposite category of the category of elements for the functor $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F):\mathcal C^{op} \to \mathbf{Set}$, i.e. $\mathrm{Cone}(F)=\int(\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F))^{op}$

Proof An object in $\int(\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F))^{op}$ is an object $x \in \mathcal C$ together with an element $\eta \in \mathrm{Hom}_{[I,\mathcal C]}(\Delta(x),F)$, i.e. a cone. A morphism $(x,\eta) \to (y,\varepsilon)$ consists of a morphism $(y,\varepsilon) \to (x,\eta)$ in the category of elements $\int(\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F))$, i.e. a morphism $y \to x$ in $\mathcal{C}^{op}$, i.e. a morphism $f:x \to y$ in $\mathcal{C}$ such that $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(f),F))(\varepsilon)=\eta$, which means that $\Delta(f) \circ \varepsilon = \eta$. This is precisely the notion of a morphism of cones.

Now we can apply lemma C5.15 and lemma C5.3, that is, the fact that initial objects in the category of elements for a functor and representations of that functor both correspond to universal elements to conclude the following:

Lemma C7.10 $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F)$ is representable if and only if the limit of $F$ in $\mathcal C$ exists and representations of that functor correspond to limit objects together with structure morphisms satisfying the universal property with respect to $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F)$.

## General Limits from Products and Equalizers

General limits can be quite complicated. But apart from some specific examples, we don’t know yet what limits look like in familiar categories such as $\mathbf{Set}$ or if they even exist. We have already seen how pullbacks can be constructed from products and equalizers. (Cf. lemma C6.23) The following construction describes a vast generalization:

Theorem C7.11 Let $F:I \to \mathcal{C}$ be a functor from a small category $I$ to a category $\mathcal C$ that has all products and binary equalizers. Then $\varprojlim F$ exists and can be constructed as follows: Take the product $P:=\prod_{i \in I} F(i)$ with structure maps $\pi_i:P \to F(i)$. Now for every morphism $f:i \to j$ in $I$, we have a morphism $F(f) \circ \pi_i:P \to F(j)$, so that by the universal property of the product, there is a unique morphism $\alpha:P \to P$ such that $\pi_j \circ \alpha= F(f) \circ p_i$ for all morphisms $f:i \to j$ in $I$. Then the equalizer $L:=\mathrm{Eq}(\mathrm{id}_{P},\alpha)$ is the limit together with structure morphisms $f_i:L \to F(i)$ given by $f_i:=\pi_i \circ \iota$, where $\iota:L \to P$ is the structure morphism of the equalizer.

Proof We first check that the collection of $f_i$ makes $L$ into a cone. Let $f:i \to j$ be a morphism in $I$. Then we have
$F(f) \circ f_i = F(f) \pi_i \circ \iota = \pi_j \circ \alpha \circ \iota = \pi_j \circ \mathrm{id}_P \circ \iota = f_j$, showing that the $f_i$ form the components of a natural transformation $\Delta(L) \Rightarrow F$, that is we have a cone over $F$. Let $(x,\eta)$ be a cone over $F$, then for all $i \in I$, we have a morphism $\eta_i:x \to F(i)$. So by the universal property of the product, we get a unique morphism $h:x \to P$ such that $\pi_i \circ h = \eta_i$ for all $i$. Consider the morphism $\alpha \circ h:x \to P$. We have for any morphism $f:i \to j$ in $I$
$\pi_j \circ \alpha \circ h =F(f) \circ \pi_i \circ h =F(f) \circ \eta_i = \eta_j$
(where we used naturality of $\eta$). So that by uniqueness of $h$, we get that $h = \alpha \circ h$. Thus by the universal property of the equalizer $L=Eq(h,\mathrm{id}_P)$, we get that a unique morphism $h':x \to L$ such that $\iota \circ h'= h$.
To see that $h'$ is a morphism of cones, note that $f_i \circ h'=\pi_i \circ \iota \circ h' = \pi_i \circ h=\eta_i$. To see that $h'$ is unique, let $w':x \to L$ be another morphism of cones, then $w:=\iota \circ w'$ satisfies
$\alpha \circ w = \alpha \circ \iota \circ w' = \iota \circ w' = w$
Furthermore, we have $\pi_i \circ w = \pi_i \circ \iota \circ w'= f_i \circ w'=\eta_i$, so that by uniqueness of $h$, we get $w=h$, i.e. $\iota \circ w' = \iota \circ h'$. By the uniqueness part of the universal property of the equalizer, we get that $w'=h'$.

This theorem not only gives us a criterion for the existence of all limits in a category from just some specific ones, but it also tells us what they look like, given that we understand products and equalizers:

Example C7.12 Consider the category of sets $\mathbf{Set}$, then limits can be constructed as follows: $F:I \to \mathbf{Set}$ be a functor from a small category $I$, then the limit of $F$ is given by $\varprojlim F = \{(x_i)_{i \in I} \in \prod_{i \in I}F(i) \mid \forall (f:i \to j) \in I, F(f)(x_i)=x_j\}$

Exercise C7.13 Using previously estabished contructions of coproducts and coequalizers in $\mathbf{Set}$, describe general colimits in $\mathbf{Set}$.

## Limits as Representations of the Limit Functor

We have already seen that for a functor $F: I \to \mathcal C$ from a small category $I$ to any category $\mathcal C$, the existence of a limit is equivalent to the representability of the functor $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(-),F)$. In this section we shall derive another description of this functor that relates limits in arbitrary categories to limits in $\mathbf{Set}$.

Definition C7.14 Let $I$ be a small category, $\mathcal C$ be any category and $F:I \to \mathcal C$ be a functor. Then the functor $\displaystyle \varprojlim_{i \in I}\mathrm{Hom}_{\mathcal C}(-,F(i)): \mathcal C^{op} \to \mathbf{Set}$ is defined as follows: for an object $x \in \mathcal C$, we can consider the functor $I \to \mathbf{Set}$, $i \mapsto \mathrm{Hom}_{\mathcal C}(x,F(i))$ (i.e. we compose $F$ with the covariant Hom-functor corresponding to $x$). Since limits in $\mathbf{Set}$ exist, we can take the limit $\displaystyle \varprojlim_{i \in I} \mathrm{Hom}_{\mathcal C}(x,F(i))$. This is the value of the functor $\displaystyle \varprojlim_{i \in I}\mathrm{Hom}_{\mathcal C}(-,F(i))$ at $x$(Exercise: Check that this is indeed a functor, i.e. that it acts in a compatible way on morphisms)

Remark This is actually the limit in the functor category. One can check that limits in functor categories may be computed “pointwise”.

Lemma C7.15 There’s a natural isomorphism of functors $\mathrm{Hom}_{[I, \mathcal C]}(\Delta(-),F) \cong \varprojlim_{i \in I}\mathrm{Hom}_{\mathcal C}(-,F(i))$: Both functors send an object $x$ to the set of cones with $x$ as an apex.

Proof By definition, an element of $\mathrm{Hom}_{[I,\mathcal C]}(\Delta(x),F)$ is a cone with $x$ is an apex. For $\varprojlim_{i \in I}\mathrm{Hom}_{\mathcal C}(-,F(i))$, we can use the description of example C7.12: $\varprojlim_{i \in I} \mathrm{Hom}_{\mathcal C}(x,F(i))$  $= \{(f_i)_{i \in I} \in \prod_{i \in I}\mathrm{Hom}(x,F(i)) \mid \forall (g:i \to j \in I): F(g) \circ f_i = f_j\}$
Clearly this set consists of all natural transforations $\Delta(x) \Rightarrow F$. Naturality is easily checked: Indeed, using the now established identifications on objects with the functor sending an object $x$ to the set of cones with $x$ as an apex, both functors send a morphism $f:x \to y$ to the map from the set of cones over $F$ with $y$ as an apex to the set of cones over $F$ with $y$ as an apex that takes a cone $\eta:\Delta(y) \Rightarrow F$ to the cone with $x$ as an apex with the natural transformation whose components are $\eta_i \circ f:x=\Delta(x)(i) \to F(i)$ for each $i \in I$.

Corollary C7.16 A limit of a functor $F:I \to \mathcal C$ from a small category to $\mathcal C$ exists if and only if the limit functor $\varprojlim_{i \in I}\mathrm{Hom}_{\mathcal C}(-,F(i))$ is representable.

Corollary C7.17 Covariant Hom-functors are “continuous” in the following sense: if a limit over a functor $F:I \to \mathcal C$ exists, where $I$ is a small category and $\mathcal C$ is any category, then $\mathrm{Hom}_{\mathcal C}(x,\varprojlim_{i \in I} F(i)) \cong \varprojlim_{i \in I} \mathrm{Hom}_{\mathcal C}(x,F(i))$

Corollary C7.18 Dualizing the previous corollary, contravariant Hom-functor send colimits to limits.