# There are two types of functors; covariant and contravariant. Is it right?

In the category theory, there are lots of functors between the categories. I thought that however each functor must be either covariant or contravariant, for instance, the identity functor is covariant. But the following example made me confused;

Let $\mathfrak C$ be any category. Consider the functor that assigns to each pair $\left(A, B\right)$ of objects of $\mathfrak C$ the set hom$_\mathfrak C\left(A, B\right)$ and to each pair of motphisms $f : A\rightarrow A', g : B\rightarrow B'$ the function hom$\left(f, g\right) :$ hom$_\mathfrak C\left(A', B\right)\rightarrow$ hom $_\mathfrak C\left(A, B'\right)$ given by $h \mapsto ghf$. Then hom$_\mathfrak C \left(-, -\right)$ is a functor of two variables from $\mathfrak C$ to the category $\mathfrak S$ of sets, contravariant in the first variable and covariant in the second.

Is this functor either covariant or contravariant? or is it wrong?

Let's say that if you wish to take the distinction between co and contravariant functor then you have to accept that there are some functor (like the $\hom$-functors) that aren't either co or contravariant in absolute sense.

Anyway the truth is that there's no real distinction between co and contravariant functor, because every functor is just a covariant functor.

More in details a contravariant functor $\mathcal F$ from a category $\mathbf C$ to a category $\mathbf D$ is nothing more than a (covariant) functor of type $\mathcal F \colon \mathbf C^\text{op} \to \mathbf D$, from the opposite category of $\mathbf C$ to the category $\mathbf D$. You can easily see that trying to unravel the classical definition of contravariant functor and that of a functor that goes from an opposite category of a given category. You'll see that the definitions are the same.

Edit: after the comment of the OP below I suppose is necessary to give some additional info.

Every functor (co or contravariant) has a unique source category and a unique target category. In general the distinction between covariant and contravariant is primarily concerend in the fact that while the first one preserve the orientation of morphisms the other one reverse.

So to answer the question whether the $\hom$-functor is co/contravarint one has to identify its source category, if this source category is $\mathbf C \times \mathbf C$ (the product category) then the $\hom$-functor is neither co or contravariant because it preserves the direction of the morphism in one component but reverses it in the other component.

Of course if you see $\hom$ as a functor from the category $\mathbf C^\text{op} \times \mathbf C$ then it become covariant, if you see it as a functor from $\mathbf C \times \mathbf C^\text{op}$ it's contravariant.

End Edit.

Hope this helps.

• The ex I gave can be considered as a co functor? – user112018 Feb 3 '14 at 13:20
• I agree with Giorgio. Actually there are no contravariant functors, every functor is covariant. – Martin Brandenburg Feb 3 '14 at 13:31
• @user112018 I've added an Edit, let me know if that solves your doubts. – Giorgio Mossa Feb 3 '14 at 13:49
• In conclusion, my example is neither co nor contravariant, right? – user112018 Feb 3 '14 at 16:22
• @user112018 I guess so :) – Giorgio Mossa Feb 3 '14 at 18:33

Your example is a bifunctor $\hom_{\mathcal{C}}\left(-,-\right):\mathcal{C}^{op}\times\mathcal{C}\rightarrow\mathbf{Set}$.
For every object $A$ you have the covariant functors $\hom_{\mathcal{C}}\left(A,-\right):\mathcal{C}\rightarrow\mathbf{Set}$ and $\hom_{\mathcal{C}}\left(-,A\right):\mathcal{C}^{op}\rightarrow\mathbf{Set}$.
You can also look at functor $\hom_{\mathcal{C}}\left(-,A\right):\mathcal{C}\rightarrow\mathbf{Set}$ as a contravariant functor.
• @user112018 Of course it makes sense : $\mathcal C^{\mathrm op} \times \mathcal C$ is a perfectly common category and you can treat it likewise. – Pece Feb 3 '14 at 13:38
• The bifunctor mentioned in my answer is covariant. I used the term bifunctor just to emphasize that there are $2$ arguments, but you can also just call it a functor having pairs as argument. Looking at it like that it is a covariant functor. – drhab Feb 3 '14 at 14:01