A Brief Introduction to Categories, Part 2: Functors

This post is a continuation of a previous post and part of a mini-series on category theory. As before, knowing the background of every single example is not necessary (nor sufficient) to grasp the general concept.

Introduction

Previously, we have defined and discussed categories. However, studying categories as isolated objects with no relation to other categories would be a fruitless toil. It would also not be in the spirit of category theory, which studies anyhing via its relationship to other things. Yet the necessity to bring together distinct instances of the objects one is studying is not specific to category theory: For example, it’s hard to imagine studying group theory without studying group homomorphisms.

It should by now be clear that we are in dire need of a notion allowing us to connect different categories and to express relationships between them. It seems natural to let the definition of a category guide us to the definition of things that relate them. This plan comes to fruition in the conception of functors. These should be thought of as (homo)morphisms of categories, mappings preserving the structure categories have, i.e. identities and composition, just like a monoid homomorphism preserves the neutral element and the monoid operation.

The ubiquity with which functors arise is remarkable, and after some experience in thinking categorically it will become second nature to ask whether a construction behaves “functorially”.

Functors

Definition C2.1 Let \mathcal C and \mathcal D be categories, then a (covariant) functor F consists of the following data:

  • A map \mathrm{Obj}(\mathcal C) \to \mathrm{Obj}(\mathcal D), X \mapsto F(X)
  • For any pair of objects X, Y \in \mathrm{Obj}(\mathcal C) a map \mathrm{Hom}_{\mathcal C}(X,Y) \to \mathrm{Hom}_{\mathcal D}(F(X),F(Y)), f \mapsto F(f)

such that the following conditions hold:

  • For every object X \in \mathrm{Obj}(\mathcal C) we have F(\mathrm{id}_X)=\mathrm{id}_{F(X)}
  • For any three objects X,Y,Z \in \mathrm{Obj}(\mathcal C) and morphisms f:X \to Y, g:Y \to Z we have F(g \circ f)= F(g) \circ F(f).

 

Let us ponder for a moment how this definition generalizes familiar concepts.

Example C2.2 Let X and Y be sets, then we can consider them as discrete categories (cf. C1.4), so that the elements of each set are the objects of the associated discrete category and the only morphisms are the identity morphisms. Then any map f:X \to Y uniquely determines a functor F between the associated discrete categories restricting to f on the objects, as the only morphisms are identities and the definition of a functor requires sending identity morphisms to the corresponding identity morphisms in the target category. To summarize, functors between discrete categories correspond to maps between the underlying sets.

Example C2.3 Let M and N be monoids, considered as one-object categories. Then a functor F:M \to N has to send the unique object of M to the unique object of N. The action on morphisms is more interesting: from the definition of a functor, we see that a map of the underlying sets f:M \to N determines a functor if and only if it preserves the monoid operation and the identity, i.e. if and only if it is a monoid homomorphisms. Thus for monoids (and hence for groups), we can regard homomorphisms as functors.

Example C2.4 Let G be a group, considered as a one-object category and let us consider functors to the category of sets (cf. C1.2), F:G \to \mathbf{Set}. Since G has one proxy object x, the value of F(x) corresponds to a choice of a particular set X. As for the morphisms, we have for each g \in G a map F(g):X \to X such that F(e)=\mathrm{id}_X and F(gh)=F(g) \circ F(h). These are precisely the axioms for a group action on X, such that functors G \to \mathbf{Set} correspond to sets with a (left) G-action, i.e. G-Sets.

Example C2.5 By reasoning as in the last example, one can show that if K is a field and we consider the category K\mathbf{-Vect} of vector spaces over K with linear maps as morphisms, then functors G \to  K\mathbf{-Vect} correspond to representations of G on vector spaces over K.

Now we shall look into examples of particular functors.

Example C2.6 There are a plethora of so-called “forgetful” functors. These arise when you “forget” part of the structure of an object. In this case, the target category consists of objects with less structure than the source category.
For example, we can forget about the multiplication in a ring and are left with an abelian group, this gives rise to a forgetful functor from the category of rings to the category of abelian groups. We can then proceed on our path to oblivion and forget that an abelian group is abelian, yielding a forgetful functor from abelian groups to groups. Finally, every group is a set, giving rise to yet another forgetful functor. It should be noted that it is important to consider also the morphisms for these forgetful functors to work: every ring homomorphism is a homomorphism of abelian groups on the additive groups, every homomorphism of abelian groups is a group homomorphism and every group homomorphism is a map of sets. Another chain of forgetful functors goes from smooth complex varieties to complex manifolds, from complex manifolds to smooth manifolds, from smooth manifolds to topological manifolds, from topological manifolds to topological spaces and from topological spaces to sets, ending another journey of obliviousness in the same destination.
Forgetful functors are often implicitly applied, especially if one is not doing category theory. And indeed, it should deserve no particular mention that for instance, any group is a set. It can be quite helpful, however, to explicitly state when you apply them, for example to clarify in which category two objects are isomorphic or if you want to apply concepts or theorems on functors to a forgetful functor.

