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.


  • 21
    $\begingroup$ 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. $\endgroup$ – 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.

| cite | improve this answer | |
  • $\begingroup$ I always wondered... Thanks for illuminating. $\endgroup$ – MathematicalOrchid May 7 '12 at 9:32
  • $\begingroup$ Could you give an example of how the first can be violated? I'm having trouble seeing how that can ever be false, regardless of the mapping. $\endgroup$ – Fred Frey Jun 14 '19 at 13:45
  • 1
    $\begingroup$ @FredFrey The "identities are preserved" rule? Consider the category with exactly one object $A$ and exactly one non-identity arrow $a$, with $a \circ a = a$. Then the mapping which sends $A$ to $A$, and sends both $\text{id}_A$ and $a$ to $a$, fails to preserve identities, but satisfies the other two rules. $\endgroup$ – Tanner Swett Aug 2 '19 at 20:53
  • $\begingroup$ 1. Does $f\circ\mathrm{id}_A$ mean "the composition of $f$ and $\mathrm{id}_A$"? 2. Does the $\cdot$ in $g\in\hom(\cdot,A)$ mean "any object?" $\endgroup$ – jchook Sep 2 '19 at 0:06
  • 1
    $\begingroup$ @jchook Yes. ${}$ $\endgroup$ – anon Dec 9 '19 at 20:44

A simpler explanation:

Functions map arguments to values while functors map arguments and functions defined over the arguments to values and functions defined over the values, respectively.

Moreover, the functor mappings preserve function composition over the functions on arguments and values.

Briefly, functions map element while Functors map systems (=elements+functions over them).

| cite | improve this answer | |
  • 1
    $\begingroup$ Sorry to be an old meanie, but this answer is at best vague and at worst inaccurate, e.g. the morphisms of a category need not be functions. I'm not sure why you dug up a seven-year-old question to post this answer. $\endgroup$ – Clive Newstead Aug 2 '19 at 21:01
  • 3
    $\begingroup$ I wanted to put it in such a way that a person with no knowledge about categories would still get some feeling about the distinction. $\endgroup$ – Fibo Kowalsky Aug 2 '19 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.