Skip to main content

Postmodern Algebra

Section B.3 Natural Transformations

Subsection Natural Transformations

“The beauty of the natural world lies in the details.”
―Natalie Angier

Definition B.34.

Let \(F\) and \(G\) be covariant functors \(\mathscr{C} \longrightarrow \mathscr{D}\text{.}\) A natural transformation between \(F\) and \(G\) is a mapping that to each object \(A\) in \(\mathscr{C}\) assigns an arrow \(\eta_{A} \in \operatorname{Hom}_{\mathscr{D}}(F(A), G(A))\) such that for all \(f \in \operatorname{Hom}_{\mathscr{C}}(A, B)\text{,}\) the diagram
commutes. A natural isomorphism is a natural transformation \(\eta\) where each \(\eta_{A}\) is an isomorphism. We sometimes write
or simply \(\eta: F \Longrightarrow G\text{.}\)
Let \(F\) and \(G\) be contravariant functors \(\mathscr{C} \longrightarrow \mathscr{D}\text{.}\) A natural transformation between \(F\) and \(G\) is a mapping that to each object \(A\) in \(\mathscr{C}\) assigns an arrow \(\eta_{A} \in \operatorname{Hom}_{\mathscr{D}}(F(A), G(A))\) such that for all \(f \in \operatorname{Hom}_{\mathscr{C}}(A, B)\text{,}\) the diagram
commutes.
Often, when studying a particular topic, we sometimes say a certain map is natural to mean that there is actually a natural transformation behind it.

Example B.35.

Recall the abelianization functor we discussed in Example 1.26. The abelianization comes equipped with a natural projection map \(\pi_{G}: G \longrightarrow G^{\text {ab }}\text{,}\) the usual quotient map from \(G\) to a normal subgroup. Here we mean natural in two different ways: both that this is common sense map to consider, and that this is in fact coming from a natural transformation. What’s happening behind the scenes is that abelianization is a functor \(ab: \Grp\longrightarrow \Grp\text{.}\) On objects, the abelianizations functor is defined as \(G \mapsto G^{\text {ab }}\text{.}\) Given an arrow, meaning a group homomorphism \(G \stackrel{f}{\rightarrow} H\text{,}\) one can check that \([G, G]\) is contained in the kernel of \(\pi_{H} f\text{,}\) so \(\pi_{H} f\) factors through \(G^{\text {ab }}\text{,}\) and there exists a group homomorphism \(f^{\mathrm{ab}}\) making the following diagram commute:
So the abelianization functor takes the arrow \(f\) to \(f^{\text {ab }}\text{.}\) The commutativity of the diagram above says that \(\pi_{-}\)is a natural transformation between the identity functor on \(\Grp\) and the abelianization functor, which we can write more compactly as
\begin{equation*} \operatorname{Grp} \underset{\frac{\mathrm{id}}{\Downarrow \pi}}{\stackrel{\mathrm{ab}}{\longrightarrow}} \operatorname{Grp}. \end{equation*}

Definition B.36. Functor Category.

Let \(F, G: \mathscr{C} \longrightarrow \mathscr{D}\) be two functors between the categories \(\mathscr{C}\) and \(\mathscr{D}\text{.}\) We write
\begin{equation*} \operatorname{Nat}(F, G)=\{\text { natural transformations } F \longrightarrow G\}. \end{equation*}
Given two categories \(\mathscr{C}\) and \(\mathscr{D}\text{,}\) one can build a functor category
 1 
Yes, the madness is neverending.
with objects all covariant functors \(\mathscr{C} \longrightarrow \mathscr{D}\text{,}\) and arrows the corresponding natural transformations. This category is denoted \(\mathscr{D}^{\mathscr{C}}\text{.}\) Sometimes one writes \(\operatorname{Hom}(F, G)\) for \(\operatorname{Nat}(F, G)\text{,}\) but we will avoid that, as it might make things even more confusing.
For the functor category to truly be a category, though, we need to know how to compose natural transformations.

Remark B.37. Composition of Natural Transformations.

Consider natural transformations
and
We can compose them for form a new natural transformation
We should think of this composition as happening vertically. For each object \(C\) in \(\mathscr{C}, \eta \varphi\) sends \(C\) to the arrow \(F(A) \stackrel{\varphi_{A}}{\longrightarrow} G(A) \stackrel{\eta_{A}}{\longrightarrow} H(A)\text{.}\) This makes the diagram
commute.

Exercise B.38.

