limits and colimits by example

This entry lists and discusses examples and special types of the universal constructions called limits and colimits.

It starts with very elementary and simple examples and eventually passes to more sophisticated ones.

For examples of the other kinds of universal constructions see


Limits and colimits of sets

In the category Set of sets, the concepts of limits and colimits reduce to the familiar operations of


Terminal object

The terminal object is the limit of the empty functor F:SetF: \emptyset \to Set. So a terminal object of SetSet is a set XX such that there is a unqiue function from any set to XX. This is given by any singleton set {a}\{a\}, where the unique function Y{a}Y \to \{a\} from any set YY is the function that sends every element in YY to aa.


Given two sets A,BA, B, the categorical product is the limit of the diagram (with no non-trivial maps)

A B. \array{ A & B }.

This is given by the usual product of sets, which can be constructed as the set of Kuratowski pairs

A×B={{{a},{a,b}}:aA,bB}. A \times B = \{ \{\{a\}, \{a, b\}\}: a \in A, b \in B\}.

We tend to write (a,b)(a, b) instead of {{a},{a,b}}\{\{a\}, \{a, b\}\}.

The projection maps π 1:A×BA\pi_1: A \times B \to A and π 2:A×BB\pi_2: A \times B \to B are given by

π 1(a,b)=a,π 2(a,b)=b. \pi_1(a, b) = a, \pi_2(a, b) = b.

To see this satisfies the universal property of products, given any pair of maps f:XAf: X \to A and g:XBg: X \to B, we obtain a map (f,g):XA×B(f, g): X \to A \times B given by

(f,g)(x)=(f(x),g(x)). (f, g)(x) = (f(x), g(x)).

More generally, given a (possibility infinite) collection of sets {A α} αI\{A_\alpha\}_{\alpha \in I}, the product of the discrete diagram consisting of these sets is the usual product αIA α\prod_{\alpha \in I} A_\alpha. This can be constructed as

αIA α={f:I αIA αf(α)A α for all αI}. \prod_{\alpha \in I} A_\alpha = \left\{f: I \to \bigcup_{\alpha \in I} A_\alpha \mid f(\alpha) \in A_\alpha\;\text{ for all }\;\alpha \in I\right\}.


Given a pair of functions f,g:XYf, g: X \to Y, the equalizer is the limit of the diagram

X fg Y. \array{ X & \underset{g}{\overset{f}{\rightrightarrows}} & Y }.

The limit is given by a map e:AXe: A \to X such that given any a:BXa: B \to X, it factors through ee if and only if fa=gaf \circ a = g \circ a. In other words, aa factors through ee if and only if ima{xX:f(x)=g(x)}\im a \subseteq \{x \in X: f(x) = g(x)\}. Thus the limit of the diagram is given by

A={xX:f(x)=g(x)}, A = \{x \in X: f(x) = g(x)\},

and the map e:AXe: A \to X is given by the inclusion.


Given two maps f:ACf: A \to C and g:BCg: B \to C, the pullback is the limit of the diagram

A f B g C. \array{ & & A\\ & & \downarrow^\mathrlap{f}\\ B & \underset{g}{\to} & C }.

This limit is given by

{(a,b)A×B:f(a)=g(b)}, \{(a, b) \in A \times B: f(a) = g(b)\},

with the maps to AA and BB given by the projections.

While the definition of a pullback is symmetric in ff and gg, it is usually convenient to think of this as pulling back ff along gg (or the other way round). This has more natural interpretations in certain special cases.

If g:BCg: B \to C is the inclusion of a subset (ie. is a monomorphism), then the pullback of ff along gg is given by

{aA:g(a)B}. \{a \in A: g(a) \in B\}.

So this is given by restricting ff to the elements that are mapped into BB.

Further, if f:ACf: A \to C is also the inclusion fo a subset, so that AA and BB are both subobjects of CC, then the above formula tells us that the pullback is simply the intersection of the two subsets.

Alternatively, we can view the map f:ACf: A \to C as a collection of sets indexed by elements of CC, where the set indexed by cCc \in C is given by A c=f 1(c)A_c = f^{-1}(c). Under this interpretation, pulling ff back along gg gives a collection of sets indexed by elements of BB, where the set indexed by bBb \in B is given b A g(b)A_{g(b)}.

