Categories

Motivation

Serge Lang

In the forties and fifties (mostly in the works of Cartan, Eilenberg, MacLane, and Steenrod), it was realized that there was a systematic way of developing certain relations of linear algebra, depending only on fairly general constructions which were mostly arrow-theoretic, and were affectionately called abstract nonsense by Steenrod.

My source: Riehl

Perhaps the purpose of categorical algebra is to show that which is trivial is trivially trivial.

It is likely you were unwittingly exposed to mathematical categories long before you first heard the words "category theory." Real vector spaces and their linear transformations? That's a category. Groups and their group homomorphisms? A category. Rings, fields, or topological spaces (and the "appropriate" maps between them)? All categories.

At the most intuitive level, a mathematical category simply consists of "stuff" (usually mathematical objects with prescribed algebraic structures) and the "maps" between them (usually, but not always, set maps that respect those algebraic structures). Category theory, then, can be thought of as a mathematical language that is broadly applicable across algebra, topology, set theory, logic, and beyond. This is part of what gives category theory its power, namely its ability to universally describe constructions and ideas across different mathematical disciplines. It brings under a single umbrella the study of sets (with their set maps), vector spaces (with their linear transformations), groups (with their homomorphisms), and topological spaces (with their continuous maps), just to name a few.

Category theory studies objects (e.g., groups) and the arrows between them (e.g., homomorphisms). Every general result of category theory is a result that can be interpreted and used in your favorite category. There are maps between categories, called functors, which allow us to connect categories to each other; and there are maps between functors, called natural transformations, which can provide deep insights into fundamental mathematical constructions (e.g., free groups) and operations (e.g., tensor products).

There is a second, less obvious benefit to studying category theory that I personally feel is even more profound. Thinking categorically can push us to embrace new, abstract ideas that we might initially find unintuitive, but which eventually provide incredible new insights. These insights and lessons are sprinkled throughout these notes. Keep your eyes peeled for them!

Formal definitions

Any formal definition of category is admittedly a bit clunky, so remember the general idea: you have objects, and you have arrows between those objects.

Definition of category

A category consists of the following data:

  • A collection[1] of objects

  • A collection of arrows

  • For each arrow, specified domain and codomain objects. The notation f:ab signifies that f is an arrow with domain a and codomain b

  • For each object, a specified identity arrow. The notation 1a denotes the identity arrow 1a:aa for the object a

  • Any pair of arrows f,g with the codomain of f equal to the domain of g is called a composable pair. For each composable pair of arrows, there is a specified composite arrow with domain the domain of f and codomain the domain of g. We denote this composite arrow gf (or simply gf, if there is no cause for confusion)

    These data are subject to the following two axioms:

    1. (Identity) For any arrow f:ab, the composites 1bf and f1a are both equal to f.
    2. (Associativity) For any composable triple of arrows f,g,h, the composites h(gf) and (hg)f are equal.

Visualization

When we want to visualize categories it's useful to think of the objects as dots and the arrows as ... arrows. For example, we might visualize two objects a and b with some arrows between them as follows:

There are a few things to note. First, if this image is meant to represent an entire category, then it is implicitly assumed that all of the properties required to be a category hold. For example, there must exist an arrow corresponding to the composition hf (and similarly one for hg), and since there is evidently only one arrow from a to a in the image above, namely 1a, then we must have hf=1a (and also hg=1a).

That being said, it is much more common to draw a picture like the above to represent a small "part" of a category, in which case we are not meant to assume that the only arrows between a and b are the ones shown. In that (common) case, we are simply visualizing some of the arrows in the category, leaving open the possibility of others. In that case, we would not assume that hf must equal 1a.

In all cases, it is common convention (mainly for our own sanity) to omit any arrows that must necessarily be in the category, per the definition of category. So we usually don't draw the identity arrows, nor do we draw the compositions of all composable arrows. We simply assume that those are all present. In our currently example, we might then simply sketch the following diagram:


