# what is the difference between functor and function?

As it is, what is the difference between functor and function? As far as I know, they look really similar.

And is functor used in set theory? I know that function is used in set theory.

Thanks.

-
A function assigns to every element of a set $X$ an element of a set $Y$. A functor assigns to every object of a category $C$ an object of a category $D$ and also assigns to every morphism in $C$ a morphism in $D$ in a way compatible with sources, targets, and composition. – Qiaochu Yuan May 7 '12 at 5:14

To elaborate on Qiaochu's comment:

• A set $X$, barren of additional structure, is comprised solely of elements $x\in X$. A function from one set to another merely sends elements of the first to elements of the second.
• A category $\cal C$ is comprised of a class of objects $\mathrm{ob}(\cal C)$, and between any two objects $A,B$ a class of morphisms (or "arrows") denoted $\hom(A,B)$. These classes can be "bigger" than sets too. The objects $A,B$ need not be distinct; there is always the identity morphism $\mathrm{id}_A\in\hom(A,A)$, which is defined so that $f\circ\mathrm{id}_A=f$ and $\mathrm{id}_A\circ g=g$ for any $f\in\hom(A,\cdot)$ and $g\in\hom(\cdot,A)$.

A (covariant) functor $F:\cal C\to D$ of categories sends objects of $\cal C$ to those of $\cal D$, and similarly morphisms in $\cal C$ to morphisms of $\cal D$, such that the following three hold true:

1. Identities are preserved: $F\,\mathrm{id}_A=\mathrm{id}_{FA}$.
2. Sources and targets are preserved: If $A\xrightarrow{f}B$, then $FA\xrightarrow{Ff}FB$.
3. Composition is preserved: If $A\xrightarrow{f}B\xrightarrow{g}C$, then $FA\xrightarrow{Ff}FB\xrightarrow{Fg}FC$.

Note that the functor sends an object $A$ to $FA$ and morphism $f$ to $Ff$; this is our given notational convention. Alternatively, the latter two may be stated non-diagramatically:

$~~$ 2. If $f\in\hom(A,B)$ then $Ff\in\hom(FA,FB)$.

$~~$ 3. If $f\in\hom(A,B)$ and $g\in\hom(B,C)$, then $F(g\circ f)=Fg\circ Ff$ inside $\cal D$. (Note the order.)

These properties ensure that commutative diagrams are preserved by functors. A *contra*${}$variant functor is defined similarly, except order of composition is reversed, ie $F(g\circ f)=Ff\circ Fg$ in $\cal D$.

So, like functions between sets, functors map the entities inside one category to another. The difference is that categories have more structure than sets, and indeed can be "bigger" than sets, and further that functors must preserve the internal structure of the categories.

-
I always wondered... Thanks for illuminating. – MathematicalOrchid May 7 '12 at 9:32