Example C2.7 One could say that the first example of functoriality is encountered in an introductory calculus class, although that would be a bit of a stretch.
Let \mathbf{Diff}_{*} be the category of pointed smooth manifolds, i.e. objects are pairs (M,x) where M is a smooth manifold and x \in M and morphisms (M,x) \to (N,y) are smooth maps f:M \to N such that f(x)=y. Then there’s the tangent space functor T_{-}: \mathbf{Diff}_* \to \mathbb{R}\mathbf{-Vect} to the category of \mathbb{R}-vector spaces with linear maps that sends a pair (M,x) to the tanget space T_x M of M at x and a morphism f:(M,x) \to (N,y) to the differential D_x(f):T_xM \to T_y N. The fact that this behaves functorially is an abstract version of the chain rule: D_x(g \circ f)=D_{f(x)}(g) \cdot D_x(f), justifying the assertion on functoriality in calculus above.

Example C2.8 Let \mathbf{Ring} be the category of rings with ring homomorphisms as morphisms, then for any ring A, the units A^\times form a group and ring homomorphisms preserve units so that a ring homomorphism f: A \to B restricts to a group homomorphism A^\times \to B^\times. We obtain a functor from \mathbf{Ring} to \mathbf{Grp}, the category of groups with group homomorphisms as morphisms.

Example C2.9 Let A be an abelian group and n \in \mathbb{N}, then there’s a functor from the category \mathbf{Top} of topological spaces to the category of abelian groups that sends a space X to the singular homology group H_n(X,A). The fact that this is a functor is even part of the Eilenberg-Steenrod axioms for homology theories.

Example C2.10 Let \mathbf{Top} be the category of topological spaces with continuous maps and let \mathcal C be the category of measurable spaces with measurable maps as morphisms. There’s a functor \mathbf{Top} \to \mathcal C that equips a topological space with its Borel \sigma-algebra, turning it into a measurable space. Every continuous map is measurable with respect to the corresponding Borel \sigma-algebras, ensuring that this construction yields a functor.

Example C2.11 Not every constructions that seems in some sense “natural” can be turned into a functor. For example, we can associate to each group G its center Z(G) which is an abelian group. One could hope that this can be made into a functor. The problem is that central elements don’t necessarily get sent to central elements under a group homomorphism. Indeed, it is impossible to define any action on morphisms such that the assignment on objects G \mapsto Z(G) becomes a functor, for the identity on the cyclic group on two elements C_2 factors through the inclusion \iota of C_2 to S_3 as a transposition and the sign homomorphism \sigma:S_3 \to C_2. We have \mathrm{id}_{C_2}=\sigma \circ \iota. However, the center of C_2 is itself, whereas the center of S_3 is trivial. If there was any functor F that restricts to G \mapsto Z(G) on objects, then we would get \mathrm{id}_{C_2}=F(\mathrm{id}_{C_2})=F(\sigma \circ \iota)=F(\sigma) \circ F(\iota) implying that the identity on C_2 factors over the trivial group, which is impossible.

Example C2.12 Let C be a category and let X \in \mathrm{Obj}(\mathcal C), then for any object Y \in \mathrm{Obj}(\mathcal C), we have a set \mathrm{Hom}_{\mathcal C}(X,Y) and for a morphism f:Y \to Y', we can postcompose with f, yielding a map f \circ -: \mathrm{Hom}_{\mathcal C}(X,Y) \to \mathrm{Hom}_{\mathcal C}(X,Y'). By associativity of composition and the definition of the identity elements, this construction yields a functor \mathcal C \to \mathbf{Set}. These functors – affectionally called Hom-functors – are of paramount importance, as we shall see in future posts.

Example C2.13 We have said that functors can be thought of as morphisms between categories. This can be taken quite literally. To avoid Russel’s paradox and to ensure that our sets of morphisms will actually be sets, let’s restrict our attention to categories whose class of objects is actually a set, so-called “small” categories. There’s a (non-small!) category \mathbf{Cat}, in which the objects are small categories and morphisms are functors between small categories. Note that we have implicitly said that one can compose functors and that there’s an identity functor for each category.