For one final simplification, it is common to simplify the visual presentation of the objects, either by dropping their labels, or removing the dots, such as below:


More examples can be found here.

Conventions

The language and notation of category theory is not completely standardized, but here are some common conventions.

Abstract categories are sometimes denoted with a single capital script letter, such as C. In this case, the set of objects of the category is often denoted Ob(C). However, it is also common to simply use C to refer also to the set of objects, writing aC for an object a in the category C.

If there is no cause for confusion, it's reasonable (and common) to drop all pretension with script lettering and simply use capital letters to denote categories; e.g., the category C.

It is common to use the word morphism in place of "arrow." I will personally use "morphism" when working with known algebraic objects (such as groups or modules), as it harkens back to the word "homomorphism" that was (and regrettably still is) used in those contexts. However, for an abstract category I will stick to "arrow."

Given two objects a and b in a category C, the collection of arrows between them is usually denoted with some variation of Hom(a,b) or Mor(a,b). This derives from the alternative names of "homomorphisms" or "morphisms", noted above. The word "hom-sets" refers to such collections of arrows[2]. If there are multiple categories under consideration, we might more carefully denote hom-sets as HomC(a,b) or MorC(a,b). (I have seen some texts add an axiom to the definition requiring all hom-sets to be disjoint, but this doesn't seem to be universal and I don't understand the reason for making the assumption.)

Most (but not all) categories are named after their objects. For example, the category with objects all groups and with arrows all group morphisms is called "the category of groups" and is usually denoted with some variation of Group or Grp. More examples can be found here.

Set-theoretic issues

Optional warning

At the most fundamental and rigorous level, there are some technical logical issues that need to be addressed. This section briefly addresses those concerns, but this is nothing something we will worry about elsewhere.

When attempting to study all objects of a certain type, it is easy to run into set-theoretic issues along the lines of Russell's paradox. A common convention is to assume there is a big enough set U, called a universe, such that all sets one needs to discuss are members of the set U. A set X is then called small it is a member of the universe. A set that is not in the universe is called large. (Some sources instead use the language of sets and classes.)

Definition of small category

A category is small if its collection of arrows is a small set.

Since each object is uniquely associated with an identity arrow, in a small category the collection of objects is also a small set. Unfortunately, many of the common categories we encounter are not small, i.e., are large.

Definition of locally small

A category is locally small if for any pair of objects the collection of arrows between those objects is a small set.

Will we worry about any of this? We will not. Instead, we will embrace the following quote:

The search for the most useful set-theoretical foundations for category theory is a fascinating topic that unfortunately would require too long of a digression to explore. Instead, we sweep these foundational issues under the rug, not because these issues are not serious or interesting, but because they distract from the task at hand.

Examples

Examples are abundant! We begin with some really basic categories before discussing the (more complicated) categories you've likely encountered before.

A common convention with very "simple" categories is to simply sketch a visual representation of the category, with dots used to represent objects and arrows to represent ... arrows. It is also common convention not to draw the identity arrows, nor any arrows that are necessarily there by the composition assumption.


Some basic categories

The smallest possible category is the empty category, which has no objects or arrows. This category is usually denoted 0. It is the initial object in the category of categories.

The next smallest categories are the categories that have a single object. It is common to let 1 denote the category with exactly one object and one arrow (the identity arrow on that object).

Since there is a unique object and unique arrow (the identity arrow on that object), there's no point to even label them. However, if you were to label the object you might[3] label it as below:


With our convention of omitting identity arrows, we would visualize this category simply as

Note

There are lots of categories that have a unique object but many arrows. Such categories are in (natural) bijection with monoids.

Continuing the pattern above, the category denoted 2 is the category with two objects and exactly one non-identity arrow. Since identity arrows are not usually included when sketching visual representations of categories, a picture of the category 2 is

