Natural transformations

Eilenberg and Mac Lane in Categories for the Working Mathematician (p. 28)

..."category" has been defined in order to be able to define "functor" and "functor" has been defined in order to be able to define "natural transformation."

When I first read the above quote, I couldn't quite wrap my head around how this could be case. Out of all of the foundations of basic category theory, natural transformations initially seemed to me the least intuitive concept. I've since come to the understanding, however, that this is precisely why we need category theory.

After all, once you've spent times studying vector spaces (with the linear transformations between them), groups (with the group morphisms between them), rings (with the ring morphisms between them) and topological spaces (with the continuous maps between them), you can't help but notice a general pattern: there always seems to be some type of algebraic object (i.e., a set with additional structure) and structure-preserving maps between those structures. So the basic idea of a category (objects and arrows) seems inevitable.

And it doesn't take long to make the jump to connections between categories, i.e., functors. If this were where the story ended, you'd have a strong argument to suggest that functors should have been simply called morphisms between categories (and you still could). Category theory would also have been a lot less powerful.

But there's more to this story. Anyone who has spent enough time studying some type of algebraic structure eventually encounters constructions that seem "natural," in the sense that they're "the same for every object." A popular example of this is the determinant, the function that assigns to each square matrix a number with some very nice properties. We've all memorized the formula for computing the determinant, and that formula doesn't depend on the type of entries in the matrix. In other words, regardless of whether the entries of your square matrix are integers, real numbers, or real-valued functions, the formula for the determinant of that matrix is always "the same," namely a signed-sum over all possible products of entries (with exactly one entry selected from each row and column). No one ever said "This is how you compute the determinant if your entries are real numbers, but this is how you compute the determinant if your entries are real-valued functions."

There are many (many!) more examples, and we'll see a bunch of them soon, but historically it took time to pin down exactly what was meant mathematically by "natural" or "the same for all objects." It was this issue that likely delayed the development of category theory, at least a bit. And it's the fact that category theory finally enables us to be precise about "naturality" that gives the theory it's first real chance to shine. So let's get to it!

Mathematical naturality


Everyone (probably)

A natural transformation is a morphism between functors.

At long last, here is the definition:

Definition of natural transformation

Suppose F,G:CD are two functors. A natural transformation τ:FG is a function that assigns to each object cC an arrow τc:F(c)G(c) in D such that for every arrow f:cc in C one has G(f)τc=τcF(f); in other words, the diagram below commutes:

The arrows τc are called the components of the natural transformation and the commutativity of the above diagrams is often referred to as the naturality condition.

A natural transformation τ:FG can be viewed as a way to compare the images of two functors, since it directly connects the image of each object under F with the image (of the same object) under G; the naturality condition guarantees these comparisons are compatible with arrow composition. In other words, the natural transformation connects the image of the functor F to the image of the functor G in a "natural way," i.e., consistent with the full categorical structures of C and D.

A note on notation

There is not an officially agreed-upon notation for natural transformations. Some authors use the notation we use here, but I've also seen it written FG and even simply FG.

Examples


Moving forward from this point, we will see many examples. What follows is just an initial sampling.

The identity natural transformation

For any functor F:CD, we always have the identity natural transformation 1F:FF, with component arrows given by the identity arrows, i.e., for every cC we have (1F)c=1F(c):F(c)F(c).

The determinant

Even though it's actually far from the simplest and most intuitive example, our first nontrivial example should probably be the determinant, since it was an early motivator for this new idea. For simplicity, we will mainly restrict to the situation of the determinant of an invertible square matrix.

To that end, let R be a commutative ring. The determinant is a function that assigns to each n×n matrix M with entries in R a very specific element in R. This function has the following properties:

  1. M is invertible exactly when its determinant is a unit; and
  2. The determinant function is multiplicative
    It follows that the determinant defines a group morphism GLn(R)R×. Since this function ostensibly depends on the ring R, we should denote it detR:GLn(R)R×. However, it is common to simply denote the determinant function by det, usually with the acknowledgement that the formula for the determinant is "the same over every ring." The precise meaning of this is that for every ring morphism f:RS we have the following commutative diagram in Grp:

The vertical arrow on the left is the group morphism that takes each n×n matrix with entries in R and applies f:RS to each entry to produce an n×n matrix with entries in S. The right vertical arrow is simply the ring morphism f:RS restricted to the multiplicative units of R. (It is an easy result in ring theory that if rR is a unit, then f(r)S is also a unit; i.e., f(r)S×.)

The above diagram is a fancy way of expressing the fact that, given an invertible n×n matrix M with entries in R, we can either compute its determinant and then apply f to the answer, or first apply f to move that matrix to one over S and then compute the determinant. In other words, the computation of the determinant is "the same for all rings" in the only sense in which such a statement can be made precise: if we were to compare the computations in two different rings (using a ring morphism f:RS to enable the comparison), we get "the same thing either way."

In any case, the above diagram exactly says that det:GLn× is a natural transformation between the two functors GLn,×:CRingGrp.

Maps between diagrams

We can use functors to formalize the notion of "diagrams" in a given category, and then use natural transformations to formalize the notion of "maps between diagrams" of "the same shape".

