# Universal property

In mathematics, more specifically in category theory, a universal property is a property that characterizes up to an isomorphism the result of some constructions. Thus, universal properties can be used for defining some objects independently from the method chosen for constructing them. For example, the definitions of the integers from the natural numbers, of the rational numbers from the integers, of the real numbers from the rational numbers, and of polynomial rings from the field of their coefficients can all be done in terms of universal properties. In particular, the concept of universal property allows a simple proof that all constructions of real numbers are equivalent: it suffices to prove that they satisfy the same universal property.
Technically, a universal property is defined in terms of categories and functors by means of a universal morphism (see § Formal definition, below). Universal morphisms can also be thought more abstractly as initial or terminal objects of a comma category (see § Connection with comma categories, below).
Universal properties occur almost everywhere in mathematics, and the use of the concept allows the use of general properties of universal properties for easily proving some properties that would need boring verifications otherwise. For example, given a commutative ring R, the field of fractions of the quotient ring of R by a prime ideal p can be identified with the residue field of the localization of R at p; that is $R_{p}/pR_{p}\cong \operatorname {Frac} (R/p)$ (all these constructions can be defined by universal properties).
Other objects that can be defined by universal properties include: all free objects, direct products and direct sums, free groups, free lattices, Grothendieck group, completion of a metric space, completion of a ring, Dedekind–MacNeille completion, product topologies, Stone–Čech compactification, tensor products, inverse limit and direct limit, kernels and cokernels, quotient groups, quotient vector spaces, and other quotient spaces.

## Motivation

Before giving a formal definition of universal properties, we offer some motivation for studying such constructions.
* The concrete details of a given construction may be messy, but if the construction satisfies a universal property, one can forget all those details: all there is to know about the construction is already contained in the universal property. Proofs often become short and elegant if the universal property is used rather than the concrete details. For example, the tensor algebra of a vector space is slightly complicated to construct, but much easier to deal with by its universal property.
* Universal properties define objects uniquely up to a unique isomorphism. Therefore, one strategy to prove that two objects are isomorphic is to show that they satisfy the same universal property.
* Universal constructions are functorial in nature: if one can carry out the construction for every object in a category C then one obtains a functor on C. Furthermore, this functor is a right or left adjoint to the functor U used in the definition of the universal property.
* Universal properties occur everywhere in mathematics. By understanding their abstract properties, one obtains information about all these constructions and can avoid repeating the same analysis for each individual instance.

## Formal definition

