# Covariance, contravariance and all that jazz

For the love of God, can someone explain to me the difference between functors of the form $\mathcal{C}^{\text{op}}\to \mathcal{D}$, $\mathcal{C}\to \mathcal{D}^{\text{op}}$ and $\mathcal{C}^{\text{op}}\to \mathcal{D}^{\text{op}}$?

I really do not understand how to tell what kind of functor an assignment gives: say that I know how a functor $F$ is defined on the objects and morphisms of a domain category $\mathcal{C}$, and I want to know its variance (is this a proper word?). Suppose that I do the usual thing, where I consider a morphism $f:A\to B$ in $\mathcal{C}$, and I find that $F(f)$ goes the other way, namely $F(f):F(B)\to F(A)$ in the target category $\mathcal{D}$. Is then $F$ a functor $\mathcal{C}^{\text{op}}\to\mathcal{D}$ or a functor $\mathcal{C}\to\mathcal{D}^{\text{op}}$?

• A contravariant functor $\mathcal C\to\mathcal D$ is a covariant functor is by definition a (covariant) functor $\mathcal C^{op}\to\mathcal D$. A functor $\mathcal C\to\mathcal D^{op}$ is a covariant functor from $\mathcal C$. These two functors are given by the same data, but the whole point of category theory is that domains and codomains of transformations actually matter and lead to non-trivial differences in the statements of results. – Vladimir Sotirov Jun 6 '16 at 5:23
• Yes, exactly, that's what I thought - which is why I was a bit skeptical about Henning Makholm's answer... – newincategories Jun 6 '16 at 5:56
• @Vladimir: If you're going to be super-pedantic, a contravariant functor is not a functor at all; instead, it is a different kind of gadget with a similar definition as functor, except you instead have the axiom $F(fg) = F(g) F(f)$. – Hurkyl Jun 21 '16 at 7:23
• Yes, but the point is that the correct casting back and forth from contravariant functor to covariant functors is done by oping the domain, not the codomain. – Vladimir Sotirov Jun 21 '16 at 16:05
• @Vladimir: "Correct" is too strong. "The usual convention" is more accurate. – Hurkyl Jun 21 '16 at 18:10

$-^{\rm op}$ is a self-inverse functor $\mathbf{Cat}\to\mathbf{Cat}$, so whenever you have an $F:\mathcal C\to\mathcal D$, you will also have $F^{\rm op}:\mathcal C^{\rm op}\to\mathcal D^{\rm op}$ simply by changing how you label things. In many contexts it doesn't even pay do distinguish strictly between $F$ and $F^{\rm op}$, and we can say they are simply two ways of looking at the same functor.

Since $-^{\rm op}$ is self-inverse, we have $(\mathcal C^{\rm op})^{\rm op}=\mathcal C$, so if we have $G:\mathcal C^{\rm op}\to\mathcal D$ we can also look at this as $G^{\rm op}:\mathcal C\to\mathcal D^{\rm op}$ -- and again there is often no need to distinguish strictly between these.

In sum, a covariant functor can be viewed either as $\mathcal C\to\mathcal D$ or as $\mathcal C^{\rm op}\to\mathcal D^{\rm op}$.

A "contravariant functor" from $\mathcal C$ to $\mathcal D$ is the same as an ordinary functor $\mathcal C^{\rm op}\to\mathcal D$ or $\mathcal C\to\mathcal D^{\rm op}$; these two descriptions are equivalent.

• Are $[\mathcal{C}^{\text{op}},\mathcal{D}]$ and $[\mathcal{C},\mathcal{D}^{\text{op}}]$ the same categories? – newincategories Jun 5 '16 at 14:33
• @newincategories: No -- they are opposites (the natural transformations go in the opposite directions). – Henning Makholm Jun 5 '16 at 14:41
• This is a misleading answer. The statements of major theorems about computing covariant functors extend to statements about contravariant functors only when you consider a contravariant functor as $\mathcal C^{op}\to\mathcal D$. – Vladimir Sotirov Jun 6 '16 at 5:07
• @VladimirSotirov: You're welcome to write your own answer where you explain what you think is right, instead of just denouncing something as wrong. Especially, it would it would be useful to have something concrete instead of nebulous descriptions such as "the statements of major theorems". You claim there are differences -- very well, show them, so a reader can know rather than have to trust one response over another! – Henning Makholm Jun 6 '16 at 7:00
• @VladimirSotirov: You seem to be better informed about these matters than I am. Why are you keeping your knowledge to yourself such that I and the OP both have to keep guessing about what the cases you're speaking about are? Again, I think you should write an answer setting things right instead of just complaining about things that are wrong. You're not giving any guidance to the reader either -- I have given all I have; if you have something to offer that is better than my answer, don't keep it to yourself! – Henning Makholm Jun 6 '16 at 11:15

