# Examples of contravariant functors

I understand the definition and usefulness of the notion of functor.

But I am worrying about the usefulness of the notion of a contravariant functor. Wikipedia writes:

There are many constructions in mathematics that would be functors but for the fact that they "turn morphisms around" and "reverse composition". We then define a contravariant functor [...]

But why do they "turn morphisms around", wouldn't it be easier to do the same without the inversion of morphisms and composition?

So I guess it would be beneficial for me to know some examples of naturally occuring contravariant functors. So let me ask: what are some constructions in mathematics that naturally occur as contravariant functors instead of covariant functor?

In linear algebra, taking the dual of a vector space is a contravariant functor from the category of vector spaces to itself : given a linear map $$f:V\to W$$, you get an induced map $$f^*:W^*\to V^*:\varphi\mapsto \varphi\circ f$$ between the dual spaces, and you can easily check that the identities $$(id_V)^*=id_{V^*}$$ and $$(g\circ f)^*=f^*\circ g^*$$ always hold. This is actually the first example of a functor that appears in Eilenberg and MacLane's original paper!

In fact, this is a particular case of a general construction : given any category $$\mathcal{C}$$, every object $$X$$ defines a functor $$\operatorname{Hom}(\_,X):\mathcal{C}\to \mathbf{Set}$$ that takes an object $$Y$$ to $$\operatorname{Hom}(Y,X)$$ and a morphism $$f:Y\to Z$$ to the function $$f^*:\operatorname{Hom}(Z,X)\to \operatorname{Hom}(Y,X):g\mapsto g\circ f.$$ Dual vector spaces correspond to the case where $$\mathcal{C}$$ is the category of vector spaces over some field $$k$$ and $$X=k$$.

Moreover, in this answer I gave the contravariant powerset functor as another example; this is not quite of the form described above, but almost. In fact the correspondence between subsets of a set $$Y$$ and their characteristic functions defines a natural isomorphism between the contravariant functor $$\operatorname{Hom}(\_,\{0,1\})$$ and the contravariant powerset functor.

• As a small addition to this answer, it is sometimes also interesting to consider situations where $X$ is not an element of $\mathcal C$ itself, but of a category of which $\mathcal C$ is a (full) subcategory; for instance, when $\mathcal C$ consists of compact Hausdorff spaces and $X = \mathbb R$. – Mees de Vries Apr 25 '19 at 13:30

Let $$R$$ be a ring and $$M$$ be a left $$R$$-module. Then the functor $$F={\rm Hom}_R(\cdot, M)$$ is a contravariant functor from the category of $$R$$-modules to the category of abelian groups. Switching sides, the functor $${\rm Hom}_R(M,\cdot)$$ is covariant.

• I unfortunately don't see why this should be something that is naturally occuring. – user401895 Apr 25 '19 at 13:24
• @user7280899 Hom is the first nontrivial example of a functor most people learn. – Kevin Arlin Apr 25 '19 at 20:53
• And it appears naturally for homology and cohomology, i.e., both covariant and contravariant versions. – Dietrich Burde Apr 26 '19 at 7:45

I'm surprised to see nobody has given the answer that contravariant functors are actually equivalent to covariant ones. A contravariant functor of domain $$C$$ is just a covariant functor of domain $$C^{\mathrm{op}}$$. So they're really the same notion. That said, if you then ask why anybody cares about $$C^{\mathrm{op}}$$ then the answers are essentially the same as those already given.

To expand on the other answers: cohomology is another natural example of a contravariant functor. Even more elementarily, this generalizes the fact that differential forms on a smooth manifold, or just an open set in Euclidean space, are contravariant with respect to the usual pullback of forms. And much of modern algebraic geometry is concerned with showing that certain contravariant functors (for instance, that sending a scheme $$S$$ to the set of $$S$$-parameterized families of projective varieties) are representable, that is, equivalent to appropriate contravariant Hom functors.

The $$\mathsf{Hom}$$ functor being contravariant in its first argument is definitely one of the most foundational ones from the perspective of category theory. Another pretty foundational example is the $$\mathsf{Sub}$$ functor which for any well-powered category, $$\mathcal C$$, is a functor $$\mathcal C^{op}\to\mathbf{Set}$$ (or, better, $$\mathcal C^{op}\to\mathbf{Poset}$$ where $$\mathbf{Poset}$$ is the category of partially ordered sets and monotonic functions). $$\mathsf{Sub}$$ takes an object to its (po)set of subobjects. Its action on arrows is a bit more complex. Given an arrow $$f:X\to Y$$ and a monomorphism $$m:U\rightarrowtail Y$$ representing a subobject, $$\mathsf{Sub}(f)(m)$$ is the second projection of the pullback of $$f$$ and $$m$$, usually written like $$f^*(m)$$. In diagrammatic form: $$\require{AMScd}\begin{CD}U\times_Y X@>f^*(m)>> X \\ @VVV @VVfV \\ U @>>m> Y\end{CD}$$ For $$\mathbf{Set}$$, this works out to be essentially the inverse image of $$f$$, i.e. $$\mathsf{Sub}(f)(U) = f^{-1}(U)$$. Clearly, $$f^{-1}$$ goes the opposite direction as $$f$$.

When the category has a subobject classifier, $$\Omega$$, then the two scenarios coincide, i.e. $$\mathsf{Sub}\cong\mathsf{Hom}(-,\Omega)$$. In $$\mathbf{Set}$$, this is just to say we can identify a subset with its characteristic function and then the inverse image of $$f$$ corresponds to simply pre-composing the characteristic function representing the input subset with $$f$$. In symbols, $$\chi_{f^{-1}(U)}=\chi_U\circ f$$ where $$\chi_U : X\to\Omega$$ represents the characteristic function that identifies $$U\subseteq X$$. (In $$\mathbf{Set}$$, $$\Omega=1+1$$.)