General limits

Given a general Set-valued functor F:DSetF : D \to Set, if the limit limFlim F exists, then by definition, for any set AA, a function f:AlimFf: A \to lim F is equivalent to a compatible family of maps f d:AF(d)f_d: A \to F(d) for each dObj(d)d \in Obj(d).

In particular, since an element of a set XX bijects with maps 1X1 \to X from the singleton 1={}1 = \{\emptyset\}, we have

limFSet(1,limF)[D,Set](const 1,F), lim F \cong Set (1, lim F) \cong [D, Set](const_1, F),

where const 1const_1 is the functor that constantly takes the value 11. Thus the limit is given by the set of natural transformations from const 1const_1 to FF.

More concretely, a compatible family of maps 1F(d)1 \to F(d) is given by an element s dF(d)s_d \in F(d) for each dObj(d)d \in Obj(d), satisfying the appropriate compatibility conditions. Thus, the limit can be realized as a subset of the product dObj(d)F(d)\prod_{d \in Obj(d)} F(d) of all objects:

limF={(s d) d dF(d)|(dfd):F(f)(s d)=s d}. lim F = \left\{ (s_d)_d \in \prod_d F(d) | \forall (d \stackrel{f}{\to} d') : F(f)(s_{d}) = s_{d'} \right\}.


Initial object

The initial object in SetSet is a set XX such that there is a unique map from XX to any other set. This is given by the empty set \emptyset.







General colimits

The colimit over a Set-valued functor F:DSetF : D \to Set is a quotient set of the disjoint union dObj(D)D(d)\coprod_{d \in Obj(D)} D(d):

colimF( dDF(d))/ , colim F \simeq \left(\coprod_{d\in D} F(d)\right)/_\sim \,,

where the equivalence relation \sim is that which is generated by