The phrase "a functor from $\mathcal{C}^{op}$ to $\mathcal{D}$ is the same as a functor from $\mathcal{C}$ to $\mathcal{D}^{op}$" means that there exists an isomorphism of categories: $$[{\mathcal{C}^{op}},\mathcal{D}]\cong[{\mathcal{C}},{\mathcal{D}^{op}}]^{op}.$$ The phrase "a functor from $\mathcal{C}^{op}$ to $\mathcal{D}^{op}$ is the same as a functor from $\mathcal{C}$ to $\mathcal{D}$" means that there exists an isomorphism of categories: $$[{\mathcal{C}^{op}},\mathcal{D}^{op}]\cong[{\mathcal{C}},{\mathcal{D}}]^{op}.$$ You can find an exact description of such isomorphism in my answer. It's easy to obtain the first isomorphism from the second by replacing $\mathcal{D}$ to $\mathcal{D}^{op}$.

• The phrases still make sense even when the functor categories don't exist, so it cannot possibly mean there is an isomorphism of categories. Also, this does not at all address the original question of how to distinguish between the $\mathcal C^{op}\to\mathcal D$ and its opposite $\mathcal C\to\mathcal D^{op}$ except in misleadingly suggesting they are "the same". – Vladimir Sotirov Jun 6 '16 at 5:13
• @VladimirSotirov Seems that you are confused with the basic definitions of category theory. Functor categories always exist (but they may not be locally small). I also disagree with you second statement: I think my answer gives enough information to understand "all that jazz". Also I think that HenningMakholm's answer is also useful, and your cavils are useless. – Oskar Jun 6 '16 at 14:37
• @VladimirSotirov One very good reason for adopting Grothendieck's axiom of universes is that it allows one to make statements like the one in Oskar's answer, i.e. to replace vague statements like "a functor $\mathcal{C}^{\text{op}}\to\mathcal{D}$ is the same as a functor $\mathcal{C}\to \mathcal{D}^{\text{op}}$" with precise statements like "the functor category $[\mathcal{C}^{\text{op}},\mathcal{D}]$ is isomorphic to the opposite of the functor category $[\mathcal{C},\mathcal{D}^{\text{op}}]$". – Alex Kruckman Jun 12 '16 at 18:23
• On a larger scale, the same principle allowed Grothendieck to produce SGA without introducing technical caveats everywhere. Set theorists can give many other reasons for "believing in" a proper class of inaccessible cardinals, and much stronger hypotheses. The math speaks for itself! But even if you have qualms about adopting the axiom of universes, would you still take issue with Oskar's answer if it was edited to include the phrase "whenever these functor categories exist."? Perhaps it would be better to replace the phrase "means that" with "is justified because"? – Alex Kruckman Jun 12 '16 at 18:32
• @VladimirSotirov In my view, simply being determined by the same data is not enough to say (in a category theoretic context) that two objects are "the same". Rather, such a statement should be justified by some equivalence of categories. For example, given a poset $P$ with all finite meets, we may also regard $P$ as a semilattice. But while this poset and this semilattice are certainly determined by the same data, they are not "the same": the order-preserving maps out of $P$ (even to other posets with all finite meets) are different than the semilattice homomorphisms out of $P$. – Alex Kruckman Jun 13 '16 at 21:54

In your example, the answer is yes. Your functor can be viewed as a contravariant functor $\mathcal{C} \to \mathcal{D}$ or a covariant functor $\mathcal{C}^\text{op} \to \mathcal{D}$ or a covariant functor $\mathcal{C} \to \mathcal{D}^\text{op}$.

None of these is wrong, and you can view your functor in any of these ways.