Category theory through composition, products and functors

A worked introduction to category theory using functions, Cartesian products and the forgetful functor from groups to sets.

Mathematicians repeatedly encounter constructions that look different on the page but behave alike when connected to other objects. Taking a product of sets, forming a product of groups and combining vector spaces each introduces its own notation, yet in every case there is a way to recover the two components and a precise rule for mapping into the combined object. Category theory makes that recurring behaviour available for study, allowing a proof to depend on the relationships that survive a change of mathematical setting.

Objects, arrows and composition

Consider sets A, B and C, with functions f: A → B and g: B → C. Applying f and then g gives the composite g ∘ f: A → C. If a third function h follows g, the result is independent of how we bracket the composition: h ∘ (g ∘ f) = (h ∘ g) ∘ f. Each set also has an identity function that leaves its elements unchanged.

These operations provide a model of a category. A category has objects and arrows with specified sources and targets, an associative rule for composing compatible arrows, and an identity arrow for every object. In the category of sets, the arrows are functions; in the category of groups, they are group homomorphisms, which preserve the group operation. Choosing the arrows is part of choosing the mathematics: an arbitrary function between the underlying sets of two groups need not respect their multiplication.

For a concrete calculation, take f(x) = x + 1 and g(x) = 2x as functions from the integers to themselves. Then (g ∘ f)(x) = 2x + 2, whereas (f ∘ g)(x) = 2x + 1. Associativity tells us how several compatible compositions can be bracketed; it does not permit us to reverse their order. Keeping those two ideas separate prevents a surprisingly easy misreading of a diagram full of arrows.

A product described by what maps into it

The Cartesian product A × B consists of pairs (a, b). It has projection functions πA and πB, which select the first and second entries. Suppose another set X has functions f: X → A and g: X → B. There is exactly one function u: X → A × B satisfying both πA ∘ u = f and πB ∘ u = g: it sends x to (f(x), g(x)).

For example, let X be a set of labelled samples, with f assigning each sample a colour and g assigning it an integer count. The combined assignment sends a sample to its colour–count pair. Recovering either original assignment by projection determines that combined assignment completely. There is no freedom to choose a different pair for a sample while preserving both its colour and its count.

This existence-and-uniqueness condition is the product’s universal property. It describes the product through arrows, so it can be posed in another category without first deciding that its objects must be sets of pairs. In groups, the product carries componentwise multiplication, and the corresponding arrows must be homomorphisms. A construction satisfying the property is determined up to an isomorphism compatible with its projections, which is the appropriate sense of sameness here.

What a functor preserves

A functor maps objects and arrows from one category to another while preserving identities and composition. If F is a functor, then F(g ∘ f) = F(g) ∘ F(f). This requirement prevents the translation from changing the outcome of a composite operation.

The forgetful functor from groups to sets illustrates the idea without requiring a complicated construction. It sends each group to its underlying set and each homomorphism to its underlying function. It forgets the multiplication as explicit structure while preserving how those functions compose. The name is unusually candid for mathematics: the operation really does discard information, but it does so in a controlled way.

These elementary examples establish why category theory is useful before any appeal to its applications. Once a construction is expressed through a universal property, the same argument can travel between settings whose elements look quite different. Emily Riehl’s Category Theory in Context develops the definitions and their consequences systematically, including how functors and universal properties organise much larger parts of mathematics.

Author

  • I’m Hamza, a writer currently pursuing a PhD at the University of Iowa. My research lies at the intersection of biology, mathematics and computing, although my curiosity is less disciplined.

    I’m interested in everything from the geometry of life and the nature of intelligence to literature, philosophy, technology and the occasional absurdities of human existence. Beyond my academic research, I write about people, ideas and discoveries for the University of Iowa’s Graduate College.

    I take science seriously, but I’m considerably less reverent about scientists and people in general (myself included). I’m equally skeptical of established truths and particularly suspicious of grand claims of certainty.

    View all posts

Discussion

Join the discussion