A functor is a structure-preserving mapping between categories. In category theory, a category consists of objects and morphisms between them, together with identity morphisms and an associative rule for composition. A functor assigns objects to objects and morphisms to morphisms while preserving identities and composition. It therefore describes not merely a correspondence between mathematical structures, but a systematic correspondence between the ways those structures are related.
Functors occur throughout mathematics. They can associate an underlying set with a group, a dual space with a vector space, or a homology group with a topological space. Their defining requirement is functoriality: a construction must act consistently on morphisms as well as on objects. This requirement allows equations, commutative diagrams, and isomorphisms to be transported between mathematical settings.
Functors also provide the setting for natural transformations, representability, adjunctions, and equivalences of categories. These concepts explain when constructions are canonical, when two categories express essentially the same mathematics, and how universal constructions interact. Beyond pure mathematics, functors inform programming-language semantics and the organization of typed computations.
Definition and basic properties
Let and be categories. A functor consists of an assignment for every object of , and an assignment for every morphism of . If , its assigned morphism must have the form . These assignments must satisfy two laws:
and
whenever and are composable. The notation and is often used when parentheses would add clutter.
The composition law is what distinguishes a functor from an arbitrary assignment of arrows. In a category of sets, the arrows are functions and composition is ordinary function composition. In a category of groups, the arrows are group homomorphisms. Other categories have arrows that are continuous maps, linear maps, or relations. A functor is defined using the categorical composition law, independently of whether its arrows can be regarded as ordinary functions.
Every category has an identity functor , which leaves every object and morphism unchanged. Functors themselves compose: if and , then sends to and to . This composition is associative and has identity functors as units. Consequently, small categories and functors form a category, usually denoted . A small category has a set of objects and a set of morphisms; size conventions are needed when categories such as the category of all sets are included.
A fundamental consequence of the laws is that every functor preserves isomorphisms. If has inverse , then
Thus is invertible. More generally, a functor preserves every commutative diagram: equal composites in the source have equal images in the target. It does not necessarily preserve arbitrary monomorphisms, epimorphisms, products, or other universal constructions.
The definition does not require either assignment to be injective or surjective. Distinct objects may have the same image, and distinct morphisms may become equal. A constant functor illustrates the possibilities: for a fixed object of , it sends every object of to and every morphism to . This satisfies both functor laws, even though it generally discards most of the source category’s information.
Covariance, contravariance, and several variables
The unqualified word functor ordinarily means a covariant functor, which preserves the direction of arrows. A contravariant functor reverses them: a morphism induces a morphism . Its composition rule is correspondingly reversed:
This is not a different kind of categorical machinery. The opposite category has the same objects as , but every arrow is reversed. A contravariant functor on is precisely an ordinary functor .
The dual-space construction is a central example. For a vector space over a field , let . A linear map induces
The reversal is forced by the domains of the functions being composed. For composable linear maps and , the identity expresses contravariant functoriality. Applying dualization twice produces a covariant functor.
Power sets illustrate that the same object assignment can support different functor structures. A function induces a direct-image function , sending to ; this gives a covariant functor on sets. It also induces an inverse-image function , sending to ; this gives a contravariant functor. Specifying only the objects therefore does not determine a functor.
A functor may depend on several variables. A bifunctor has a product category as its source, such as . The tensor product of vector spaces defines a bifunctor
For linear maps and , its action is determined by
Functoriality includes compatibility between changes in the two variables, not merely functoriality in each variable considered separately.
Mixed variance occurs in the Hom construction:
for a locally small category . “Locally small” means that the morphisms between each fixed pair of objects form a set. If , , and , the induced operation sends to . Hom is contravariant in its first argument and covariant in its second. Tracking this variance is essential in duality, tensor–Hom identities, and algebraic constructions involving several inputs.
Standard examples and diagrams
A forgetful functor removes specified structure while retaining the underlying objects and maps. For example,
sends a group to its underlying set and a group homomorphism to its underlying function. It is functorial because identity homomorphisms and composites have the corresponding identity and composite functions. Similar functors send vector spaces to sets, rings to abelian groups under addition, and topological spaces to sets. Forgetting structure need not mean forgetting all structure at once: several forgetful functors may be composed in stages.
A different example sends a group to its abelianization
where is the subgroup generated by commutators. Every homomorphism maps commutators to commutators, so it induces a well-defined homomorphism . This compatibility with morphisms is what turns abelianization from an objectwise construction into a functor , where is the category of abelian groups.
Many familiar structures become functors when their source category is chosen appropriately. A partially ordered set can be regarded as a category with one arrow exactly when . A functor between two such categories is exactly a monotone map. A group can instead be regarded as a category with one object, whose arrows are the group elements and whose composition is multiplication. Functors between these one-object categories are precisely group homomorphisms.
A functor from a one-object group category to specifies a group action. The single object is assigned a set , and each group element is assigned a permutation of . Invertibility follows because functors preserve inverses. Replacing sets by vector spaces gives a linear representation of the group, linking functorial language directly to representation theory. Functoriality then encodes the representation identity .
A diagram in a category is itself a functor , where is an indexing category. If has two objects and a single nonidentity arrow between them, a diagram of shape is one morphism of . If is discrete, a diagram is simply an indexed family of objects. A commutative square is represented by an indexing category in which the two routes from the upper-left vertex to the lower-right vertex are equal. This viewpoint makes diagram shape an explicit mathematical object and permits constructions such as limits to be defined uniformly for all shapes.
Natural transformations and functor categories
Two functors with the same source and target can themselves be connected by a natural transformation. If , a natural transformation assigns a morphism
to each object , subject to the naturality equation
for every . The equation says that applying the transformation before or after transporting along gives the same result. An arbitrary family of morphisms is not necessarily natural.
A standard example is the evaluation map from a vector space to its double dual:
For every linear map ,
Thus evaluation is a natural transformation from the identity functor to double dualization. On finite-dimensional vector spaces, each is an isomorphism, so it is a natural isomorphism. On the category of all vector spaces over a field, these evaluation maps are not always surjective.
Naturality gives a precise formulation of certain claims that a construction is canonical or independent of coordinates. For example, a finite-dimensional vector space is isomorphic to its dual, but choosing such an isomorphism normally requires extra data. By contrast, the evaluation isomorphism with its double dual requires no choice of basis. An inner product can provide a particular identification with a dual space, but this belongs to a setting with additional structure and suitable structure-preserving maps. Objectwise existence of an isomorphism is therefore weaker than natural isomorphism of functors.
For small , functors and natural transformations form a functor category, written or . Composition of natural transformations is defined componentwise:
An isomorphism in this category is exactly a natural transformation whose components are all isomorphisms. Depending on the categories involved, further size assumptions may be required to ensure that collections of natural transformations are sets.
Functor categories turn entire families of compatible constructions into objects of study. Presheaves, for example, are functors , and their morphisms are natural transformations. Categories, functors, and natural transformations also form the basic example of a 2-category: there are objects, arrows between objects, and transformations between arrows. This additional level of structure records how functors compare, rather than treating them only as isolated mappings.
Faithfulness, fullness, and equivalence
A functor induces, for every pair , a function
The functor is faithful if every such function is injective, full if every such function is surjective, and fully faithful if every such function is bijective. These conditions describe how the functor handles morphisms between fixed objects. They do not directly require an injective or surjective assignment on objects.
The forgetful functor from groups to sets is faithful: two distinct group homomorphisms are distinct underlying functions. It is not full, because an arbitrary function between underlying sets need not preserve group multiplication. By contrast, the inclusion of abelian groups into groups is fully faithful: every group homomorphism between abelian groups is already a morphism in the category of abelian groups. This is an example of a full subcategory, in which all morphisms between its objects are retained.
A functor is essentially surjective if every object of its target is isomorphic to an image object. A fully faithful and essentially surjective functor characterizes an equivalence of categories, under the usual foundational assumptions that permit the required choices. Equivalently, is an equivalence if there is a functor with natural isomorphisms
The functor is called a quasi-inverse. The composites need not equal the identity functors literally.
Finite-dimensional vector spaces over a fixed field illustrate the difference between equivalence and strict identity of categories. Consider the category whose objects are nonnegative integers and whose morphisms are matrices over , with matrix multiplication as composition. Sending to and a matrix to its associated linear map defines a fully faithful, essentially surjective functor into finite-dimensional vector spaces. Constructing a quasi-inverse requires choices of bases for general vector spaces, but the equivalence does not identify each vector space literally with a coordinate space.
Preserving and reflecting properties are separate notions. Every functor preserves isomorphisms, whereas a functor reflects isomorphisms if being invertible implies that is invertible. Fully faithful functors reflect isomorphisms, but some functors that are not full do so as well. The forgetful functor from groups to sets reflects isomorphisms because a bijective group homomorphism has a homomorphic inverse. The forgetful functor from topological spaces to sets does not: a bijective continuous map need not have a continuous inverse and hence need not be a homeomorphism.
Representable functors and the Yoneda lemma
Fix an object of a locally small category . The assignment
defines a covariant functor to sets. A morphism acts by postcomposition, sending to . The assignment is contravariant, acting by precomposition. These Hom functors express how an object relates to every other object in the category, either through arrows leaving it or through arrows entering it.
A set-valued functor is representable if it is naturally isomorphic to a Hom functor of the appropriate variance. Thus a covariant functor is representable when some object satisfies
naturally in . The word “naturally” is indispensable: unrelated bijections for individual objects do not provide representability. A representing object packages an entire compatible family of data into maps from or to a single object.
For example, the underlying-set functor from groups to sets is represented by the infinite cyclic group . A homomorphism is uniquely determined by the image of , and every element of can occur as that image. Therefore
naturally in . Likewise, the underlying-set functor on vector spaces over is represented by the one-dimensional space : a linear map is determined by its value at .
The Yoneda lemma identifies natural transformations out of a representable functor. For ,
The bijection sends a natural transformation to . Conversely, an element determines
for every . The entire transformation is therefore determined by its value on one identity morphism. There is an analogous contravariant formulation.
A principal consequence is the fully faithful Yoneda embedding
Thus objects can be recovered, up to isomorphism, from their complete pattern of incoming morphisms. In algebraic geometry, this viewpoint underlies the functor-of-points approach, which studies a geometric object through maps into it from varying test objects. Representability also explains why solutions to a universal property, when they exist, are unique up to an isomorphism compatible with the specified universal data.
Adjunctions and preservation of universal constructions
An adjunction relates two functors pointing in opposite directions:
The functor is left adjoint to , written , when there are bijections
natural in both and . An adjunction does not generally make the functors inverses. Rather, it gives two equivalent descriptions of a mapping problem.
The free-group construction is left adjoint to the underlying-set functor. If is the free group on a set , then every function extends uniquely to a homomorphism . Abelianization is similarly left adjoint to the inclusion of abelian groups into groups. These examples explain how a construction can be characterized without committing to a particular presentation: the mapping correspondence determines the resulting functor up to natural isomorphism.
An adjunction can also be specified by natural transformations called its unit and counit:
They satisfy the triangle identities
For free groups, the unit inserts each generator into the free group, while the counit evaluates formal words in a group. The triangle identities express compatibility between insertion and evaluation.
The theory of categorical limits and colimits gives important preservation results. Limits include products, equalizers, and pullbacks; colimits include coproducts, coequalizers, and pushouts. Right adjoints preserve all limits that exist in their source, while left adjoints preserve all existing colimits. The forgetful functor from groups to sets preserves products, for instance: the underlying set of a product group is the Cartesian product of the underlying sets. Free-group formation preserves coproducts, taking a disjoint union of sets to the free product of their free groups.
Limits themselves can be described through adjunctions. For a fixed small indexing category , the diagonal functor sends an object to its constant diagram. When all limits of shape exist, the limit functor is right adjoint to ; the colimit functor, when defined, is left adjoint to it. Cones and cocones then appear as morphisms involving constant diagrams.
Another important example is the tensor–Hom adjunction. For a fixed vector space ,
It transforms a linear map on a tensor product into a linear map whose values are linear maps. Such correspondences connect multilinear algebra with the general behavior of left and right adjoints.
Functors in topology, geometry, and homological algebra
In algebraic topology, functors translate geometric questions into algebraic ones. For every nonnegative integer , singular homology defines a functor
A continuous map induces a map of singular chain complexes and hence a homomorphism on homology groups. Identity maps induce identities, and composites induce composites. Consequently, homeomorphic spaces have isomorphic homology groups. Functoriality supplies more than invariants of individual spaces: it also records how those invariants change under maps.
Homology is invariant under homotopy: homotopic maps induce the same homomorphism on homology. It therefore factors through the homotopy category of spaces. The fundamental group gives another functor, but its most direct formulation uses pointed spaces and basepoint-preserving maps:
Basepoints matter because changing them involves paths and can introduce conjugation. The fundamental groupoid instead records points as objects and homotopy classes of paths as arrows, retaining information without requiring one distinguished point.
In homological algebra, exactness describes the behavior of additive functors on sequences. A short exact sequence of modules
expresses that the first map identifies with the kernel of the second, while the second is surjective. An exact functor preserves such sequences. A left-exact functor preserves the beginning of the sequence through the kernel condition, while a right-exact functor preserves its ending through the cokernel condition. These notions require the additive and kernel–cokernel structures available in module categories and, more generally, abelian categories.
For modules over a commutative ring , is left exact, whereas is right exact. Tensoring with is exact precisely when is flat. For a concrete failure of left exactness, tensor the injection with . The resulting map is multiplication by on , hence the zero map, which is not injective. Functoriality alone does not prevent loss of this information.
Derived functors measure such failures of exactness. Under suitable hypotheses, projective or injective resolutions produce functors such as and . Their values occur in long exact sequences associated with short exact sequences. Derived categories reorganize these constructions by treating appropriate maps of chain complexes as invertible; derived tensor products and derived Hom then retain information that ordinary tensor products and Hom functors can lose.
A sheaf provides another important functorial structure. The open subsets of a space form a category under inclusion. A presheaf assigns data to each open set and restriction maps to inclusions, contravariantly. The sheaf condition additionally requires compatible local data to glue uniquely. Thus functoriality describes restriction, while the gluing requirement distinguishes sheaves from arbitrary presheaves. Sheaf cohomology connects this local-to-global structure with derived functors.
Computing, monads, and higher-categorical extensions
In typed functional programming, a functor commonly appears as a type constructor equipped with a mapping operation. In Haskell-style notation, this operation has the form
It lifts a function on elements to a function on structured values. The required laws are
and
These are the functor laws expressed operationally. Implementing the operation’s type signature alone does not establish that the laws hold.
Finite lists provide a basic example. Mapping a function over a list applies it to every entry while preserving order and length. An optional-value type gives another: mapping transforms a present value and leaves an absent value absent. For each fixed set , functions of type also form a covariant functor in , with a map acting by postcomposition. Such examples clarify that the programming notion is not restricted to data containers with a simple collection of stored elements.
The categorical interpretation depends on the semantic setting. Total functions between sets give a direct mathematical model, whereas practical languages may include nontermination, exceptions, effects, and operations that distinguish evaluation behavior. Suitable categories and notions of equality must then be specified. Moreover, “functor” has a different programming use in Standard ML and related module systems, where it denotes a parameterized module. That terminology should not be identified automatically with a category-theoretic functor.
An endofunctor is a functor . A monad consists of an endofunctor together with natural transformations
satisfying associativity and unit laws:
For lists, forms a singleton list and concatenates a list of lists. Every adjunction induces a monad . In programming semantics, monads organize certain forms of computation and sequencing, with additional structure beyond the mapping operation of a functor.
Higher category theory extends the idea of structure-preserving mapping when morphisms themselves have higher-dimensional morphisms between them. A strict 2-functor preserves compositions and identities exactly at the relevant levels. A pseudofunctor preserves specified structures up to coherent invertible 2-morphisms. In infinity-category theory, functoriality involves compatibility with an entire hierarchy of higher homotopies. These extensions are useful when constructions are naturally compatible only up to isomorphism or homotopy, and replacing that compatibility by literal equality would discard essential structure.
Historical development
Samuel Eilenberg and Saunders Mac Lane introduced categories, functors, and natural transformations together in their 1945 paper General Theory of Natural Equivalences. The setting was algebraic topology, where constructions such as homology already assigned algebraic objects to spaces and homomorphisms to continuous maps. Their framework made the compatibility of these assignments an explicit mathematical subject. Natural equivalence was central to the project: the purpose was not only to describe constructions, but to compare them systematically.
During the 1950s, category theory expanded through homological algebra. Henri Cartan and Eilenberg’s Homological Algebra, published in 1956, organized a substantial body of algebra around functors, resolutions, and derived constructions. Alexander Grothendieck’s 1957 paper Sur quelques points d’algèbre homologique, commonly called the Tôhoku paper, developed homological algebra in abelian categories. This permitted arguments originally formulated for modules to apply in settings such as sheaves, where the objects differ but the categorical structures remain comparable.
Nobuo Yoneda’s work in 1954 established the principle now expressed by the Yoneda lemma. It made precise how an object’s relationships with all other objects determine it, and how natural transformations from representable functors are controlled by individual elements. Daniel Kan introduced adjoint functors in 1958. Adjunctions brought free constructions, extension processes, and numerous universal properties under a single definition, giving functors a central role in explaining why apparently different constructions obey similar rules.
Functorial methods became especially influential in algebraic geometry during the development of schemes and representable moduli problems. Rather than studying only points over a single field, the functor-of-points perspective varies the test object and tracks all induced maps. In another direction, F. William Lawvere’s 1963 doctoral work on functorial semantics treated algebraic theories and their models categorically. Models could be described by functors preserving specified structure, connecting functorial language with algebra, logic, and the semantics of formal theories.
Mac Lane’s Categories for the Working Mathematician, first published in 1971, helped consolidate the terminology and techniques. Subsequent work extended their use in programming-language semantics, categorical logic, and higher-dimensional mathematics. Across these developments, the operative requirement remained stronger than simply assigning an output to each input object: a construction must specify how maps are transported, and establish the identities that make those assignments compatible.