Show that a natural transformation \(\eta: \mathscr{C} \Longrightarrow \mathscr{D}\) is a natural isomorphism if and only if there exists a natural transformation \(\mu: \mathscr{D} \Longrightarrow \mathscr{C}\) such that \(\eta \circ \mu\) is the identity natural isomorphism on \(G\) and \(\mu \circ \eta\) is the identity natural isomorphism on \(F\text{.}\)

Definition B.39. Equivalent Categories.

Two categories \(\mathscr{C}\) and \(\mathscr{D}\) are equivalent if there exist functors \(F: \mathscr{C} \rightarrow \mathscr{D}\) and \(G: \mathscr{D} \rightarrow \mathscr{C}\) and two natural isomorphisms \(\alpha: G F \Longrightarrow 1_{\mathscr{C}}\) and \(\beta: F G \Longrightarrow 1_{\mathscr{D}}\text{.}\) We say that a functor \(F: \mathscr{C} \rightarrow \mathscr{D}\) is an equivalence of categories if there exists a functor \(G\) and natural isomorphisms \(\alpha\) and \(\beta\) as above.
If one assumes the Axiom of Choice, this is the right notion of isomorphism of two categories (though not in the categorical sense!); better said, two categories that are equivalent are essentially the same. Note that this does not mean that there is a bijection between the objects of \(\mathscr{C}\) and the objects of \(\mathscr{D}\text{.}\) In fact, one can show that a functor is an equivalence of categories if and only if it is fully faithful and essentially surjective - though this fact requires the Axiom of Choice!

Exercise B.40.

Let \(\mathscr{C}\) be the category with one object \(C\) and a unique arrow \(1_{C}\text{.}\) Let \(\mathscr{D}\) be the category with two objects \(D_{1}\) and \(D_{2}\) and four arrows: the identities \(1_{D_{i}}\) and two isomorphisms \(\alpha: D_{1} \rightarrow D_{2}\) and \(\beta: D_{2} \rightarrow D_{1}\text{.}\) Let \(\mathscr{E}\) be the category with two objects \(E_{1}\) and \(E_{2}\) and only two arrows, \(1_{E_{1}}\) and \(1_{E_{2}}\text{.}\)
  1. Show that \(\mathscr{C}\) and \(\mathscr{D}\) are equivalent categories.
  2. Show that \(\mathscr{C}\) and \(\mathscr{E}\) are not equivalent categories.

Subsection The Yoneda Lemma

“If it walks like a duck and homs like a duck, it’s naturally isomorphic to a duck.”
―Twitter User @_julesh_
Even though this is only a short introduction to category theory, we would be remiss not to mention the Yoneda Lemma, arguably the most important statement in category theory.

Proof.

