Category Theory Essentials
Introduction to Category Theory
Beyond Things to Connections
In many areas of math, we focus intensely on the details of individual objects. We might study the properties of a number, the elements of a set, or the structure of a geometric shape. Category theory takes a different approach. It steps back and looks at the bigger picture. Instead of focusing on what things are, it focuses on how they relate to each other.
The core idea is that the relationships, or maps, between mathematical objects are just as important as the objects themselves.
To do this, category theory provides a language for talking about systems of objects and the transformations between them. This system is called a category. A category is a collection of two basic things: objects and morphisms.
Object
noun
A fundamental entity within a category. It can be a set, a number, a shape, or any other mathematical concept.
Morphism
noun
A directed connection or transformation between two objects. It's often visualized as an arrow.
In the diagram above, , , and are objects. The arrow is a morphism from to , and is a morphism from to . We write this as and .
The Rules of the Game
A collection of objects and morphisms isn't a category just yet. It needs to follow two simple but crucial rules. These rules ensure that the system is coherent and well-behaved.
Rule 1: We must be able to compose morphisms.
If you have a path from object to , and another path from to , it makes sense that there should be a direct path from to . This direct path is called the composition of the two morphisms.
If we have and , their composition is a new morphism, written as , which goes directly from to .
The order might seem backward at first. We write , but we apply first, then . This matches the standard notation for function composition, like in .
Composition also has to be associative. If you're stringing together three or more morphisms, it doesn't matter how you group them. Composing and first, and then composing the result with , is the same as composing and first, and then composing with that result.
Rule 2: Every object must have an identity morphism.
For every object in the category, there must be a special morphism that starts and ends at without changing anything. This is the identity morphism, often written as or . It's like multiplying by 1 or adding 0; it's a "do nothing" operation.
When you compose any morphism with an identity morphism, you just get back. It's the equivalent of doing something, and then doing nothing (or vice versa).
And that's it. A category is simply a collection of objects and morphisms that satisfies the rules of composition and identity.
Categories in the Wild
This definition might seem very abstract, but categories are everywhere in mathematics. The power of category theory comes from recognizing that many different mathematical structures follow these same fundamental rules.
| Category | Objects | Morphisms |
|---|---|---|
| Set | Sets | Functions between sets |
| Grp | Groups | Group homomorphisms |
| Top | Topological spaces | Continuous functions |
| Vect | Vector spaces | Linear transformations |
Let's check the rules for Set, the category of sets. The objects are sets, and the morphisms are functions.
- Composition: If you have a function from set to set , and a function from set to set , you can definitely compose them to get a function from to . Function composition is also associative.
- Identity: For any set , there's an identity function that maps every element to itself. This acts as the identity morphism.
Since both rules hold, Set is a valid category. The same logic applies to many other areas of mathematics, from groups in abstract algebra to topological spaces in geometry. Each has its own idea of "structure-preserving maps" that act as morphisms.
Thinking in terms of categories gives us a powerful, high-level language to see connections between different fields of math and computer science that might otherwise seem unrelated.