A 2-category is a category \(C\) where the morphisms \(C(A,B)\) from one object \(A\) to another \(B\) form a category. That is, those morphisms are objects in some category, so there may be morphisms between the morphisms!
We often include some notion of "nontriviality" ("interesting-ness"), because any set forms a category: the objects are the elements and the morphisms are strict equality. This is called a "discrete" category because there are no morphisms between objects, and indeed it's a fairly trivial (aka boring) category because the only arrows are identity arrows. So when we say that something is a 2-category we generally mean that the category formed by the elements of \(C(A,B)\) is a bit more interesting (aka nontrivial) in some way.
Morphisms between morphisms in a 2-category are called 2-cells, regular morphisms are called 1-cells, and the objects are called 0-cells. 2-cells are often drawn like this:
I often find that notation confusing, though, because it makes it seem like we just added some brand new thing to category theory, the arrows-between-arrows. In reality, it's just that there are two different categories, and one has some morphisms, and the other has those morphisms as its objects. So there's nothing fundamentally new going on here.
Notice that 2-cells don't go across homsets. That is to say, they cannot do this:
This is not a valid 2-cell! It crosses from \(C(X,Y)\) to \(C(Z,W)\), instead of staying in one or the other. 2-cells are only stuck within the same homset.
The most famous 2-category is \(\texttt{Cat}\), the category of small categories. The objects are small categories, the morphisms are functors, and the 2-cells are natural transformations.
Obviously here it's a little silly to use the term "homset," because we've just established that these collections of morphisms are now categories, not sets. The term "homcategory" comes up sometimes, but 2-categories are an example of "higher category," where you generally advance to the term "hom-object." A hom-object is an object of some category, so small 1-categories have hom-objects in the category of sets \(\texttt{Set}\), and 2-categories have hom-objects in the category of categories \(\texttt{Cat}\). In higher category theory, we say that a category is "enriched" over the category of its hom-objects, so good ol'-fashioned categories are \(\texttt{Set}\)-enriched, and 2-categories are \(\texttt{Cat}\)-enriched. Notice that \(\texttt{Set}\) is itself \(\texttt{Set}\)-enriched (enriched over itself!) and similarly \(\texttt{Cat}\) is \(\texttt{Cat}\)-enriched. It turns out that self-enrichment is just the same as having exponential objects! It's worth taking a moment to think about why that is, because it's simple and satisfying.
It's hopefully obvious that there are also 3-categories, 4-categories, and so on. These have 3-cells, 4-cells, etc. \(\infty\)-categories have no limit to the depth of arrows-between-arrows-between-etc. However, I'm simplifying a lot here and they're a kind of fuzzy concept, meaning things get very technical and advanced when talking about them. It's beyond my category-theory level!
Note that the category of 1-categories (which is \(\texttt{Cat}\)) is a 2-category; the category of 2-categories is a 3-category and this pattern continues indefinitely.
© 2024 Ryan Brewer.