Category theory §
Category theory is the study of mathematical structure through objects and morphisms (structure-preserving maps) between them, abstracted away from what the objects are made of. It is relevant whenever you want to state a construction once and for all across many fields — products, “free” constructions, duality, and limits all have a single categorical form — and it is the native language of modern algebra, homotopy type theory, and the semantics of programming languages.
Authoritative sources
- S. Eilenberg & S. Mac Lane, General Theory of Natural Equivalences (1945) — where category, functor, and natural transformation were first defined
- S. Mac Lane, Categories for the Working Mathematician
- nLab: category theory
Category §
Definition. A category consists of:
- a collection of objects;
- for each pair of objects , a set of morphisms , written ;
- a composition operation whenever and ;
- an identity morphism for each object ;
such that composition is associative () and each identity acts as a unit ().
Details
A category abstracts the pattern “things, and arrows between them.” The only rules are that arrows compose, that composition is associative, and that each object has a do-nothing identity arrow. What the objects are and what the arrows do is deliberately left unspecified — that is the whole point. The same definition covers sets and functions, groups and homomorphisms, topological spaces and continuous maps, and propositions and proofs (see Type theory).
Example. The category Set: objects are sets, morphisms are functions, composition is function composition, and the identity is the identity function. All the axioms are just the familiar facts about composing functions.
The diagram below shows the two axioms at once: the composite is the arrow you get by going , and each object carries an identity loop.
Authoritative sources
Example problem
Consider the “category” whose objects are the natural numbers and which has exactly one morphism if and only if . Show it is a category.
Solution
Composition: if and then , and there is exactly one morphism , so the composite is forced and well-defined. Identity: , so exists. Associativity holds automatically because between any two comparable objects there is at most one morphism, so the two ways of composing are the same unique arrow.
Functor §
Definition. A functor assigns to each object of an object of , and to each morphism a morphism , preserving composition and identities:
Details
A functor is the “structure-preserving map between structures” of category theory — the homomorphism, but one level up. It sends an entire category (objects and arrows) to another, in a way that respects how the arrows fit together.
Example. The free group functor sends a set to the free group on , and a function to the unique group homomorphism that extends . Because extending a function to a homomorphism is unique, composition and identities are preserved automatically.
The diagram below shows a functor carrying the small category on the left (objects , arrow ) to the category on the right (objects , arrow ). The dashed arrows record what does to each piece.
Authoritative sources
Example problem
The power-set functor sends a set to its power set , and a function to the map given by . Verify that is a functor.
Solution
For and , , so composition is preserved. And , so . Both functor laws hold.
Natural transformation §
Definition. A natural transformation between functors is a family of morphisms (one for each object ) such that for every morphism the naturality square commutes:
Details
A natural transformation is a “map between functors”: a coherent family of arrows, one per object, that commutes with everything in sight. The word “natural” means the family does not depend on any arbitrary choice — it behaves the same no matter which arrow you slide it past.
Example. Let both send a set to and a function to . Define to be the flip . This is a natural transformation : for any , both ways around the square send to .
The naturality square below is the defining condition: going across the top then down equals going down then across the bottom.
The naturality condition is exactly the statement that this square commutes.
Authoritative sources
Example problem
Using the flip example above, verify the naturality square commutes for an arbitrary function .
Solution
Here , so . Going down then across: . Going across then down: applied to the flipped pair gives . Both paths yield , so the square commutes.
Limits and universal properties §
Definition. A limit of a diagram is an object together with a cone (morphisms for each object of ) that is universal: for every other cone from an object there is a unique morphism making all the triangles commute. The product is the limit of the discrete diagram .
Details
A universal property characterizes an object by how other objects map into it, not by what it is made of. The limit is the “best” object that everything maps into: it is the unique (up to isomorphism) answer to a mapping-in problem. Products, equalizers, and pullbacks are all limits of particular diagrams.
Example. The product of sets is the set of pairs with projections and . Given any set with maps and , there is a unique map making the triangles commute, namely .
The cone diagram below shows the universal property: the dashed arrow is the unique map that factors the cone from through .
Authoritative sources
Example problem
Show that the product is a limit: given a cone , , exhibit the unique map and check the triangles commute.
Solution
Define . Then and , so both triangles commute. Uniqueness: any map with and must satisfy , so .
Adjunctions §
Definition. An adjunction between functors and is a natural bijection of hom-sets
equivalently, a unit and a counit satisfying the triangle identities. is the left adjoint (the “free” functor) and the right adjoint (the “forgetful” functor).
Details
An adjunction is a precise sense in which one functor is a “left inverse” of another. The left adjoint is free: it builds the most structure you can from a bare object. The right adjoint is forgetful: it strips structure away, keeping only the underlying object. The bijection above says that maps out of a free object are the same thing as maps into the underlying object — which is exactly the universal property of the free construction. Universal properties are the shadows of adjunctions.
Example. , where is the forgetful functor from groups to sets. Homomorphisms from the free group to a group are in bijection with plain functions from to the underlying set of — a homomorphism is determined entirely by where it sends the generators.
The diagram below shows the two functors and the unit and counit that make the adjunction work.
Authoritative sources
Example problem
For the adjunction , identify which functor is the left adjoint and which is the right adjoint, and state the hom-set bijection it gives.
Solution
Free is the left adjoint and U is the right adjoint. The adjunction gives a natural bijection : a homomorphism out of the free group on is the same data as a function from to the underlying set of .
Duality and the opposite category §
Definition. The opposite category has the same objects as but reverses every arrow: a morphism in becomes in . A statement about categories is self-dual if it stays true when every arrow is reversed.
Duality is a free source of theorems: prove a statement once, and its dual is automatic. A colimit is simply a limit in the opposite category, so the coproduct in is the product in , and a left adjoint is a right adjoint after passing to opposites.
Topoi §
Definition. A topos (plural topoi) is a category that behaves like a universe of sets: it has a terminal object, all finite limits, is cartesian closed, and has a subobject classifier. Such a category supports an internal logic — one can carry out “set theory” and reasoning inside the category itself.
The category of all sets is the canonical (elementary) topos. Topos theory is the bridge between category theory and logic/foundations: it is the categorical setting in which a category can serve as a foundation in its own right, and it is the framework behind sheaf theory and the semantics of logic.
Interactive: naturality square explorer §
The simulation below lets you build a naturality square and check, arrow by arrow, whether a family of maps commutes with the arrows in sight — the defining condition for a natural transformation.
Why it matters §
Category theory is a unifying language rather than a rival foundation: the same constructions (products, limits, adjunctions, duality) recur across algebra, topology, logic, and computation, and the categorical viewpoint states them once, for all. It is the native language of modern algebra and of homotopy type theory, and it organizes programming-language semantics (types as objects, programs as morphisms).
How it relates to the other classes §
Set theory answers “what is an object made of?”; category theory answers “how does an object relate to others?”. The two are intertranslatable for most of mathematics: a category that behaves like a universe of sets — a topos — supports an internal logic and can serve as a foundation in its own right, so categorical and set-theoretic reasoning can be translated into each other. But category theory keeps only the morphisms, which is why it scales to structures too large or too abstract to be sets. It also meets Type theory at homotopy type theory, and it is the language in which the algebraic structures of Algebraic and discrete mathematics are most cleanly stated.
Quizz §
Test yourself
Problem. A student defines a “functor” by on objects and on morphisms, but then claims it is not a functor because “changes the size of the sets.” Using the definition of a functor, explain why the claim is wrong and verify the two functor laws.
Solution
A functor need not preserve size, cardinality, or any property of the objects — it only has to preserve composition and identities. For and , sends to , while sends to — the same, so composition is preserved. And , so identities are preserved. Both laws hold, so is a functor.