Let \(\varphi\) be a natural transformation in \(\operatorname{Nat}\left(\operatorname{Hom}_{\mathscr{C}}(A,-), F\right)\text{.}\) The proof of the Yoneda Lemma is essentially the following diagram:
Our bijection will be defined by \(\gamma(\varphi):=\varphi_{A}\left(1_{A}\right)\text{.}\) We should first check that this makes sense: arrows in Set are just functions between sets, and so \(\varphi_{A}\) is a function of sets \(\operatorname{Hom}_{\mathscr{C}}(A, A) \longrightarrow F(A)\text{.}\) Also, \(\operatorname{Hom}_{\mathscr{C}}(A, A)\) is a set that contains at least the element \(1_{A}\text{,}\) and \(\varphi_{A}\left(1_{A}\right)\) is some element in the set \(F(A)\text{.}\)
Given any fixed \(f \in \operatorname{Hom}_{\mathscr{C}}(A, X)\text{,}\) the fact that \(\varphi\) is a natural transformation translates into the outer commutative diagram. In particular, the maps of sets \(F(f) \varphi_{A}\) and \(\varphi_{X} \operatorname{Hom}_{\mathscr{C}}(A, f)\) coincide, and must in particular take \(1_{A}\) to the same element in \(F(X)\text{.}\) This is the commutativity of the inner diagram, with \(u:=\varphi_{A}\left(1_{A}\right)\text{.}\)
The commutativity of the diagram above says that \(\varphi\) is completely determined by \(\varphi_{A}\left(1_{A}\right)\text{,}\) since for any other object \(X\) in \(\mathscr{C}\) and any arrow \(f \in \operatorname{Hom}_{\mathscr{C}}(A, X)\text{,}\) we necessarily have \(\varphi_{X}(f)=F(f) \varphi_{A}\left(1_{A}\right)\text{.}\) In particular, our map \(\gamma(\varphi)=\varphi_{A}\left(1_{A}\right)\) is injective. Moreover, note that each choice of \(u \in F(A)\) gives rise to a different natural transformation \(\varphi\) by setting \(\varphi_{X}(f)=F(f) u\text{.}\) So our map \(\gamma\) is indeed a bijection.
We now have two naturality statements to prove. Naturality in the functor means that given a natural isomorphism \(\eta: F \longrightarrow G\text{,}\) the diagram
commutes. Given a natural transformation \(\varphi\) between \(\operatorname{Hom}_{\mathscr{C}}(A,-)\) and \(F\text{,}\)
\begin{equation*} \begin{array}{rlr} \eta_{A} \circ \gamma_{F}(\varphi) & =\eta_{A}\left(\varphi_{A}\left(1_{A}\right)\right) & \text { by definition of } \gamma \\ & =(\eta \circ \varphi)_{A}\left(1_{A}\right) & \text { by definition of composition of natural transformations } \\ & =\gamma_{G}(\eta \circ \varphi) & \text { by definition of } \gamma \\ & =\gamma_{G} \circ \eta_{*}(\varphi) & \text { by definition of } \eta_{*} \end{array} \end{equation*}
so commutativity does hold. Naturality on the object means that given an arrow \(f: A \longrightarrow B\text{,}\) the diagram
commutes. Given a natural transformation \(\varphi\) between \(\operatorname{Hom}_{\mathscr{C}}(A,-)\) and \(F\text{,}\)
\begin{equation*} F(f) \circ \gamma_{A}(\varphi)=F(f)\left(\varphi_{A}\left(1_{A}\right)\right) \end{equation*}
while
\begin{equation*} \gamma_{B} \circ\left(f^{*}\right)^{*}(\varphi)=\gamma_{B}\left(\varphi \circ f^{*}\right)=\left(\varphi \circ f^{*}\right)_{B}\left(1_{B}\right) \end{equation*}
Now notice that
\begin{equation*} \begin{array}{r} \operatorname{Hom}_{\mathscr{C}}(B, B) \stackrel{f^{*}}{\longrightarrow} \operatorname{Hom}_{\mathscr{C}}(A, B) \stackrel{\varphi_{B}}{\longrightarrow} F(B) . \\ 1_{B} \longmapsto f \longmapsto \varphi_{B}(f) \end{array} \end{equation*}
Let’s look back at the big commutative diagram we started our proof with: it says in particular that \(\varphi_{B}(f)=F(f)\left(\varphi_{A}\left(1_{A}\right)\right)\text{.}\) So commutativity does hold, and we are done.
One can naturally (pun intended) define the notion of functor category of contravariant functors, and then prove the corresponding Yoneda Lemma, which will instead use the contravariant Hom functor.

Exploration B.1. Contravariant version of the Yoneda Lemma.

Let \(\mathscr{C}\) be a locally small category, and fix an object \(B\) in \(\mathscr{C}\text{.}\) Let \(F: \mathscr{C} \longrightarrow\) Set be a contravariant functor. Then there is a bijection
\begin{equation*} \text { Nat }\left(\operatorname{Hom}_{\mathscr{C}}(-, B), F\right) \stackrel{\gamma}{\longrightarrow} F(B). \end{equation*}
In a way, the Yoneda Lemma says that to give a natural transformation between the functors \(\operatorname{Hom}_{\mathscr{C}}(A,-)\) and \(F\) is choosing an element in \(F(A)\text{.}\)

Remark B.42.

Notice that the Yoneda Lemma says in particular that the collection of all natural transformations from \(\operatorname{Hom}_{\mathscr{C}}(A,-)\) to \(F\) is a set. This wasn’t clear a priori, since the collection of objects in \(\mathscr{C}\) is not necessarily a set.

Remark B.43.

If we apply the Yoneda Lemma to the case when \(F\) itself is also a Hom functor, say \(F=\operatorname{Hom}_{\mathscr{C}}(B,-)\text{,}\) the Yoneda Lemma says that there is a bijection between \(\operatorname{Nat}\left(\operatorname{Hom}_{\mathscr{C}}(A,-), \operatorname{Hom}_{\mathscr{C}}(B,-)\right)\) and \(\operatorname{Hom}_{\mathscr{C}}(B, A)\text{.}\) In particular, each arrow in \(\mathscr{C}\) determines a natural transformation between Hom functors.
One of the consequences of the Yoneda Lemma is the Yoneda Embedding, which roughly says that every locally small category can be embedded into the category of contravariant functors from \(\mathscr{C}\) to Set. In particular, the Yoneda embedding says that natural transformations between representable functors correspond to arrows between the representing objects.

Proof.

