# Functors and Natural Transformations!

Hello again!  Last time I got to talking about these mathematical things called “categories.”  If you’ve ever taken a class in higher math, whatever that means,  you should know by now that whenever we define a new mathematical object, the next step is to define what it means to talk about “functions” between them.  In abstract algebra, these are our “- homomorphisms;” in topology, our continuous functions, etc.  You get the idea.  What would it mean to then talk about a “structure-preserving function” between two categories, say and D?  Remember, we have to deal with the objects AND the morphisms in both categories.  A “function” from C to D should therefore send objects of C to objects of D, and morphisms in C to those in D.  Obviously, these “functions” of objects and arrows can’t be completely independent of each other.  If they’re going to be useful in any way (i.e. preserve stuff like function composition and things like the identity map).

Cutting to the chase, these categorical functions are called functors.  You’ve actually probably seen these before (if you’re a math/ physics major/ person who has played with abstract algebra).  Let’s play around in groups (i.e. Grp).  Recall that a group is a set with a certain operation defined on it, and that group homomorphisms are set functions that respect the group operations of the domain and codomain.  Thus for each group $G$, we can associate the set $U(G)$ which is just the underlying set of $G$.  Similarly, we can associate to every group homomorphism $\varphi: G \to H$ the set function $U(\varphi) : U(G) \to U(H)$.  For example, if we take $G = \mathbb{Z}/3\mathbb{Z} = \{0,1,2\}$ (technically I should write these as cosets, but it’s all the same up to isomorphism anyway), the cyclic group of order 3, Then $U(G) = \{0,1,2\}$.  Clearly, if $f_1 : G \to H$ and $f_2 : H \to K$ are two group homomorphisms, it follows that $U(f_2 \circ f_1) = U(f_2) \circ U(f_1)$, so that $U$ respects “compositions of arrows.” Also, remember those identity maps for every object?  If $G$ is any group and $1_G: G \to G$ the identity homomorphism, $U(1_G) = 1_{U(G)}$, so that $U$ respects the identity map.  Thus $U$ is a pretty convenient thing.

Now specifically, a (covariant) functor $F: \textbf{C} \to \textbf{D}$ associates to every object $a$ of C an object $F(a)$ of D, and to every morphism $f: a \to b$ of a morphism $F(f)$ of D.  Furthermore, we need to have for every pair of composable morphism $f$ and $g$ of C, $F(f \circ g) = F(f) \circ F(g)$.   Lastly, for every object $a$ in we have $F(1_a) = 1_{F(a)}$.  We say that $F$ is contravariant if (for the same $f$ and $g$ in the last sentence) $F(f \circ g) = F(g) \circ F(f)$.

Sooo now that we have this definition, it’s immediate that the “function” $U : \textbf{Grp} \to \textbf{Set}$ is a covariant functor, which is called the underlying set functor or the forgetful functor (which is a much cooler name, let’s be honest).   One can, of course, do the same thing for the category of rings, of topological spaces, etc.

Some other interesting examples are

• The fundamental group functor $\pi_1: \textbf{Top}_\cdot \to \textbf{Grp}$ that sends each pointed topological space $(X,x_0)$ to its fundamental group $\pi_1(X,x_0)$.  If $f: (X,x_0) \to (Y,y_0)$ is a continuous (basepoint preserving) function, then $\pi_1(f) = f_*$ is just the pushfoward map, i.e. it sends loops $\gamma$ in $X$ based at $x_0$ to loops $f \circ \gamma$ in $Y$ with basepoint $y_0 = f(x_0)$.
• The dual vector space functor $D : \textbf{Vect}_F \to \textbf{Vect}_F$ that sends each vector space (over some field $F$ to its algebraic dual $\text{Hom}_F(V,F)$.  If $\varphi : V \to W$ is a linear transformation, then $D(\varphi) = \varphi^*$ is the linear transformation that sends each functional $f: V \to F$ to $\varphi^*(f) = f \circ \varphi$.

You can even compose functors, if the source/ target categories match up.  As an example, if $D$ is the dual space functor from above, the functor $D^2 = D \circ D: \textbf{Vect}_F \to \textbf{Vect}_F$ sends each vector space to its double dual.

As mathematicians are wont to do, whenever we define some kind of mathematical object, the next step is (just about always) to define some concept of morphisms between them.  E.g. groups and group homorphisms, smooth manifolds and smooth maps, topological spaces and continuous functions, etc.  So now suppose we have two functors $F,G : \textbf{C} \to \textbf{D}$ between two categories C and D.  We say that $\eta : F \rightsquigarrow G$ (always use the squiggle arrow, it’s much cooler) is a natural transformation if for every object $a$ in Ob(C) there is a function $\eta_a: F(a) \to G(a)$ such that for any morphism $f: a \to b$ in C, $\eta_b \circ F(f) = G(f) \circ \eta_a$

This is best shown with a commutative diagram (I guess I’ll have to do a post on those at some point too…).  Those maps $\eta_a$ are called the components of the natural transformation.  If all the $\eta_a$ are isomorphisms, then we say that $\latex \eta$ is a natural isomorphism.

So I feel obliged to make a quick remark here. People often say that abstract algebra (and category theory) are especially hard because there are just sooo many definitions to remember.  This is in fact the case. Suck it up.  Reading a sophisticated piece of work requires a large vocabulary, regardless of the discipline.

If you think about it, for any category C, there is an identity functor that just sends every object to itself and every morphism to itself.  Usually, people just write this as $Id: \textbf{C} \to \textbf{C}$ or as $I : \textbf{C} \to \textbf{C}$.

Ever heard that any (finite dimensional) vector space is naturally isomorphic to its double dual?  What’s really going on here is that there is a natural isomorphism of functors $\delta : Id \rightsquigarrow D^2$ on the full subcategory (of all vector spaces over a field F) of finite dimensional vector spaces over that field.  Here, the components of the natural transformation for any vector space $V$, $\eta_V : V \to V^{**}$ is that linear transformation that sends $V \ni v \mapsto v^{**}(f) = f(v) \in V^{**}$ (where $f: V \to F$) is a linear functional).  Just a bit of works shows that this is actually an isomorphism.

Stepping up the abstraction (again):

So we’ve defined functors, natural transformations, and categories.  We can actually go pretty meta and define categories like “the category of (small) categories” (I’ll define small at some other time; it’s a technical condition that let’s us get around things like Russell’s Paradox), and things like “the category of functors between two categories, functors which are paired in a really useful way (an adjunction), etc.  There’s a ton to explore.