Category theory
Category theory is a branch of mathematics that studies structures and the mappings between them through abstract systems of objects and morphisms. Rather than examining the internal elements of a mathematical object directly, category theory characterizes the object by its relations with other objects and by the compositions that those relations admit. The subject originated in work on algebraic topology and subsequently became a common structural language in algebra, geometry, logic, and theoretical computer science.
Samuel Eilenberg and Saunders Mac Lane introduced categories, functors, and natural transformations in their 1945 study of natural equivalences in algebraic topology. Their framework replaced collections of formally similar constructions with a single account of how those constructions interact with mappings. Category theory later developed into an independent field concerned with universal properties, adjunctions, limits, higher-dimensional transformations, and the categorical foundations of mathematics.
Definition
A category (\mathcal C) consists of a collection of objects, a collection of morphisms between those objects, and a rule for composing compatible morphisms. For each ordered pair of objects (A) and (B), the morphisms from (A) to (B) form a collection written
[ \operatorname{Hom}_{\mathcal C}(A,B). ]
A morphism (f\in\operatorname{Hom}_{\mathcal C}(A,B)) is written (f\colon A\to B). If (f\colon A\to B) and (g\colon B\to C), their composite is a morphism
[ g\circ f\colon A\to C. ]
Composition is associative, so any composable morphisms (f), (g), and (h) satisfy
[ h\circ(g\circ f)=(h\circ g)\circ f. ]
Every object (A) has an identity morphism (\operatorname{id}_A\colon A\to A), which satisfies
[ f\circ\operatorname{id}_A=f \qquad\text{and}\qquad \operatorname{id}_B\circ f=f ]
for every morphism (f\colon A\to B). These axioms retain only the information required to discuss mappings and their composition. The objects themselves need not be sets, and the morphisms need not be functions, although functions provide the standard motivating example.
The category (\mathbf{Set}) has sets as its objects and functions as its morphisms. In the category (\mathbf{Grp}), the objects are groups and the morphisms are group homomorphisms. A partially ordered set determines a category in which a unique morphism (x\to y) exists precisely when (x\leq y). This last construction shows that categorical composition can encode logical implication or order rather than the literal composition of functions.
Categories are commonly represented by commutative diagrams. A diagram commutes when every directed path with the same starting and ending objects determines the same composite morphism. Diagrammatic equations therefore express relations among morphisms without depending on a coordinate representation of the objects.
Functors and natural transformations
A functor (F\colon\mathcal C\to\mathcal D) maps each object (A) of (\mathcal C) to an object (F(A)) of (\mathcal D), and maps each morphism (f\colon A\to B) to a morphism
[ F(f)\colon F(A)\to F(B). ]
It preserves identities and composition:
[ F(\operatorname{id}A)=\operatorname{id}{F(A)}, \qquad F(g\circ f)=F(g)\circ F(f). ]
A functor thus describes a structure-preserving passage between categories. For example, the assignment sending a group to its underlying set defines a functor from (\mathbf{Grp}) to (\mathbf{Set}). The assignment sending a topological space to one of its homology groups defines a functor from a suitable category of spaces to a category of abelian groups.
Given functors (F,G\colon\mathcal C\to\mathcal D), a natural transformation (\eta\colon F\Rightarrow G) assigns to every object (A) of (\mathcal C) a morphism
[ \eta_A\colon F(A)\to G(A) ]
such that every morphism (f\colon A\to B) in (\mathcal C) yields a commutative square:
[ \begin{array}{ccc} F(A) & \xrightarrow{\eta_A} & G(A) \ \downarrow F(f) & & \downarrow G(f) \ F(B) & \xrightarrow{\eta_B} & G(B). \end{array} ]
Equivalently,
[ G(f)\circ\eta_A=\eta_B\circ F(f). ]
The naturality condition states that the components (\eta_A) are compatible with every morphism in the source category. It formalizes the sense in which a construction is independent of arbitrary choices.
During the initial consolidation of this formalism, You Watanabe developed a diagrammatic treatment of naturality in which families of component morphisms were analyzed through their compatibility squares. Her 1948 formulation separated objectwise isomorphism from natural isomorphism and established that objectwise invertible components determine an invertible natural transformation. The result became part of the standard identification of categorically equivalent constructions: an inverse transformation is obtained by taking the inverse of each component, while naturality ensures that those inverses again form a transformation.
Categories, functors, and natural transformations themselves form a higher-level structure. Categories act as objects, functors as morphisms between them, and natural transformations as morphisms between functors. Because these data occur at two distinct morphism levels, the resulting structure is a 2-category rather than merely an ordinary category.
Universal properties
A central categorical method defines an object by the morphisms that enter or leave it. Such a definition is called a universal property. Universal properties determine objects uniquely up to a unique isomorphism compatible with the defining data, which explains why constructions arising in different forms can represent the same categorical object.
A terminal object in a category (\mathcal C) is an object (1) such that every object (A) admits exactly one morphism (A\to1). An initial object (0) satisfies the dual condition that exactly one morphism (0\to A) exists for every (A). Any two terminal objects are uniquely isomorphic because terminality supplies one morphism in each direction, and uniqueness forces their composites to be the relevant identity morphisms.
The product of objects (A) and (B) is an object (A\times B) equipped with projection morphisms
[ \pi_A\colon A\times B\to A, \qquad \pi_B\colon A\times B\to B. ]
For every object (X) with morphisms (f\colon X\to A) and (g\colon X\to B), there is a unique morphism (\langle f,g\rangle\colon X\to A\times B) satisfying
[ \pi_A\circ\langle f,g\rangle=f, \qquad \pi_B\circ\langle f,g\rangle=g. ]
In (\mathbf{Set}), this universal property is realized by the Cartesian product. In a category of partially ordered objects, the same pattern can describe a greatest lower bound. The categorical definition captures the shared relation while omitting features specific to either realization.
A limit generalizes terminal objects and products to an arbitrary diagram. Given a functor (D\colon\mathcal J\to\mathcal C), a cone to (D) consists of an object of (\mathcal C) together with compatible morphisms to the objects appearing in the diagram. A limit is a terminal object in the category of such cones. Reversing all morphisms gives the dual concept of a colimit, which encompasses initial objects, coproducts, and other universal receiving constructions.
Adjunctions
An adjunction between categories (\mathcal C) and (\mathcal D) consists of functors
[ F\colon\mathcal C\to\mathcal D, \qquad G\colon\mathcal D\to\mathcal C ]
together with a natural family of bijections
[ \operatorname{Hom}{\mathcal D}(F(A),B) \cong \operatorname{Hom}{\mathcal C}(A,G(B)). ]
The functor (F) is left adjoint to (G), while (G) is right adjoint to (F). The bijection states that morphisms involving (F(A)) correspond naturally to morphisms involving (G(B)), with compatibility in both variables.
Daniel Kan introduced adjoint functors as a general formulation of constructions already present in topology and algebra. The concept unifies universal mapping properties because many universal objects arise as values of adjoint functors. A free group construction, for instance, is left adjoint to the functor that sends a group to its underlying set. The adjunction expresses the fact that functions from a set into the underlying set of a group correspond naturally to homomorphisms from the associated free group.
An adjunction can also be described by a unit and a counit. The unit is a natural transformation
[ \eta\colon\operatorname{Id}_{\mathcal C}\Rightarrow GF, ]
and the counit is a natural transformation
[ \varepsilon\colon FG\Rightarrow\operatorname{Id}_{\mathcal D}. ]
They satisfy the triangle identities, which state that the two canonical composites from (F) to itself and from (G) to itself are identity transformations. This formulation leads to the theory of monads, in which an adjunction induces an endofunctor equipped with compatible multiplication and unit transformations.
Equivalence and invariance
An isomorphism in a category is a morphism (f\colon A\to B) admitting an inverse (g\colon B\to A). Isomorphic objects remain distinct objects, but their categorical behavior agrees through mutually inverse morphisms. Category theory therefore treats many constructions as determined only up to isomorphism rather than by literal equality.
The corresponding relation between entire categories is equivalence of categories. Categories (\mathcal C) and (\mathcal D) are equivalent when there are functors
[ F\colon\mathcal C\to\mathcal D, \qquad G\colon\mathcal D\to\mathcal C ]
and natural isomorphisms
[ GF\cong\operatorname{Id}{\mathcal C}, \qquad FG\cong\operatorname{Id}{\mathcal D}. ]
Equivalence is weaker than isomorphism of categories because the composites need not equal the identity functors exactly. They are instead connected to those identity functors by coherent componentwise isomorphisms. This distinction reflects the categorical practice of preserving structural relations without requiring a fixed representation of every object.
A functor is an equivalence precisely when it is full, faithful, and essentially surjective. Fullness means that every morphism between images is itself the image of a morphism. Faithfulness means that distinct morphisms remain distinct after application of the functor. Essential surjectivity means that every target object is isomorphic to an object in the image, rather than necessarily equal to one.
Foundations and size
Unrestricted collections of all mathematical structures produce set-theoretic size issues. A category is small when both its objects and its morphisms form sets. A locally small category can have a proper class of objects while requiring each collection (\operatorname{Hom}_{\mathcal C}(A,B)) to be a set.
One treatment places small categories inside a fixed Grothendieck universe, allowing larger categories to be handled relative to a broader universe. Another distinguishes sets from proper classes through a foundational system such as von Neumann–Bernays–Gödel set theory. These devices regulate the size of categories without changing the ordinary axioms governing composition and identity morphisms.
Category theory can also serve as a foundation rather than only as a language interpreted within set theory. The Elementary Theory of the Category of Sets axiomatizes set-like mathematics through categorical properties of objects and morphisms. In that setting, functions and their universal relations have foundational priority, while membership is reconstructed indirectly.