First, note that our functors are injective on objects because the \(\Hom\)-sets in our category are all disjoint. We need to check that given objects \(A\) and \(B\) in \(\mathscr{C}\text{,}\) we have bijections
\begin{equation*} \operatorname{Hom}_{\mathscr{C}}(A, B) \cong \operatorname{Nat}\left(\operatorname{Hom}_{\mathscr{C}}(-, A), \operatorname{Hom}_{\mathscr{C}}(-, B)\right) \end{equation*}
and
\begin{equation*} \operatorname{Hom}_{\mathscr{C} \text { op }}(A, B) \cong \operatorname{Nat}\left(\operatorname{Hom}_{\mathscr{C}}(A,-) \operatorname{Hom}_{\mathscr{C}}(B,-)\right). \end{equation*}
We will do the details for the first one, and leave the second as an exercise.
First, let us take a sanity check and confirm that indeed our proposed functors take arrows \(f: A \longrightarrow B\) in \(\mathscr{C}\) to natural transformations between \(\operatorname{Hom}_{\mathscr{C}}(-, A)\) and \(\operatorname{Hom}_{\mathscr{C}}(-, B)\text{.}\) This is essentially the content of Remark 1.43, but let’s carefully check the details. The Yoneda Lemma applied here tells us that each natural transformation \(\varphi\) between \(\mathrm{Hom}_{\mathscr{C}}(-, A)\) and \(F=\operatorname{Hom}_{\mathscr{C}}(-, B)\) corresponds to an element \(u \in \operatorname{Hom}_{\mathscr{C}}(A, B)\text{,}\) which we obtain by taking \(u:=\varphi_{A}\left(1_{A}\right)\text{.}\) As we discussed in the proof of the Yoneda Lemma, we can recover \(\varphi\) from \(u\) by taking the natural transformation \(\varphi\) that for each object \(X\) in \(\mathscr{C}\) has \(\varphi_{X}: \operatorname{Hom}_{\mathscr{C}}(X, A) \longrightarrow \operatorname{Hom}_{\mathscr{C}}(X, B)\) given by \(\varphi_{X}(f)=\operatorname{Hom}_{\mathscr{C}}(f, B)(u)=f_{*}(u)\text{.}\)
We can see that different arrows \(f\) give rise to different natural transformations by applying the resulting natural transformation \(f_{;} *\) to the identity arrow \(1_{A}\text{,}\) which takes it to \(f\text{.}\) Moreover, the Yoneda Lemma tells us that every natural transformation \(\varphi\) between \(\operatorname{Hom}_{\mathscr{C}}(-, A)\) and \(\operatorname{Hom}_{\mathscr{C}}(-, B)\) is the image of some \(u\text{,}\) as described above.
The functors that are naturally isomorphic to some Hom functor are important.

Definition B.45.

A covariant functor \(F: \mathscr{C} \longrightarrow \Set\) is representable if there exists an object \(A\) in \(\mathscr{C}\) such that \(F\) is naturally isomorphic to \(\operatorname{Hom}_{\mathscr{C}}(A,-)\text{.}\) A contravariant functor \(F: \mathscr{C} \longrightarrow \Set\) is representable if there exists an object \(B\) in \(\mathscr{C}\) such that \(F\) is naturally isomorphic to \(\operatorname{Hom}_{\mathscr{C}}(-, B)\text{.}\)

Example B.46.

We claim that the identity functor Set \(\longrightarrow\) Set is representable. Let 1 be a singleton set. Given any set \(X\text{,}\) there is a bijection between elements \(x \in X\) and functions \(\mathbf{1} \longrightarrow X\) sending the one element in \(\mathbf{1}\) to each \(x\text{.}\) Moreover, given any other set \(Y\text{,}\) and a function \(f: X \longrightarrow Y\text{,}\) our bijections make the following diagram commute:
This data gives a natural isomorphism between the identity functor and \(\operatorname{Hom}_{\text {Set }}(\mathbf{1},-)\text{.}\)

Exercise B.47.

Show that the forgetful functor \(\Grp \longrightarrow \Set\) is representable.

Exercise B.48.

Given a ring \(R\text{,}\) show that the forgetful functor \(R\Mod \longrightarrow \Set\) is representable.
A representable functor encodes a universal property of the object that represents it. For example, in Example 1.46, mapping out of the singleton set is the same as choosing an element \(x\) in a set \(X\text{.}\) We have all seen constructions that are at first a bit messy but that end up satisfying some nice universal property that makes everything work out. At the end of the day, a universal property allows us to ignore the messy details and focus on the universal property, which usually says everything we need to know about the construction. And as you may have already realized, universal properties are everywhere. Before we give a formal definition, we want to discuss some important examples.