# What is a Functor? Definition and Examples, Part 1

/Next up in our mini series on basic category theory: functors! We began this series by asking *What is category theory, anyway?* and last week walked through the precise definition of a category along with some examples. As we saw in example #3 in that post, a functor can be viewed an arrow/morphism between two categories.

...every sufficiently good analogy is yearning to become a functor.

- John Baez

## What is a functor?

### The Data

- an object $F(x)$ in $\mathsf{D}$ for every object $x$ in $\mathsf{C}$
- a morphism $F(x)\overset{F(f)}{\longrightarrow}F(y)$ in $\mathsf{D}$ for every morphism $x\overset{f}{\longrightarrow}y$ in $\mathsf{C}$

### The Properties

- $F$ respects composition, i.e. $F(g\circ f)=F(g)\circ F(f)$ in $\mathsf{D}$ whenever $g$ and $f$ are composable morphisms in $\mathsf{C}.$
- $F$ sends identities to identities, i.e. $F(\text{id}_x)=\text{id}_{F(x)}$ for all objects $x$ in $\mathsf{C}.$

## Example #1: a functor between groups

To start, it must send the single object $\bullet$ of $\mathsf{B}G$ to the single object $\bullet$ of $\mathsf{B}H$. Moreover, any morphism $\bullet$ $\overset{g}{\longrightarrow}$ $\bullet$, which, you'll remember, is just a group element $g\in G$, must map to a morphism $\bullet$ $\overset{F(g)}{\longrightarrow}$ $\bullet$. That is, $F(g)$ must be an element of $H$. The composition property requires that $F(g\circ g')=F(g)\circ F(g')$ for all group elements $g,g'\in G$. And finally, if $e$ denotes the identity morphism on $\bullet$ (i.e. the identity element in $G$), then we must have $F($$e$$)$=$e$ where $e$ is the identity morphism on $\bullet$ (i.e. the identity element in $H$).

So what's a functor $F:\mathsf{B}G\to\mathsf{B}H$? It's precisely a group homomorphism from $G$ to $H$!

*functor*is just a

*function*(which happens to be compatible with the group structure). But what if the domain/codomain of a functor has more than one object in it?

## Example #2: the fundamental group

*fundamental group of $X$*, and which sends every continuous function $X\overset{f}{\longrightarrow}Y$ to a group homomorphism $\pi_1(X)\overset{\pi_1(f)}{\longrightarrow}\pi_1(Y)$.

*functorial*allows you to prove cool things like Brouwer's fixed point theorem. For instance, see the proof of Theorem 1.3.3 here.

Now it turns out that

*the fundamental group is an invariant of a topological space.*In other words, if $X$ and $Y$ are homeomorphic spaces then their fundamental groups are isomorphic. (Even better, this sentence is still true if we replace "homeomorphic" by "homotopic" which is a slightly weaker notion of "sameness.") This gives us a handy way to distinguish spaces: if $X$ and $Y$ have

*non*isomorphic fundamental groups, then $X$ and $Y$ are guaranteed to be topologically

*different*.

(Actually, there's nothing special about the number 1 here. For each $n\geq 1$, there is a functor $\pi_n:\mathsf{Top}\to\mathsf{Group}$ that sends $X$ to $\pi_n(X)$ which is again, informally, the group whose elements are maps of the $n$-dimensional sphere into $X$. The groups $\pi_n(X)$ for $n>1$ are called the higher homotopy groups of $X$. And when $X$ is a sphere, cool and spooky things happen.)

In practice it can be helpful to think of a functor $F:\mathsf{C}\to\mathsf{D}$ as encoding an invariant of some sort.

*isomorphic:*

In any category, a morphism $x\overset{f}{\longrightarrow}y$ is said to be an **isomorphism** if there exists a morphism $y\overset{g}{\longrightarrow}x$ so that $g\circ f=\text{id}_x$ and $f\circ g=\text{id}_y$.

*isomorphisms,*and so on.** So we can rephrase the above more formally: "If $f$ is an isomorphism between $x$ and $y$ then $F(f)$ is an isomorphism between $F(x)$ and $F(y)$." (The proof isn't tricky - it follows directly from the definitions!)

Or, to put it simply,

*functors preserve isomorphisms*.

Stay tuned!

*Technically, they are *pointed* topological spaces, i.e. spaces where you declare a certain point, called a *basepoint*, to be special/distinguished. So really, $\pi_1$ is from $\mathsf{Top}_*$ to $\mathsf{Group}$ where $\mathsf{Top}_*$ denotes the category of pointed spaces with basepoint-preserving maps as morphisms.

**Fun fact: Categories in which every morphism is an isomorphism are given a special name: **groupoids**. (Can you guess why?) Every group, then, is precisely a one-object groupoid. And *yes!* The fundamental groupoid of a topological space is a thing! Perhaps we'll chat about it in a future post....