((xF(d))(xF(d)))if((f:dd)withF(f)(x)=x). ((x \in F(d)) \sim (x' \in F(d')))\quad if \quad (\exists (f : d \to d') with F(f)(x) = x') \,.

If DD is a filtered category then the relation \sim already is an equivalence relation.

Limits and colimits of topological spaces

We discuss limits and colimits in the category Top of topological spaces.


examples of universal constructions of topological spaces:

\, point space\,\, empty space \,
\, product topological space \,\, disjoint union topological space \,
\, topological subspace \,\, quotient topological space \,
\, fiber space \,\, space attachment \,
\, mapping cocylinder, mapping cocone \,\, mapping cylinder, mapping cone, mapping telescope \,
\, cell complex, CW-complex \,



Let {X i=(S i,τ i)Top} iI\{X_i = (S_i,\tau_i) \in Top\}_{i \in I} be a class of topological spaces, and let SSetS \in Set be a bare set. Then

  • For {Sf iS i} iI\{S \stackrel{f_i}{\to} S_i \}_{i \in I} a set of functions out of SS, the initial topology τ initial({f i} iI)\tau_{initial}(\{f_i\}_{i \in I}) is the topology on SS with the minimum collection of open subsets such that all f i:(S,τ initial({f i} iI))X if_i \colon (S,\tau_{initial}(\{f_i\}_{i \in I}))\to X_i are continuous.

  • For {S if iS} iI\{S_i \stackrel{f_i}{\to} S\}_{i \in I} a set of functions into SS, the final topology τ final({f i} iI)\tau_{final}(\{f_i\}_{i \in I}) is the topology on SS with the maximum collection of open subsets such that all f i:X i(S,τ final({f i} iI))f_i \colon X_i \to (S,\tau_{final}(\{f_i\}_{i \in I})) are continuous.


For XX a single topological space, and ι S:SU(X)\iota_S \colon S \hookrightarrow U(X) a subset of its underlying set, then the initial topology τ intial(ι S)\tau_{intial}(\iota_S), def. 1, is the subspace topology, making

ι S:(S,τ initial(ι S))X \iota_S \;\colon\; (S, \tau_{initial}(\iota_S)) \hookrightarrow X

a topological subspace inclusion.


Conversely, for p S:U(X)Sp_S \colon U(X) \longrightarrow S an epimorphism, then the final topology τ final(p S)\tau_{final}(p_S) on SS is the quotient topology.


Let II be a small category and let X :ITopX_\bullet \colon I \longrightarrow Top be an II-diagram in Top (a functor from II to TopTop), with components denoted X i=(S i,τ i)X_i = (S_i, \tau_i), where S iSetS_i \in Set and τ i\tau_i a topology on S iS_i. Then:

  1. The limit of X X_\bullet exists and is given by the topological space whose underlying set is the limit in Set of the underlying sets in the diagram, and whose topology is the initial topology, def. 1, for the functions p ip_i which are the limiting cone components:

    lim iIS i p i p j S i S j. \array{ && \underset{\longleftarrow}{\lim}_{i \in I} S_i \\ & {}^{\mathllap{p_i}}\swarrow && \searrow^{\mathrlap{p_j}} \\ S_i && \underset{}{\longrightarrow} && S_j } \,.


    lim iIX i(lim iIS i,τ initial({p i} iI)) \underset{\longleftarrow}{\lim}_{i \in I} X_i \simeq \left(\underset{\longleftarrow}{\lim}_{i \in I} S_i,\; \tau_{initial}(\{p_i\}_{i \in I})\right)
  2. The colimit of X X_\bullet exists and is the topological space whose underlying set is the colimit in Set of the underlying diagram of sets, and whose topology is the final topology, def. 1 for the component maps ι i\iota_i of the colimiting cocone

    S i S j ι i ι j lim iIS i. \array{ S_i && \longrightarrow && S_j \\ & {}_{\mathllap{\iota_i}}\searrow && \swarrow_{\mathrlap{\iota_j}} \\ && \underset{\longrightarrow}{\lim}_{i \in I} S_i } \,.


    lim iIX i(lim iIS i,τ final({ι i} iI)) \underset{\longrightarrow}{\lim}_{i \in I} X_i \simeq \left(\underset{\longrightarrow}{\lim}_{i \in I} S_i,\; \tau_{final}(\{\iota_i\}_{i \in I})\right)

(e.g. Bourbaki 71, section I.4)


The required universal property of (lim iIS i,τ initial({p i} iI))\left(\underset{\longleftarrow}{\lim}_{i \in I} S_i,\; \tau_{initial}(\{p_i\}_{i \in I})\right) is immediate: for

(S,τ) f i f j X i X i \array{ && (S,\tau) \\ & {}^{\mathllap{f_i}}\swarrow && \searrow^{\mathrlap{f_j}} \\ X_i && \underset{}{\longrightarrow} && X_i }

any cone over the diagram, then by construction there is a unique function of underlying sets Slim iIS iS \longrightarrow \underset{\longleftarrow}{\lim}_{i \in I} S_i making the required diagrams commute, and so all that is required is that this unique function is always continuous. But this is precisely what the initial topology ensures.

The case of the colimit is formally dual.


The limit over the empty diagram in TopTop is the point *\ast with its unique topology.


For {X i} iI\{X_i\}_{i \in I} a set of topological spaces, their coproduct iIX iTop\underset{i \in I}{\sqcup} X_i \in Top is their disjoint union.

In particular:


For SSetS \in Set, the SS-indexed coproduct of the point, sS*\underset{s \in S}{\coprod}\ast , is the set SS itself equipped with the final topology, hence is the discrete topological space on SS.


For {X i} iI\{X_i\}_{i \in I} a set of topological spaces, their product iIX iTop\underset{i \in I}{\prod} X_i \in Top is the Cartesian product of the underlying sets equipped with the product topology, also called the Tychonoff product.

In the case that SS is a finite set, such as for binary product spaces X×YX \times Y, then a sub-basis for the product topology is given by the Cartesian products of the open subsets of (a basis for) each factor space.


The equalizer of two continuous functions f,g:XYf, g \colon X \stackrel{\longrightarrow}{\longrightarrow} Y in TopTop is the equalizer of the underlying functions of sets

eq(f,g)S XgfS Y eq(f,g) \hookrightarrow S_X \stackrel{\overset{f}{\longrightarrow}}{\underset{g}{\longrightarrow}} S_Y

(hence the largets subset of S XS_X on which both functions coincide) and equipped with the subspace topology, example 1.


The coequalizer of two continuous functions f,g:XYf, g \colon X \stackrel{\longrightarrow}{\longrightarrow} Y in TopTop is the coequalizer of the underlying functions of sets

S XgfS Ycoeq(f,g) S_X \stackrel{\overset{f}{\longrightarrow}}{\underset{g}{\longrightarrow}} S_Y \longrightarrow coeq(f,g)

(hence the quotient set by the equivalence relation generated by f(x)g(x)f(x) \sim g(x) for all xXx \in X) and equipped with the quotient topology, example 2.



A g Y f X \array{ A &\overset{g}{\longrightarrow}& Y \\ {}^{\mathllap{f}}\downarrow \\ X }

two continuous functions out of the same domain, then the colimit under this diagram is also called the pushout, denoted

A g Y f g *f X X AY.. \array{ A &\overset{g}{\longrightarrow}& Y \\ {}^{\mathllap{f}}\downarrow && \downarrow^{\mathrlap{g_\ast f}} \\ X &\longrightarrow& X \sqcup_A Y \,. } \,.

(Here g *fg_\ast f is also called the pushout of ff, or the cobase change of ff along gg.) If gg is an inclusion, one also write X fYX \cup_f Y and calls this the attaching space.

By example 8 the pushout/attaching space is the quotient topological space

X AY(XY)/ X \sqcup_A Y \simeq (X\sqcup Y)/\sim

of the disjoint union of XX and YY subject to the equivalence relation which identifies a point in XX with a point in YY if they have the same pre-image in AA.

(graphics from Aguilar-Gitler-Prieto 02)


As an important special case of example 9, let

i n:S n1D n i_n \colon S^{n-1}\longrightarrow D^n

be the canonical inclusion of the standard (n-1)-sphere as the boundary of the standard n-disk (both regarded as topological spaces with their subspace topology as subspaces of the Cartesian space n\mathbb{R}^n).

Then the colimit in Top under the diagram, i.e. the pushout of i ni_n along itself,

{D ni nS n1i nD n}, \left\{ D^n \overset{i_n}{\longleftarrow} S^{n-1} \overset{i_n}{\longrightarrow} D^n \right\} \,,

is the n-sphere S nS^n:

S n1 i n D n i n (po) D n S n. \array{ S^{n-1} &\overset{i_n}{\longrightarrow}& D^n \\ {}^{\mathllap{i_n}}\downarrow &(po)& \downarrow \\ D^n &\longrightarrow& S^n } \,.

(graphics from Ueno-Shiga-Morita 95)


Limits and colimits in a preordered set


Limits and colimits in functor categories


Examples of limits

In the following examples, DD is a small category, CC is any category and the limit is taken over a functor F:D opCF : D^{op} \to C.

Simple diagrams

  • the limit of the empty diagram D=D = \emptyset in CC is, if it exists the terminal object;

  • if DD is a discrete category, i.e. a category with only identity morphisms, then a diagram F:DCF : D \to C is just a collection c ic_i of objects of CC. Its limit is the product ic i\prod_i c_i of these.

  • if D={ab}D = \{a \stackrel{\to}{\to} b\} then limFlim F is the equalizer of the two morphisms F(b)F(a)F(b) \to F(a).

  • if DD has an terminal object II (so that II is an initial object in D opD^{op}), then the limit of any F:D opCF : D^{op} \to C is F(I)F(I).

Filtered limits

  • if DD is a poset, then the limit over D opD^{op} is the supremum over the F(d)F(d) with respect to (F(d)F(d))(F(d)F()F(d))(F(d) \leq F(d')) \Leftrightarrow (F(d) \stackrel{F(\leq)}{\leftarrow} F(d'));

  • the generalization of this is where the term “limit” for categorical limit (probably) originates from: for DD a filtered category, hence D opD^{op} a cofiltered category, one may think of (dfd)(F(d)F(f)F(d)(d \stackrel{f}{\to} d') \mapsto (F(d) \stackrel{F(f)}{\leftarrow} F(d') as witnessing that F(d)F(d') is “larger than” F(d)F(d) in some sense, and limFlim F is then the “largest” of all these objects, the limiting object. This interpretation is perhaps more evident for filtered colimits, where the codomain category CC is thought of as being the opposite C=E opC = E^{op}. See the motivation at ind-object.

In terms of other operations

If products and equalizers exist in CC, then limit of F:D opCF : D^{op} \to C can be exhibited as a subobject of the product of the F(d)F(d), namely the equalizer of

dObj(D)F(d)F(f)p F(t(f)) fMor(D) fMor(D)F(s(f)) \prod_{d \in Obj(D)} F(d) \stackrel{\langle F(f) \circ p_{F(t(f))} \rangle_{f \in Mor(D)} }{\to} \prod_{f \in Mor(D)} F(s(f))


dObj(D)F(d)p F(s(f)) fMor(D) fMor(D)F(s(f)). \prod_{d \in Obj(D)} F(d) \stackrel{\langle p_{F(s(f))} \rangle_{f \in Mor(D)} }{\to} \prod_{f \in Mor(D)} F(s(f)) \,.

See the explicit formula for the limit in Set in terms of a subset of a product set.

In particular therefore, a category has all limits already if it has all products and equalizers.

Limits in presheaf categories

Consider limits of functors F:D opPSh(C)F : D^{op} \to PSh(C) with values in the category of presheaves on a small category CC.


Limits of presheaves are computed objectwise:

limF:climF()(c) lim F : c \mapsto lim F(-)(c)

Here on the right the limit is over the functor F()(c):D opSetF(-)(c) : D^{op} \to Set.

Similarly for colimits

Similarly colimits of presheaves are computed objectwise.


The Yoneda embedding Y:CPSh(C)Y : C \to PSh(C) commutes with small limits:

Let F:D opCF : D^{op} \to C, then we have

Y(limF)lim(YF) Y(lim F) \simeq lim (Y\circ F)

if limFlim F exists.

Warning The Yoneda embedding does not in general preserve colimits.

Limits in under-categories

Limits in under categories are a special case of limits in comma categories. These are explained elsewhere. It may still be useful to spell out some details for the special case of under-categories. This is what the following does.


Limits in an under category are computed as limits in the underlying category.

Precisely: let CC be a category, tCt \in C an object, and t/Ct/C the corresponding under category, and p:t/CCp : t/C \to C the obvious projection.

Let F:Dt/CF : D \to t/C be any functor. Then, if it exists, the limit over pFp \circ F in CC is the image under pp of the limit over FF:

p(limF)lim(pF) p(\lim F) \simeq \lim (p F)

and limF\lim F is uniquely characterized by lim(pF)\lim (p F).


Over a morphism γ:dd\gamma : d \to d' in DD the limiting cone over pFp F (which exists by assumption) looks like

limpF pF(d) pF(γ) pF(d) \array{ && \lim p F \\ & \swarrow && \searrow \\ p F(d) &&\stackrel{p F(\gamma)}{\to}&& p F(d') }

By the universal property of the limit this has a unique lift to a cone in the under category t/Ct/C over FF:

t limpF pF(d) pF(γ) pF(d) \array{ && t \\ & \swarrow &\downarrow & \searrow \\ && \lim p F \\ \downarrow & \swarrow && \searrow & \downarrow \\ p F(d) &&\stackrel{p F(\gamma)}{\to}&& p F(d') }

It therefore remains to show that this is indeed a limiting cone over FF. Again, this is immediate from the universal property of the limit in CC. For let tQt \to Q be another cone over FF in t/Ct/C, then QQ is another cone over pFp F in CC and we get in CC a universal morphism QlimpFQ \to \lim p F

t Q limpF pF(d) pF(γ) pF(d) \array{ && t \\ & \swarrow & \downarrow & \searrow \\ && Q \\ \downarrow & \swarrow &\downarrow & \searrow & \downarrow \\ && \lim p F \\ \downarrow & \swarrow && \searrow & \downarrow \\ p F(d) &&\stackrel{p F(\gamma)}{\to}&& p F(d') }

A glance at the diagram above shows that the composite tQlimpFt \to Q \to \lim p F constitutes a morphism of cones in CC into the limiting cone over pFp F. Hence it must equal our morphism tlimpFt \to \lim p F, by the universal property of limpF\lim p F, and hence the above diagram does commute as indicated.

This shows that the morphism QlimpFQ \to \lim p F which was the unique one giving a cone morphism on CC does lift to a cone morphism in t/Ct/C, which is then necessarily unique, too. This demonstrates the required universal property of tlimpFt \to \lim p F and thus identifies it with limF\lim F.

  • Remark: One often says “pp reflects limits” to express the conclusion of this proposition. A conceptual way to consider this result is by appeal to a more general one: if U:ACU: A \to C is monadic (i.e., has a left adjoint FF such that the canonical comparison functor A(UF)AlgA \to (U F)-Alg is an equivalence), then UU both reflects and preserves limits. In the present case, the projection p:A=t/CCp: A = t/C \to C is monadic, is essentially the category of algebras for the monad T()=t+()T(-) = t + (-), at least if CC admits binary coproducts. (Added later: the proof is even simpler: if U:ACU: A \to C is the underlying functor for the category of algebras of an endofunctor on CC (as opposed to algebras of a monad), then UU reflects and preserves limits; then apply this to the endofunctor TT above.)

Further resources

Pedagogical vidoes that explain limits and colimits are at

A web-based program that generates componentwise illustrations of simple limits and colimits in Set is developed at

More on the inner workings of this program is at Paine on a Category Theory Demonstrations program


the following discussion originated from an earler version of this entry

Todd Trimble: So far, this is a really good article. However, I would not say in this last line “if either limit exists”, because small limits on the right certainly exist always since SetSet is complete; instead, “if limFlim F exists”.

Urs: thanks, Todd, I have changed the above now accordingly. Please don’t hesitate to correct and/or improve things you see as needed.

By the way, I am not completely happy with this entry as yet. It was originally motivated from the desire to explain in small steps the computation of limits and colimits to those readers unfamiliar with it. Currently this here mostly just lists results, where maybe we would eventually want to include also pedagocial proofs.

The material below “explanation for programmers” goes more in that pedagogical direction, though I’d think eventually it would be good to also have the kind of pedestrian explanation given there but without (at first) its realization in Python! :-)

an earlier version of this entry, which contained the material now branched off at Paine on a Category Theory Demonstrations program, led to the following discussion

Urs Schreiber: sorry to say this, but I am not so happy with the following material here at this particular entry. This entry here is supposed to explain limits and colimits. Originally I thought that the computer program described below should be used here to help explain limits and colimits. For instance by using its graphical output for illustration purposes. But instead the material below explains how to write that program . That may be of interest, too, but here at this entry it seems a bit of a distraction. Could we move the following material to its seperate entry?

Toby: I would agree that the material on how to write the program would work well in a separate entry, say programming coproducts?. On the other hand, you definitely want to keep the first two lines here; they do just what you want and could be expanded on here.

Mark C.:

In the section on general colimits, under colimits, it stated that

The equivalence relation \sim is that which is generated by

((xF(d))(xF(d)))if((f:dd)withF(f)(x)=x). ((x \in F(d)) \sim (x' \in F(d')))\quad if \quad (\exists (f : d \to d') with F(f)(x) = x') \,.

If DD is a filtered category then the relation \sim already is an equivalence relation.

Is this true? Consider a category with two objects d,dd, d' and a single non-identity morphism f:ddf: d \rightarrow d'. Then this is a directed category.

Consider the functor F:DSetF: D \rightarrow Set taking both dd and dd' to singletons.

Then, it seems to me the unique xF(d)x \in F(d) would be related to the unique xF(d)x' \in F(d'), but the opposite relation would not hold, since there is no morphism ddd' \rightarrow d in DD. Hence symmetry fails and this is not an equivalence relation.

Am I missing something?

EDIT: I think the definition should say:

The equivalence relation \sim is that which is generated by

((xF(d))(xF(d)))if(d,(f:dd),(g:dd)withF(f)(x)=F(g)(x)). ((x \in F(d)) \sim (x' \in F(d')))\quad if \quad (\exists d'', (f : d \to d''), (g: d' \to d'') with F(f)(x) = F(g)(x')) \,.

This matches the definition of a direct limit on Wikipedia.

Revised on May 5, 2017 13:04:07 by Urs Schreiber (