limits and colimits by example

This entry lists and discusses examples and special types of limits and colimits, hence also in particular of products and coproducts.

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

For examples of the other universal constructions see


Limits and colimits in Set

In the category Set of sets, limits and colimits reduce to the very 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 in Grp


Limits and colimits in Top


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 November 2, 2016 10:48:00 by Mark C.? (