I realized I haven’t, to my knowledge, talked about adjoint functors yet! Let’s do that now, and introduce compactly generated topological spaces in the process.
Adjoint functors
A pair of functors $F\colon \mathsf{C} \to \mathsf{D}$ and $G\colon \mathsf{D} \to \mathsf{C}$ are an adjoint pair, or more accurately, $F$ is left adjoint to $G$ and $G$ is right adjoint to $F$ , written $F \dashv G$ , if there is an isomorphism
$ \mathsf{D}(Fc,d) \cong \mathsf{C}(c,Gd)$natural in $c$ and $d$ .
For example, let $\mathsf{C}$ be the category of sets $\mathsf{Set}$ and $\mathsf{D}$ the category of groups $\mathsf{Grp}$ . Since every group is in particular a set, and every homomorphism in particular a function, we have a functor $U\colon \mathsf{Grp} \to \mathsf{Set}$ . On the other side we have a functor $F\colon \mathsf{Set} \to \mathsf{Grp}$ that sends a set $X$ to the free group on that set $F(X)$ . The claimed isomorphism
$ \mathsf{Grp}(FX,G) \cong \mathsf{Set}(X,UG)$says that homomorphisms from the free group on a set $X$ to a group $G$ are in one-to-one correspondence with set maps from $X$ to the set $G$ . This is the universal property of the free group! I can imagine it being a good idea to trace out what naturality is asserting here; you should try it.
Another example is $\iota \dashv (\cdot)^{\operatorname{ab}}$ , where $\iota\colon \mathsf{Ab} \to \mathsf{Grp}$ is the inclusion of the category of abelian groups into the category of groups and $(\cdot)^{\operatorname{ab}}\colon \mathsf{Grp} \to \mathsf{Ab}$ sends a group to its abelianization. Here the claimed isomorphism
$\mathsf{Ab}(G^{\operatorname{ab}},A) \cong \mathsf{Grp}(G,\iota A)$says that homomorphisms from the abelianization of $G$ to an abelian group $A$ are in one-to-one correspondence with homomorphisms from $G$ to $A$ .
It can be particularly illuminating to plug the same object into one side of the equation and see what happens to the identity on the other side. A silly example is if we let $G = \iota A$ . On the lefthand side of the equation we have for every abelian group $A$ a special homomorphism $\epsilon_A \colon (\iota A)^{\operatorname{ab}} \to A$ ; this turns out to be the isomorphism identifying the abelianization of an abelian group $A$ with itself. This homomorphism, if you trace it out, turns out to be natural in $A$ ; we call it the counit of the adjunction. A less silly example is if we let $A = G^{\operatorname{ab}}$ . Then on the righthand side of the equation we have for every group $G$ a special homomorphism $\eta_G \colon G \to \iota(G^{\operatorname{ab}})$ . This is the homomorphism from $G$ to its abelianization; it turns out to be natural in $G$ and we call it the unit of the adjunction.
For our free group example, the unit sends a set $X$ to its image inside $FX$ and the counit is the map from the free group on the underlying set of a group $G$ to the group $G$ that takes a word generated by elements of the group $G$ and evaluates it as an element of the group $G$ .
Zooming out, if we return to the general setting $F \dashv G$ , we always have $\eta\colon 1_{\mathsf{C}} \Rightarrow GF$ and $\epsilon\colon FG \Rightarrow 1_{\mathsf{D}}$ , and it turns out these natural transformations satisfy the following two identities called the triangle identities
$(\epsilon F) \cdot (F\eta) = 1_{F}\quad\text{and}\quad (G\epsilon)\cdot (\eta G) = 1_{G}.$For the free $\dashv$ forgetful adjunction, the first identity says that if you take the map $FX \to FUFX$ defined on sets by sending $X$ to its image in $UFX$ and then extending to the free groups on these sets, and then follow it with the map $FUFX \to FX$ that recognizes a word in $UFX$ as an element of $FX$ , you get the identity of the free group on $X$ , which seems believable. The second identity says that if you start with a group $G$ , the map $UG \to UFUG$ that sends an element $g \in G$ to that element thought of as a word in $FUG$ , and then apply the map $UFUG \to UG$ that is the underlying set map of the homomorphism $FUG \to G$ that recognizes a word in $G$ as an element of $G$ , you get the identity of $UG$ , also believable.
Anyway, it turns out that for a pair of functors $F\colon \mathsf{C} \to \mathsf{D}$ and $G\colon \mathsf{D} \to \mathsf{C}$ , the existence of the natural transformations $\eta\colon 1_{\mathsf{C}} \Rightarrow GF$ and $\epsilon\colon FG \Rightarrow 1_{\mathsf{D}}$ satisfying the triangle identities is equivalent to having an adjunction.
Reflective and coreflective subcategories
The example of abelianization is an example of something the nLab delightfully called -ification, or did back in 2019. The idea is we have a full subcategory $\mathsf{Ab}$ of $\mathsf{Grp}$ (every homomorphism of abelian groups qua groups is a homomorphism of abelian groups) and the inclusion $\iota$ has a left adjoint. The unit of the adjunction is a morphism in the larger category from an object to its “reflection” in the smaller category.
The dual notion, when the inclusion has a right adjoint, is a coreflective subcategory. An example of this, that I’d like to explain partially for myself, is the inclusion of compactly generated spaces into all spaces. A Hausdorff space $Y$ is compactly generated, in one formulation, if it is the direct limit (or colimit, if you prefer) of all of its compact subspaces. By the definition of the direct limit, this says that a map $Y \to X$ is continuous if and only if its restriction to every compact (necessarily Hausdorff) subspace is continuous. Since the image of a compact Hausdorff space $K$ in $Y$ is compact Hausdorff, this is equivalent to saying the following.
A map $Y \to X$ is continuous if and only if for every map from a compact Hausdorff space $K$ to $Y$ , the composition $K \to Y \to X$ is continuous.
This latter statement is more appropriately the defintion of a compactly generated space if we don’t assume $Y$ to be Hausdorff. We will, though, because I like Hausdorff spaces.
The category $\mathsf{CGHaus}$ is a full subcategory of $\mathsf{Haus}$ , the category of Hausdorff topological spaces and continuous functions. In fact it is a coreflective subcategory: the right adjoint of the inclusion $\iota$ is the functor $k$ which sends a space $X$ to $kX$ , the direct limit of all of its compact subspaces. Let’s check that this is really a functor: given a map $f\colon X \to Y$ , the restriction of $f$ to any subspace is continuous, and the image of a compact subset of $X$ is a compact subset of $Y$ , so the restrictions $f|_K$ assemble into a map $kf\colon kX \to kY$ . It’s not hard to check that this construction respects function composition and sends the identity of $X$ to the identity of $kX$ . So we have $\iota\colon \mathsf{CGHaus} \to \mathsf{Haus}$ and $k\colon\mathsf{Haus} \to \mathsf{CGHaus}$ . The adjunction is the claim that we have
$\mathsf{Haus}(\iota X,Y) \cong \mathsf{CGHaus}(X,kY).$In other words, there is a (natural) bijection between maps from a compactly generated Hausdorff space $X$ to a Hausdorff space $Y$ and maps from $X$ to $kY$ . This is true: given a map $f\colon X \to Y$ and a compact subset $K$ of $X$ , the restriction $f|_K$ has image a compact subspace of $Y$ , which we may continue into $kY$ . These maps glue up to give a map from the direct limit of all compact subspaces of $X$ to $kY$ . Since $X$ is compactly generated Hausdorff, it is the direct limit of its compact subsets, so what we have shown is that the map $f$ factors through the map $\epsilon_Y\colon kY \to Y$ defined by the universal property of the direct limit. It is clear that this process is surjective, and it is injective as well: if $f \ne g$ , since $X$ is the direct limit of all of its compact subsets, we can find a compact subspace on which $f$ and $g$ disagree, so their images in $kY$ disagree, so the maps $\tilde f \colon X \to kY$ and $\tilde g\colon X \to kY$ disagree.
RAPL
I want to finish out this blog post with one of the coolest applications of adjoint functors: “Right Adjoints Preserve Limits” and dually “Left Adjoints Preserve Colimits”. What this says, supposing I have an adjoint pair $F \dashv G$ between $\mathsf{C}$ and $\mathsf{D}$ , is that $\varprojlim_i Gd_i = G(\varprojlim_i d_i)$ and $\varinjlim_i Fc_i = F(\varinjlim_i c_i)$ . So if I have a diagram whose limit I want to compute in $\mathsf{C}$ which comes from $\mathsf{D}$ via $G$ , I can compute its limit in $\mathsf{D}$ and then apply $G$ , and I’ll get what I want.
Let’s bring it down to earth. One thing this says is that the free product of two free groups $FX$ and $FY$ is the free group on their disjoint union $FX * FY = F(X\amalg Y)$ . Another thing this says is that the underlying set of the product of two groups $G$ and $H$ is the product of $G$ and $H$ as sets.
For compactly generated Hausdorff spaces, this says that the product of $kX$ and $kY$ is $k(X\times Y)$ , but that (for instance) their disjoint union is already compactly generated Hausdorff.