As one last basic example in this specific sequence of categories, the category 3 has three objects and the following non-identity arrows:

Note that arrow 13 is equal to the composition of the arrows 12 and 23.


Preorders

A preorder is a category P in which there is at most a single arrow between any two objects. We can then define a relation on the objects of P by saying pp if and only if there is an arrow pp in P. This relation is reflexive (identity arrows!) and transitive (composition of arrows). Each of the basic categories above (i.e., 0,1,2,3,) is a preorder.


Sets as categories

A category is discrete when every arrow is an identity arrow. In other words, it's basically just a set (of objects). For example, a discrete category with six objects might be visualized as below. As usual, the identity arrows are not shown.

On the other hand, for a given set X there is also an associated category (sometimes denote X) whose objects are the subsets of X, and where for each pair of subsets U and V of X (i.e., objects of X) there is a unique arrow UV exactly when UV. This category can be useful for understanding "internal constructions" in the set X, such as intersections and unions of subsets, in the language of category theory.

Note that both the discrete categories above, and categories such as X, are different from the (large) category Set, which has as objects all sets and as arrows all set maps. The association to each set X the corresponding category X is the object map of a functor from the category Set to the category Cat of categories.


Groups as categories

For a given group G one can associate a category G, which has a single object and exactly one arrow g: for each element gG. Moreover, the composition of arrows in the category G corresponds to the group operation in G.

For example, if G is a group with four elements (say G=Z4), then a picture of G might look like


Note here that I have chosen to include the identity arrow, since it corresponds to the identity element in G (and it feels weird leaving it out).[4]

The association to each group G the corresponding category G is the object map of a functor from the category Group to the category Cat.


Matrices over a fixed commutative ring

For each commutative ring R, the set of all matrices with entries in R is the arrow set of a category MatrR. The objects of this category are the positive integers, and each m×n matrix A corresponds to an arrow A:nm. Composition of arrows corresponds to matrix product.

For example, in the category MatrR of real matrices, the arrows 24 are in bijection with the 4×2 matrices with real entries, while the arrows (loops) 22 are in bijection with the (square) 2×2 matrices with real entries. The identity arrow on an object n corresponds to the n×n identity matrix. An illustration of how arrow composition matches with matrix product might be the following:


Note that composition is written algebraically right-to-left ("inside out"), so the composition of the two arrows above corresponds to the arrow labeled by the product of those matrices in the opposite (visual) order.

A rare case

This is the rare case of a category named after its arrows!

Opposite categories

For each category C, its opposite is the category Cop with the same objects as C and with all arrows "reversed." In other words, for each arrow f:cd in C there is a corresponding arrow fop:dc in Cop (and conversely).

Why consider such a category? We'll see.


Large categories

Most of the objects we encounter in math are the objects of some (large) categories. Below is a quick roundup of some with which you might already be familiar:

Category Objects Arrows
Set sets set maps (i.e., functions)
Set sets with selected base point base-point-preserving set maps
Cat categories functors
Mon monoids morphisms of monoids
Grp groups group homomorphisms
Ab abelian groups group homomorphisms
Ring rings (with unity) (unit-preserving) ring homomorphisms
CRing commutative rings (with unity) (unit-preserving) ring homomorphisms
R-Mod left modules over the ring R R-module homomorphisms
Mod-R right modules over the ring R R-module homomorphisms
Top topological spaces continuous maps
Toph topological spaces homotopy classes of maps
Top topological spaces with selected base point base point-preserving continuous maps

Suggested next note

Functors


  1. Here we use the word "collection" (as opposed to "set") to allow for set theory technicalities, such as a "class" of objects. For our purposes you can assume the objects of our categories form a set. ↩︎

  2. At least in the case these collections are sets. See below. ↩︎

  3. You'll shortly see why I labeled the object with a number, as opposed to a letter. ↩︎

  4. And I choose to denote the uique object with a star for flair. ↩︎