No history yet

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, AA, BB, and CC are objects. The arrow ff is a morphism from AA to BB, and gg is a morphism from BB to CC. We write this as f:ABf: A \to B and g:BCg: B \to C.

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 AA to BB, and another path from BB to CC, it makes sense that there should be a direct path from AA to CC. This direct path is called the composition of the two morphisms.

If we have f:ABf: A \to B and g:BCg: B \to C, their composition is a new morphism, written as gfg \circ f, which goes directly from AA to CC.

gf:ACg \circ f: A \to C

The order might seem backward at first. We write gfg \circ f, but we apply ff first, then gg. This matches the standard notation for function composition, like in g(f(x))g(f(x)).

Composition also has to be associative. If you're stringing together three or more morphisms, it doesn't matter how you group them. Composing ff and gg first, and then composing the result with hh, is the same as composing gg and hh first, and then composing ff with that result.

h(gf)=(hg)fh \circ (g \circ f) = (h \circ g) \circ f

Rule 2: Every object must have an identity morphism.

For every object AA in the category, there must be a special morphism that starts and ends at AA without changing anything. This is the identity morphism, often written as idAid_A or 1A1_A. It's like multiplying by 1 or adding 0; it's a "do nothing" operation.

idA:AAid_A: A \to A

When you compose any morphism f:ABf: A \to B with an identity morphism, you just get ff back. It's the equivalent of doing something, and then doing nothing (or vice versa).

fidA=fandidBf=ff \circ id_A = f \quad \text{and} \quad id_B \circ f = f

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.

CategoryObjectsMorphisms
SetSetsFunctions between sets
GrpGroupsGroup homomorphisms
TopTopological spacesContinuous functions
VectVector spacesLinear transformations

Let's check the rules for Set, the category of sets. The objects are sets, and the morphisms are functions.

  1. Composition: If you have a function ff from set AA to set BB, and a function gg from set BB to set CC, you can definitely compose them to get a function gfg \circ f from AA to CC. Function composition is also associative.
  2. Identity: For any set AA, there's an identity function idA(x)=xid_A(x) = x 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.