What is a Category? Definition and Examples

As promised, here is the first in our triad of posts on basic category theory definitions: categories, functors, and natural transformations. If you're just now tuning in and are wondering what is category theory, anyway? be sure to follow the link to find out!

Category theory takes a bird's eye view of mathematics. From high in the sky, details become invisible, but we can spot patterns that were impossible to detect from ground level.
- Tom Leinster

         

What is a category?

A category C consists of some data that satisfy certain properties:

The Data

  • a class of objects, x,y,z,
  • a set* of morphisms between pairs of objects; xfy means "f is a morphism from x to y," and the set of all such morphisms is denoted homC(x,y)
  • a composition rule: whenever the codomain of one morphism matches the domain of another, there is a morphism that is their composition, i.e. given xfy and ygz there is a morphism xgfz.

The Properties

  • Each object x has an identity morphism xidxx which satisfies idyf=f=fidx for any xfy.
  • The composition is associative: (hg)f=h(gf) whenever xfygzhw.

Here's a picture of a category with four objects--depicted as bold dots instead of letters--and some morphisms between them. The gray arrow at each object indicates its identity morphism.

Last time I listed a few examples of categories but never provided the proofs. To make sure you're comfortable with the definition, try proving a few of them. For example, to form the category of groups, we declare the objects to be groups and the morphisms to be group homomorphisms. But we should check: is the composition of two group homomorphisms another group homomorphism? (Or is it merely a function?) Is this composition associative? And is the identity function from a group to itself a group homomorphism? (Or, again, is it merely a function?)

I also mentioned briefly that every poset (a set with a binary relation that is reflexive, transitive, and antisymmetric) is a category. This turns out to be a useful example, so let's be explicit.

Example #1: a poset

Every poset P forms a category. The objects are the elements of P and there is a morphism xy whenever xy.         

Composition holds because of transitivity: if xy and yz then xz.          

The identity-morphism property holds because of reflexivity: xx is always true. Therefore there is an arrow xidxx satisfying fidx=f for any morphism f,          

and similarly idyf=f.         

Associativty holds too. (What would the picture for this look like?) In particular, we've just shown that Z,Q, and R are all categories! We could have deduced this from the next example as well.

Example #2: a group

Every group G can be viewed as a category---called BG (for cool reasons)---with a single object which we'll denote by . There is a morphism g for each element gG, and composition holds since G is closed under the group operation. That is, if g,hG so that gh are two composable morphisms, then there is a third morphism hg that is their composition, namely the one corresponding to the element hgG. Finally, the group identity eG serves as the identity morphism for , and associativity holds because the group operation is associative.        

Example #3: new categories from old ones

A very natural question that you might ask upon discovering new mathematical ideas is How can I construct new objects from given ones?** In particular one could ask, How can I make a new category from old ones? There are several ways to go about this. Given two categories C and D, you might try defining their product C×D. (This paves the way for monoidal categories.) What do you think the objects in C×D should be? The morphisms?

 Additionally, every category C has an opposite category Cop. The only difference between a category and its opposite is the direction in which the arrows/morphisms point. That is, the objects in Cop are exactly the same as objects in C, but there is a morphism xy in Cop whenever there is morphism yx in C. (Check that Cop really does satisfy the definition of a category.) In other words, homCop(x,y)=homC(y,x).           

Another example of a category formed from existing ones is  Cat. Here, the objects are categories*** C,D,E,F,, and the morphisms between them are functors. I'm jumping the gun a bit on this one since I haven't defined functors on the blog yet, but I think it's worth a mention. As we discussed last time, it's helpful to think of a morphism/arrow as a relationship between its domain and codomain. So naturally, we might take interest in relationships, i.e. functors, between categories.

You can also construct a new category DC from given categories C and D by declaring the objects to be functors F:CD. (The notation DC is quite suggestive.) Here a morphism between two functors F:CD and G:CD is a natural transformation, often denoted by a double arrow FG. In the special case when D=Set, the objects of SetCop are given the name presheaves. Again, I'm jumping the gun here, but I expect these examples to resurface later on the blog, so now is a good time to mention them.

We'll chat about functors next week and natural transformations the following week. I encourage you to revisit Example #3 once you're familiar with these notions.    

Until next week!  

 *A category C where for all objects x,y, homC(x,y) is small enough to be an honest-to-goodness set is called a locally small category. In other words, a category is locally small if there aren't too many morphisms between the objects. Most of the categories you're familiar with--Set,Top,Group, etc.--are locally small. In future posts, let's always assume our categories have this property, unless otherwise stated.

**For instance, the intersection of sets is another set, the direct product of groups is another group, the tensor product of vector spaces is another vector space, the product of compact topological spaces is another compact topological space, and so on.

***For size considerations, the categories in Cat are assumed to be small. A category C is called small if it doesn't contain too many objects and if there aren't too many morphisms between those objects, i.e. if both ob(C) (all the objects in C) and homC(x,y) are honest-to-goodness sets.

Share
Related Posts
Leave a comment!