In mathematics, specifically category theory, a functor is a mapping between categories. Functors were first considered in algebraic topology, where algebraic objects (such as the fundamental group) are associated to topological spaces, and maps between these algebraic objects are associated to continuous maps between spaces. Nowadays, functors are used throughout modern mathematics to relate various categories. Thus, functors are important in every area of mathematics where category theory is applied. The words category and functor were borrowed by mathematicians from the philosophers Aristotle and Rudolf Carnap, respectively. The latter used functor in a linguistic context; see function word.
Definition
Let C {\displaystyle C} and D {\displaystyle D} be categories. A functor F {\displaystyle F} from C {\displaystyle C} to D {\displaystyle D} is a mapping that:
associates each object X {\displaystyle X} in C {\displaystyle C} to an object F ( X ) {\displaystyle F(X)} in D {\displaystyle D} , associates each morphism f : X → Y {\displaystyle f:X\to Y} in C {\displaystyle C} to a morphism F ( f ) : F ( X ) → F ( Y ) {\displaystyle F(f):F(X)\to F(Y)} in D {\displaystyle D} such that the following two conditions hold:
F ( i d X ) = i d F ( X ) {\displaystyle F(\mathrm {id} _{X})=\mathrm {id} _{F(X)}\,\!} for every object X {\displaystyle X} in C {\displaystyle C} ,
F ( g ∘ f ) = F ( g ) ∘ F ( f ) {\displaystyle F(g\circ f)=F(g)\circ F(f)} for all morphisms f : X → Y {\displaystyle f:X\to Y\,\!} and g : Y → Z {\displaystyle g:Y\to Z} in C {\displaystyle C} . That is, functors must preserve identity morphisms and composition of morphisms.
Covariance and contravariance
There are many constructions in mathematics that would be functors, except that they "turn morphisms around" and "reverse composition". We then define a contravariant functor F {\displaystyle F} from C {\displaystyle C} to D {\displaystyle D} as a mapping that
associates each object X {\displaystyle X} in C {\displaystyle C} with an object F ( X ) {\displaystyle F(X)} in D {\displaystyle D} , associates each morphism f : X → Y {\displaystyle f:X\to Y} in C {\displaystyle C} with a morphism F ( f ) : F ( Y ) → F ( X ) {\displaystyle F(f):F(Y)\to F(X)} in D {\displaystyle D} such that the following two conditions hold:
F ( i d X ) = i d F ( X ) {\displaystyle F(\mathrm {id} _{X})=\mathrm {id} _{F(X)}\,\!} for every object X {\displaystyle X} in C {\displaystyle C} ,
F ( g ∘ f ) = F ( f ) ∘ F ( g ) {\displaystyle F(g\circ f)=F(f)\circ F(g)} for all morphisms f : X → Y {\displaystyle f:X\to Y} and g : Y → Z {\displaystyle g:Y\to Z} in C {\displaystyle C} . Variance of functors (composite):
The composite of two functors of the same variance:
C o v a r i a n t ∘ C o v a r i a n t → C o v a r i a n t {\displaystyle \mathrm {Covariant} \circ \mathrm {Covariant} \to \mathrm {Covariant} }
… excerpt ends here. Continue reading the full article.