To understand the definition of a universal construction, it is important to look at examples. Universal constructions were not defined out of thin air, but were rather defined after mathematicians began noticing a pattern in many mathematical constructions (see Examples below). Hence, the definition may not make sense to one at first, but will become clear when one reconciles it with concrete examples.
Let $F:{\mathcal {C}}\to {\mathcal {D}}$ be a functor between categories ${\mathcal {C}}$ and ${\mathcal {D}}$. In what follows, let $X$ be an object of ${\mathcal {D}}$, $A$ and $A'$ be objects of ${\mathcal {C}}$, and $h:A\to A'$ be a morphism in ${\mathcal {C}}$.
Then, the functor $F$ maps $A$, $A'$ and $h$ in ${\mathcal {C}}$ to $F(A)$, $F(A')$ and $F(h)$ in ${\mathcal {D}}$.
A universal morphism from $X$ to $F$ is a unique pair $(A,u:X\to F(A))$ in ${\mathcal {D}}$ which has the following property, commonly referred to as a universal property:
For any morphism of the form $f:X\to F(A')$ in ${\mathcal {D}}$, there exists a unique morphism $h:A\to A'$ in ${\mathcal {C}}$ such that the following diagram commutes:
We can dualize this categorical concept. A universal morphism from $F$ to $X$ is a unique pair $(A,u:F(A)\to X)$ that satisfies the following universal property:
For any morphism of the form $f:F(A')\to X$ in ${\mathcal {D}}$, there exists a unique morphism $h:A'\to A$ in ${\mathcal {C}}$ such that the following diagram commutes:
Note that in each definition, the arrows are reversed. Both definitions are necessary to describe universal constructions which appear in mathematics; but they also arise due to the inherent duality present in category theory. In either case, we say that the pair $(A,u)$ which behaves as above satisfies a universal property.

## Connection with comma categories

Universal morphisms can be described more concisely as initial and terminal objects in a comma category (i.e. one where morphisms are seen as objects in their own right).
Let $F:{\mathcal {C}}\to {\mathcal {D}}$ be a functor and $X$ an object of ${\mathcal {D}}$. Then recall that the comma category $(X\downarrow F)$ is the category where
* Objects are pairs of the form $(B,f:X\to F(B))$, where $B$ is an object in ${\mathcal {C}}$
* A morphism from $(B,f:X\to F(B))$ to $(B',f':X\to F(B'))$ is given by a morphism $h:B\to B'$ in ${\mathcal {C}}$ such that the diagram commutes:
Now suppose that the object $(A,u:X\to F(A))$ in $(X\downarrow F)$ is initial. Then for every object $(A',f:X\to F(A'))$, there exists a unique morphism $h:A\to A'$ such that the following diagram commutes.
Note that the equality here simply means the diagrams are the same. Also note that the diagram on the right side of the equality is the exact same as the one offered in defining a universal morphism from $X$ to $F$. Therefore, we see that a universal morphism from $X$ to $F$ is equivalent to an initial object in the comma category $(X\downarrow F)$.
Conversely, recall that the comma category $(F\downarrow X)$ is the category where
* Objects are pairs of the form $(B,f:F(B)\to X)$ where $B$ is an object in ${\mathcal {C}}$
* A morphism from $(B,f:F(B)\to X)$ to $(B',f':F(B')\to X)$ is given by a morphism $h:B\to B'$ in ${\mathcal {C}}$ such that the diagram commutes:
Suppose $(A,u:F(A)\to X)$ is a terminal object in $(F\downarrow X)$. Then for every object $(A',f:F(A')\to X)$, there exists a unique morphism $h:A'\to A$ such that the following diagrams commute.
The diagram on the right side of the equality is the same diagram pictured when defining a universal morphism from $F$ to $X$. Hence, a universal morphism from $F$ to $X$ corresponds with a terminal object in the comma category $(F\downarrow X)$.

## Examples

Below are a few examples, to highlight the general idea. The reader can construct numerous other examples by consulting the articles mentioned in the introduction.

### Tensor algebras

Let ${\mathcal {C}}$ be the category of vector spaces $K$-Vect over a field $K$ and let ${\mathcal {D}}$ be the category of algebras $K$-Alg over $K$ (assumed to be unital and associative). Let
    $U$ : $K$-Alg → $K$-Vect
be the forgetful functor which assigns to each algebra its underlying vector space.
Given any vector space $V$ over $K$ we can construct the tensor algebra $T(V)$. The tensor algebra is characterized by the fact:
    “Any linear map from $V$ to an algebra $A$ can be uniquely extended to an algebra homomorphism from $T(V)$ to $A$.”
This statement is an initial property of the tensor algebra since it expresses the fact that the pair $(T(V),i)$, where $i:V\to U(T(V))$ is the inclusion map, is a universal morphism from the vector space $V$ to the functor $U$.
Since this construction works for any vector space $V$, we conclude that $T$ is a functor from $K$-Vect to $K$-Alg. This means that $T$ is left adjoint to the forgetful functor $U$ (see the section below on relation to adjoint functors).

### Products

A categorical product can be characterized by a universal construction. For concreteness, one may consider the Cartesian product in Set, the direct product in Grp, or the product topology in Top, where products exist.
Let $X$ and $Y$ be objects of a category ${\mathcal {C}}$ with finite products. The product of $X$ and $Y$ is an object $X$ × $Y$ together with two morphisms
    $\pi _{1}$ : $X\times Y\to X$
    $\pi _{2}$ : $X\times Y\to Y$
such that for any other object $Z$ of ${\mathcal {C}}$ and morphisms $f:Z\to X$ and $g:Z\to Y$ there exists a unique morphism $h:Z\to X\times Y$ such that $f=\pi _{1}\circ h$ and $g=\pi _{2}\circ h$.
To understand this characterization as a universal property, take the category ${\mathcal {D}}$ to be the product category ${\mathcal {C}}\times {\mathcal {C}}$ and define the diagonal functor
    $\Delta :{\mathcal {C}}\to {\mathcal {C}}\times {\mathcal {C}}$
by $\Delta (X)=(X,X)$ and $\Delta (f:X\to Y)=(f,f)$. Then $(X\times Y,(\pi _{1},\pi _{2}))$ is a universal morphism from $\Delta$ to the object $(X,Y)$ of ${\mathcal {C}}\times {\mathcal {C}}$: if $(f,g)$ is any morphism from $(Z,Z)$ to $(X,Y)$, then it must equal a morphism $\Delta (h:Z\to X\times Y)=(h,h)$ from $\Delta (Z)=(Z,Z)$ to $\Delta (X\times Y)=(X\times Y,X\times Y)$ followed by $(\pi _{1},\pi _{2})$. As a commutative diagram:
For the example of the Cartesian product in Set, the morphism $(\pi _{1},\pi _{2})$ comprises the two projections $\pi _{1}(x,y)=x$ and $\pi _{2}(x,y)=y$. Given any set $Z$ and functions $f,g$ the unique map such that the required diagram commutes is given by $h=\langle x,y\rangle (z)=(f(z),g(z))$.

### Limits and colimits

Categorical products are a particular kind of limit in category theory. One can generalize the above example to arbitrary limits and colimits.
Let ${\mathcal {J}}$ and ${\mathcal {C}}$ be categories with ${\mathcal {J}}$ a small index category and let ${\mathcal {C}}^{\mathcal {J}}$ be the corresponding functor category. The diagonal functor
    $\Delta :{\mathcal {C}}\to {\mathcal {C}}^{\mathcal {J}}$
is the functor that maps each object $N$ in ${\mathcal {C}}$ to the constant functor $\Delta (N):{\mathcal {J}}\to {\mathcal {C}}$ (i.e. $\Delta (N)(X)=N$ for each $X$ in ${\mathcal {J}}$ and $\Delta (N)(f)=1_{N}$ for each $f:X\to Y$ in ${\mathcal {J}}$) and each morphism $f:N\to M$ in ${\mathcal {C}}$ to the natural transformation $\Delta (f):\Delta (N)\to \Delta (M)$ in ${\mathcal {C}}^{\mathcal {J}}$ defined as, for every object $X$ of ${\mathcal {J}}$, the component $\Delta (f)(X):\Delta (N)(X)\to \Delta (M)(X)=f:N\to M$ at $X$. In other words, the natural transformation is the one defined by having constant component $f:N\to M$ for every object of ${\mathcal {J}}$.
Given a functor $F:{\mathcal {J}}\to {\mathcal {C}}$ (thought of as an object in ${\mathcal {C}}^{\mathcal {J}}$), the limit of $F$, if it exists, is nothing but a universal morphism from $\Delta$ to $F$. Dually, the colimit of $F$ is a universal morphism from $F$ to $\Delta$.

## Properties
### Existence and uniqueness

Defining a quantity does not guarantee its existence. Given a functor $F:{\mathcal {C}}\to {\mathcal {D}}$ and an object $X$ of ${\mathcal {D}}$, there may or may not exist a universal morphism from $X$ to $F$. If, however, a universal morphism $(A,u)$ does exist, then it is essentially unique. Specifically, it is unique up to a unique isomorphism: if $(A',u')$ is another pair, then there exists a unique isomorphism $k:A\to A'$ such that $u'=F(k)\circ u$. This is easily seen by substituting $(A,u')$ in the definition of a universal morphism.
It is the pair $(A,u)$ which is essentially unique in this fashion. The object $A$ itself is only unique up to isomorphism. Indeed, if $(A,u)$ is a universal morphism and $k:A\to A'$ is any isomorphism then the pair $(A',u')$, where $u'=F(k)\circ u$ is also a universal morphism.

### Equivalent formulations

The definition of a universal morphism can be rephrased in a variety of ways. Let $F:{\mathcal {C}}\to {\mathcal {D}}$ be a functor and let $X$ be an object of ${\mathcal {D}}$. Then the following statements are equivalent:
* $(A,u)$ is a universal morphism from $X$ to $F$
* $(A,u)$ is an initial object of the comma category $(X\downarrow F)$
* $(A,F(\bullet )\circ u)$ is a representation of ${\text{Hom}}_{\mathcal {D}}(X,F(-))$, where its components $(F(\bullet )\circ u)_{B}:{\text{Hom}}_{\mathcal {C}}(A,B)\to {\text{Hom}}_{\mathcal {D}}(X,F(B))$ are defined by
$(F(\bullet )\circ u)_{B}(f:A\to B):X\to F(B)=F(f)\circ u:X\to F(B)$
for each object $B$ in ${\mathcal {C}}.$
The dual statements are also equivalent:
* $(A,u)$ is a universal morphism from $F$ to $X$
* $(A,u)$ is a terminal object of the comma category $(F\downarrow X)$
* $(A,u\circ F(\bullet ))$ is a representation of ${\text{Hom}}_{\mathcal {D}}(F(-),X)$, where its components $(u\circ F(\bullet ))_{B}:{\text{Hom}}_{\mathcal {C}}(B,A)\to {\text{Hom}}_{\mathcal {D}}(F(B),X)$ are defined by
$(u\circ F(\bullet ))_{B}(f:B\to A):F(B)\to X=u\circ F(f):F(B)\to X$
for each object $B$ in ${\mathcal {C}}.$

### Relation to adjoint functors

Suppose $(A_{1},u_{1})$ is a universal morphism from $X_{1}$ to $F$ and $(A_{2},u_{2})$ is a universal morphism from $X_{2}$ to $F$. By the universal property of universal morphisms, given any morphism $h:X_{1}\to X_{2}$ there exists a unique morphism $g:A_{1}\to A_{2}$ such that the following diagram commutes:
If every object $X_{i}$ of ${\mathcal {D}}$ admits a universal morphism to $F$, then the assignment $X_{i}\mapsto A_{i}$ and $h\mapsto g$ defines a functor $G:{\mathcal {D}}\to {\mathcal {C}}$. The maps $u_{i}$ then define a natural transformation from $1_{\mathcal {D}}$ (the identity functor on ${\mathcal {D}}$) to $F\circ G$. The functors $(F,G)$ are then a pair of adjoint functors, with $G$ left-adjoint to $F$ and $F$ right-adjoint to $G$.
Similar statements apply to the dual situation of terminal morphisms from $F$. If such morphisms exist for every $X$ in ${\mathcal {C}}$ one obtains a functor $G:{\mathcal {C}}\to {\mathcal {D}}$ which is right-adjoint to $F$ (so $F$ is left-adjoint to $G$).
Indeed, all pairs of adjoint functors arise from universal constructions in this manner. Let $F$ and $G$ be a pair of adjoint functors with unit $\eta$ and co-unit $\epsilon$ (see the article on adjoint functors for the definitions). Then we have a universal morphism for each object in ${\mathcal {C}}$ and ${\mathcal {D}}$:
* For each object $X$ in ${\mathcal {C}}$, $(F(X),\eta _{X})$ is a universal morphism from $X$ to $G$. That is, for all $f:X\to G(Y)$ there exists a unique $g:F(X)\to Y$ for which the following diagrams commute.
* For each object $Y$ in ${\mathcal {D}}$, $(G(Y),\epsilon _{Y})$ is a universal morphism from $F$ to $Y$. That is, for all $g:F(X)\to Y$ there exists a unique $f:X\to G(Y)$ for which the following diagrams commute.
Universal constructions are more general than adjoint functor pairs: a universal construction is like an optimization problem; it gives rise to an adjoint pair if and only if this problem has a solution for every object of ${\mathcal {C}}$ (equivalently, every object of ${\mathcal {D}}$).

## History

Universal properties of various topological constructions were presented by Pierre Samuel in 1948. They were later used extensively by Bourbaki. The closely related concept of adjoint functors was introduced independently by Daniel Kan in 1958.