Suppose J and C are two categories. A diagram of shape J in C is simply a functor F:JC. A map between diagrams is then simply a map between such functors, i.e., a natural transformation between such functors.

We can visualize these natural transformations as cylinders with cross-sections given by the shape category. For example, suppose the category J looks like

Suppose F,G:JC are two such diagrams in C. Then a natural transformation τ:FG can be visualized as

The vertical green arrows are the components of the natural transformation. The naturality condition here is the requirement that each of the three "vertical" rectangles commutes.

The center of a group

Recall that to each group G we can associate the category BG, the so-called delooping groupoid. One functor that certainly exists is the identity functor on this category, which we'll denote I:BGBG. We claim that the set of natural transformations from this identity functor to itself is in bijection with the elements of the center of G.

Indeed, first suppose τ:II is a natural transformation from I to itself. Since the category BG has only a single object , this natural transformation is determined entirely by the single component arrow τ:I()I(). But since I()=, this is nothing more than an arrow in BG, i.e., an element zG.

Now let's investigate the naturality condition. Take any arrow in BG, say g: where gG. Then the diagram below must commute:

The vertical arrows correspond to the element zG, so the composition gτ corresponds to the element gz. Similarly, the composition τg corresponds to the element zg. The commutativity of the above diagram is therefore the requirement gz=zg, for all gG. This is exactly the condition for z to be in the center of G.

It's not hard to show the converse, namely that every element of the center induces a corresponding natural transformation.

Even better, this bijection can be upgraded to an isomorphism of groups! There is a composition operation on natural transformations (see below), and this can be used to put a group structure on the set of these natural transformations II. One can prove this group is indeed isomorphic to the center of G.

Free vector spaces and "insertion of generators"

Let k be a field.[1] For each set X, the free k-vector space on X is the vector space F(X) "generated" by the elements of X. It is usually described as consisting of all formal finite k-linear combinations of elements in X, i.e., it consists of formal sums of the form xXcxx where cxk, all but finitely many zero. (A more formal definition is that F(X) consists of all set maps f from the set X to the (set of elements of the) field k, such that f(x)=0 for all but finitely many xX.) One can show that this defines the object function of a functor F:SetVeck.

Let U:VeckSet be the usual forgetful functor and consider the composition UF:SetSet. This composition sends each set X to the set of elements of the vector space F(X). There is evidently a set map ηX:XUF(X) that sends each element xX to the same element in F(X), only now considered as a formal linear combination of the elements of X (that just happens not to involve any of the other elements). (In the more precise formal definition of F(X) mentioned parenthetically above, the map ηX sends each element xX to the characteristic function of x; i.e., f(x)=1 and f(x)=0 for all xx.) This map is sometimes called the insertion of generators. It is immediate to verify this defines a natural transformation from the identity functor on Set to the composition UF.

Soon we will see that the functors U and F are adjoints. This natural transformation will be an important part of that relationship.

Abelianization and forgetting

For each group G the projection πG:GG/[G,G] defines a natural transformation from the identity functor on Grp to the abelianization-forgetful composition functor GrpAbGrp. This transformation is natural, since for every group morphism f:GH you can check that the diagram below commutes:

Similar to the previous example, we will soon see that the abelianization and forgetful functors are an adjoint pair.

Composition of natural transformations


There are two ways one can compose natural transformations, which visually can be thought of as
"vertical composition" and "horizontal composition."

Vertical composition of natural transformations

Suppose we have three functors F,G,H:CD and a pair of natural transformations τ:FG and η:GH. Visually we might represent this information as follows:

We can define a natural transformation ητ:FH by composing the component arrows of τ with the component arrows of η:

(ητ)c:=ηcτc:F(c)H(c)

The naturality condition for ητ follows immediately from the "stacked" naturality conditions of τ and η:

This vertical composition will allow us to define an entire category of functors between two fixed categories, i.e., so-called functor categories. In fact, you should check that for each functor F:CD the identity natural transformation 1F:FF is the identity for vertical composition of natural transformations from F to itself.

Horizontal composition of natural transformations

You can probably see this one coming, but now suppose we had successive natural transformations between pairs of functors, as illustrated below:

We can combine the components of the natural transformations τ and η to product a natural transformation F2F1G2G1. Can you see how?

I'm purposely not filling in the details for this composition for two reasons:

  1. We will not need this composition anytime soon.
  2. If we proceed any further, we'll need to decide how to distinguish the two composition operations. Should we use different symbols for each, like τη and τη? Should we leave it as τη and make it context-specific? Rather than decide, let's avoid the issue for as long as we can. Maybe forever!

Natural isomorphisms


Now that we have a way to compose natural transformations we can consider the idea of "invertible" natural transformations and natural "isomorphisms."

Definition of natural isomorphism

A natural transformation τ:FG between functors F,G:CD is a natural isomorphism if there exists a natural transformation η:GF such that the vertical compositions of τ and η are mutual inverses, i.e., ητ=1F and τη=1G.

In this case, we say that the functors F and G are (naturally) isomorphic.

Suggested next notes


Functor categories
Universal Properties III - Yoneda's Lemma


  1. I'm not calling the field F here since that letter is about to refer to a functor. ↩︎