Example C2.14 Let \mathbf{Cat} be the category from the previous example. Fix a commutative ring R. For any small category \mathcal C, let R[\mathcal C] be the free R-module with a basis given by the set of all morphisms in \mathcal C. (Note for the set-theoretically careful: since the objects form a set and the morphisms between two fixed objects form a set, the set of all morphisms is a union of sets indexed by a set (twice), which is thus again a set)
This means that elements of R[\mathcal C] are formal linear combinations of morphisms in \mathcal C. For two morphisms f,g in \mathcal C, considered as basis elements of R[\mathcal C], define their product to be f \circ g, if f and g can be composed or 0 otherwise. This extends bilinearly to a mapping R[\mathcal C] \times R[\mathcal C] \to R[\mathcal C] that makes R[\mathcal C] into an associative, generally non-commutative and non-unital R-algebra. If F: \mathcal C \to \mathcal D is a functor of small categories, then F extends linearly to a homomorphism of R-algebras R[\mathcal C] \to R[\mathcal D].
Thus we obtain a functor from the category of small categories to the category of associative R-algebras. If G is a group, considered as a one-object category (cf. example C1.7), then R[G] coincides with the group algebra associated to R and G (for more details on how this is useful for representation theory, see this post).
The same construction also works if R is not commutative, yielding a non-unital ring, but then it wouldn’t make sense to call the result an R-algebra.

Contravariance

contra

All the previous examples of functors had one thing in common: they didn’t reverse the orientation of the arrows. Even so, there are other instances of functoriality. The following construction allows us to subsume those instances under the previous definition:

Definition C2.15 Let \mathcal C be a category, then the opposite category \mathcal C^{op} has the same objects. For X,Y \in \mathrm{Obj}(\mathcal C^{op}), we set \mathrm{Hom}_{\mathcal C^{op}}(X,Y)=\mathrm{Hom}_{\mathcal C}(Y,X) composition is defined like the composition in \mathcal C except in the opposite order.

Intuitively, we just reverse all the arrows.

Definition C2.16 Let \mathcal C and \mathcal D be categories, then a contravariant functor F: \mathcal C \to \mathcal D is a covariant functor \mathcal C^{op} \to \mathcal D.

For clarification, regular functors (as in definition C2.1) are called covariant, but if “functor” is used without specification, they are always covariant by default.

From this definition, it follows that a contravariant functor reverses the direction of morphisms when it is applied. (Hence the picture in the beginning of this section)

Example C2.16 Consider the category of sets \mathbf{Set}. The assignment on objects X \mapsto \mathcal{P}(X) can be made into a functor in two different ways, a covariant one and a contravariant one. For the covariant one, let f:X \to Y be any map. Then we can define a map \mathcal{P}(X) \to \mathcal{P}(Y) via X \supset U \mapsto f(U), giving rise to the covariant powerset functor. For the contravariant one, we can define for a map f:X \to Y a map \mathcal{P}(Y) \to \mathcal{P}(X) via Y \supset V \mapsto f^{-1}(V). In both cases the verification of the functorial properties is easy.

Example C2.17 Let k be a field. Consider the category \mathcal C of finite separable extensions of k with k-linear field homomorphisms as morphisms. We can define a contravariant functor F from \mathcal C to \mathbf{Grp}, the category of groups with group homomorphisms as morphisms, in the following manner: For an object L \in \mathrm{Obj}(\mathcal C), set F(L)=L^\times and for a (necessarily injective) morphism f:L \to M, define F(f) to be the field norm N_{M/L}:M^\times \to L^\times. The transitivity formula for norms in towers translates into functoriality of this construction: For a tower of extensions L \subset M \subset N we have N_{N/M} \circ N_{M/L}=N_{N/L}.
A similar construction works for the field trace.

Example C2.18 Consider the category  of compact Hausdorff spaces with continuous maps as morphisms. For any compact Hausdorff space X, the continuous functions X \to \mathbb{C} form a C*-algebra with pointwise operations (i.e. addition, multiplication, scalar multiplication and conjugation), denoted by C(X). If X and Y are compact Hausdorff spaces and f:X \to Y is a continuous map, then we can define a homomorphism of C*-algebras by pulling back continuous functions along f: for a continuous function g: Y \to \mathbb C, g \circ f is a continuous function X \to \mathbb C. We obtain a contravariant functor from the category of compact Hausdorff spaces to the category of commutative unital C*-algebras.

Example C2.19 As in the examples C2.4 and C2.5, if G is a group, considered as a one-object category and we let \mathcal C be the category of sets or the category of k-vector spaces for a field k, then contravariant functors correspond to right G-sets or right representations on vector spaces over k, respectively.

Example C2.20 The construction from C2.12 has a contravariant sibling. Let \mathcal C be any category and x \in \mathrm{Obj}(\mathcal C). Then we have for any object y in \mathcal C, a set \mathrm{Hom}_{\mathcal C}(y,x) and for a morphism f:y \to y', we get a map \mathrm{Hom}_{\mathcal C}(y',x) \to \mathrm{Hom}_{\mathcal C}(y,x), g \mapsto g \circ f. This construction is a functor, called the contravariant Hom functor.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s