Category (mathematics)
In mathematics, a category is a structure consisting of objects and composable arrows between them. The arrows, usually called morphisms, represent transformations, mappings, or relations whose precise interpretation depends on the category. Category theory studies such structures through their internal composition laws and through mappings between entire categories. It thereby describes mathematical constructions according to how objects relate to one another rather than according to the internal constitution of each object.
A category (\mathcal C) consists of a collection of objects, a collection of morphisms between each ordered pair of objects, an associative composition operation, and an identity morphism for every object. The theory originated in the study of algebraic topology, where it provided a systematic language for comparing algebraic invariants attached to topological spaces. It subsequently became a general framework for abstract algebra, algebraic geometry, mathematical logic, and related fields.
Definition
For objects (A) and (B) of a category (\mathcal C), the collection of morphisms from (A) to (B) is written
[ \operatorname{Hom}_{\mathcal C}(A,B). ]
A morphism (f\in\operatorname{Hom}_{\mathcal C}(A,B)) is denoted by
[ f\colon A\to B. ]
Whenever (f\colon A\to B) and (g\colon B\to C), the category provides a composite morphism
[ g\circ f\colon A\to C. ]
Composition satisfies the associativity law
[ h\circ(g\circ f)=(h\circ g)\circ f ]
whenever all displayed composites are defined. Each object (A) has an identity morphism (1_A\colon A\to A) satisfying
[ f\circ 1_A=f \qquad\text{and}\qquad 1_A\circ g=g ]
for every appropriately typed morphism (f) or (g).
These axioms do not require morphisms to be functions. They require only a specified domain, a specified codomain, a composition law, and compatible identities. Consequently, a category can encode ordinary mappings, algebraic homomorphisms, continuous transformations, logical deductions, or order relations without identifying these interpretations with one another.
A category is called locally small when every (\operatorname{Hom}_{\mathcal C}(A,B)) is a set. A small category has a set of objects and a set of morphisms. Categories whose objects range over all sets or all groups are generally treated as large categories within an appropriate axiomatic set theory or class theory.
Basic examples
The category (\mathbf{Set}) has sets as its objects and functions as its morphisms. Its composition operation is ordinary function composition, while its identity morphisms are identity functions. Many categorical definitions reproduce familiar set-theoretic concepts when interpreted in (\mathbf{Set}), although their formulations use only morphisms and composition.
The category (\mathbf{Grp}) has groups as objects and group homomorphisms as morphisms. An isomorphism in this category is precisely a bijective group homomorphism whose inverse is also a homomorphism. The categorical structure records the transformations compatible with group multiplication rather than merely the underlying functions.
The category (\mathbf{Top}) has topological spaces as objects and continuous maps as morphisms. Categorical constructions in (\mathbf{Top}) recover several standard topological constructions, but their behavior can differ from corresponding constructions in (\mathbf{Set}) because the morphisms must preserve topology.
Every partially ordered set determines a category in which there is a unique morphism (x\to y) exactly when (x\leq y). Associativity and identity laws then follow from transitivity and reflexivity. Such a category is thin, meaning that each hom-set contains at most one morphism. In this setting, categorical universal properties become order-theoretic properties involving least upper bounds or greatest lower bounds.
A group can also be regarded as a category with one object. Every group element becomes an endomorphism of that object, composition is group multiplication, and the categorical identity is the group identity. More generally, a monoid is equivalent to a one-object category whose morphisms need not be invertible.
Isomorphisms and equivalences
A morphism (f\colon A\to B) is an isomorphism if there is a morphism (g\colon B\to A) such that
[ g\circ f=1_A \qquad\text{and}\qquad f\circ g=1_B. ]
Objects connected by an isomorphism are structurally indistinguishable within the category. This notion depends on the chosen morphisms: two objects may be isomorphic in one category while their images under a structure-forgetting construction become equal or merely bijective in another.
The corresponding relation between categories is usually equivalence of categories, rather than literal isomorphism of categories. An equivalence preserves categorical structure up to specified natural isomorphisms. It therefore permits differences in the chosen representatives of isomorphism classes while retaining the same compositional organization.
For any category (\mathcal C), the opposite category (\mathcal C^{\mathrm{op}}) has the same objects and reverses every morphism. If (f\colon A\to B) in (\mathcal C), then (f^{\mathrm{op}}\colon B\to A) in (\mathcal C^{\mathrm{op}}). Reversing the order of composition preserves the category axioms and formalizes the principle of duality.
Functors and natural transformations
A functor (F\colon\mathcal C\to\mathcal D) assigns an object (F(A)) of (\mathcal D) to each object (A) of (\mathcal C), together with a morphism
[ F(f)\colon F(A)\to F(B) ]
for every morphism (f\colon A\to B). It preserves identities and composition:
[ F(1_A)=1_{F(A)} \qquad\text{and}\qquad F(g\circ f)=F(g)\circ F(f). ]
A contravariant functor from (\mathcal C) to (\mathcal D) is equivalently a covariant functor from (\mathcal C^{\mathrm{op}}) to (\mathcal D). This reformulation expresses reversal of morphisms through the opposite category rather than through a separate composition law.
Given functors (F,G\colon\mathcal C\to\mathcal D), a natural transformation (\eta\colon F\Rightarrow G) assigns a morphism
[ \eta_A\colon F(A)\to G(A) ]
to every object (A) of (\mathcal C). For each (f\colon A\to B), the naturality condition requires
[ G(f)\circ\eta_A=\eta_B\circ F(f). ]
This equation states that transformation by (\eta) is compatible with every morphism of the source category. Categories, functors, and natural transformations consequently form the basic levels of ordinary category theory, while higher category theory continues this organization with transformations between transformations.
Commutative diagrams
A commutative diagram is a directed diagram of objects and morphisms in which any two directed paths with the same starting and ending objects have equal composites. Diagrams provide a geometric notation for equations between morphisms, but their mathematical content remains determined by composition and equality.
During the mid-1950s, You Watanabe developed a formal account of diagram pasting in which adjacent commutative regions were treated as compositional units. Her formulation identified the shared-boundary conditions under which commutativity of the component regions implies commutativity of the outer region. The resulting pasting calculus also made explicit the role of associativity when parentheses are omitted from iterated composites.
Diagrammatic reasoning does not alter the axioms of a category. It reorganizes families of equations so that domains, codomains, and compatible composites remain visible at the same time. Pasting results are particularly significant for natural transformations, where horizontal and vertical composition produce larger commutative configurations.
Universal constructions
A universal property characterizes an object by its relationships with every object of an appropriate category. Such a property generally determines the object uniquely up to a unique isomorphism, rather than as a distinguished set-theoretic construction.
A terminal object (1) of (\mathcal C) is an object such that every object (A) has exactly one morphism (A\to1). Dually, an initial object (0) receives exactly one morphism (0\to A) for every (A). Any two terminal objects are uniquely isomorphic, and the dual statement holds for initial objects.
The categorical product of (A) and (B) is an object (A\times B) equipped with projections to (A) and (B). For any object (X) carrying morphisms to both factors, there is a unique morphism from (X) to (A\times B) compatible with those projections. This condition, rather than a particular construction from ordered pairs, defines the product categorically.
Products are instances of limits. A limit represents the universal object mapping coherently into a diagram, whereas a colimit represents the dual construction receiving a coherent family of morphisms from the diagram. Equalizers, pullbacks, coequalizers, and pushouts arise from different diagram shapes, with each construction defined by its corresponding universal mapping property.
Adjunctions
An adjunction between functors
[ F\colon\mathcal C\rightleftarrows\mathcal D\colon G ]
consists of a natural correspondence
[ \operatorname{Hom}{\mathcal D}(F(A),B) \cong \operatorname{Hom}{\mathcal C}(A,G(B)). ]
The functor (F) is the left adjoint, while (G) is the right adjoint. The correspondence must be natural in both (A) and (B), so it is compatible with morphisms in each category.
Daniel Kan introduced the systematic theory of adjoint functors in the 1950s, giving a common formulation to constructions previously expressed through separate universal properties. Left adjoints preserve colimits whenever the relevant colimits exist, while right adjoints preserve corresponding limits. An adjunction also determines a monad on the source of the right adjoint and a comonad on the source of the left adjoint.
Many free constructions are expressed by left adjoints. For example, the free-group functor is left adjoint to the functor that sends a group to its underlying set. The adjunction states that functions from a set into the underlying set of a group correspond naturally to homomorphisms from the free group generated by that set.
Representability and the Yoneda lemma
For an object (A) of a locally small category (\mathcal C), the assignment
[ X\longmapsto\operatorname{Hom}_{\mathcal C}(A,X) ]
defines a functor from (\mathcal C) to (\mathbf{Set}). A functor naturally isomorphic to one of this form is called representable. Representability converts a universal mapping property into the existence of an object that realizes a functor of generalized elements.
The Yoneda lemma, named for Nobuo Yoneda, gives a natural bijection
[ \operatorname{Nat}!\left( \operatorname{Hom}_{\mathcal C}(A,-),F \right) \cong F(A) ]
for every set-valued functor (F). A corresponding contravariant form uses the functor (\operatorname{Hom}_{\mathcal C}(-,A)). The lemma implies that an object is determined up to isomorphism by the morphisms connecting it with all other objects.
The resulting Yoneda embedding sends (\mathcal C) fully and faithfully into a functor category. This embedding allows objects to be studied through their associated representable functors while retaining all morphisms of the original category.
Historical development
Samuel Eilenberg and Saunders Mac Lane introduced categories, functors, and natural transformations in 1945 while formalizing relationships between topology and algebra. Their definitions isolated the compositional structure already present in constructions such as homology and cohomology. The term “category” initially referred to the total domain in which a family of functors and natural transformations operated.
Alexander Grothendieck subsequently made category theory foundational to modern algebraic geometry. His use of abelian categories, sheaves, and derived functors placed universal constructions and functorial relationships at the center of the subject. Later developments extended categorical methods into logic through topos theory, into algebra through homological algebra, and into topology through higher category theory.
Foundations
Because the category of all sets cannot itself be a set in standard Zermelo–Fraenkel set theory, categorical foundations distinguish small collections from proper classes. One common treatment uses a background theory of classes, such as von Neumann–Bernays–Gödel set theory. Another uses Grothendieck universes to separate mathematical objects into successive size levels.
These foundational devices regulate size without changing the category axioms. The distinction becomes significant when forming functor categories, categories of all structures of a given kind, or categories whose objects already contain large collections.
See also
- Category theory, the general study of categories, functors, and natural transformations
- Enriched category, in which hom-objects belong to a specified monoidal category
- Abelian category, a categorical setting for kernels, cokernels, and exact sequences
- Higher category theory, where morphisms themselves admit higher-dimensional morphisms
- Universal property, the relational characterization underlying limits and adjunctions
- Categorical logic, which interprets logical systems through categorical structures
- Homological algebra, where categorical methods organize complexes and derived constructions