# The Stacks Project

## Tag 002D

### 4.14. Limits and colimits

Let $\mathcal{C}$ be a category. A diagram in $\mathcal{C}$ is simply a functor $M : \mathcal{I} \to \mathcal{C}$. We say that $\mathcal{I}$ is the index category or that $M$ is an $\mathcal{I}$-diagram. We will use the notation $M_i$ to denote the image of the object $i$ of $\mathcal{I}$. Hence for $\phi : i \to i'$ a morphism in $\mathcal{I}$ we have $M(\phi) : M_i \to M_{i'}$.

Definition 4.14.1. A limit of the $\mathcal{I}$-diagram $M$ in the category $\mathcal{C}$ is given by an object $\mathop{\mathrm{lim}}\nolimits_\mathcal{I} M$ in $\mathcal{C}$ together with morphisms $p_i : \mathop{\mathrm{lim}}\nolimits_\mathcal{I} M \to M_i$ such that

1. for $\phi : i \to i'$ a morphism in $\mathcal{I}$ we have $p_{i'} = M(\phi) \circ p_i$, and
2. for any object $W$ in $\mathcal{C}$ and any family of morphisms $q_i : W \to M_i$ (indexed by $i \in \mathcal{I}$) such that for all $\phi : i \to i'$ in $\mathcal{I}$ we have $q_{i'} = M(\phi) \circ q_i$ there exists a unique morphism $q : W \to \mathop{\mathrm{lim}}\nolimits_\mathcal{I} M$ such that $q_i = p_i \circ q$ for every object $i$ of $\mathcal{I}$.

Limits $(\mathop{\mathrm{lim}}\nolimits_\mathcal{I} M, (p_i)_{i\in \mathop{\mathrm{Ob}}\nolimits(\mathcal{I})})$ are (if they exist) unique up to unique isomorphism by the uniqueness requirement in the definition. Products of pairs, fibred products, and equalizers are examples of limits. The limit over the empty diagram is a final object of $\mathcal{C}$. In the category of sets all limits exist. The dual notion is that of colimits.

Definition 4.14.2. A colimit of the $\mathcal{I}$-diagram $M$ in the category $\mathcal{C}$ is given by an object $\mathop{\mathrm{colim}}\nolimits_\mathcal{I} M$ in $\mathcal{C}$ together with morphisms $s_i : M_i \to \mathop{\mathrm{colim}}\nolimits_\mathcal{I} M$ such that

1. for $\phi : i \to i'$ a morphism in $\mathcal{I}$ we have $s_i = s_{i'} \circ M(\phi)$, and
2. for any object $W$ in $\mathcal{C}$ and any family of morphisms $t_i : M_i \to W$ (indexed by $i \in \mathcal{I}$) such that for all $\phi : i \to i'$ in $\mathcal{I}$ we have $t_i = t_{i'} \circ M(\phi)$ there exists a unique morphism $t : \mathop{\mathrm{colim}}\nolimits_\mathcal{I} M \to W$ such that $t_i = t \circ s_i$ for every object $i$ of $\mathcal{I}$.

Colimits $(\mathop{\mathrm{colim}}\nolimits_\mathcal{I} M, (s_i)_{i\in \mathop{\mathrm{Ob}}\nolimits(\mathcal{I})})$ are (if they exist) unique up to unique isomorphism by the uniqueness requirement in the definition. Coproducts of pairs, pushouts, and coequalizers are examples of colimits. The colimit over an empty diagram is an initial object of $\mathcal{C}$. In the category of sets all colimits exist.

Remark 4.14.3. The index category of a (co)limit will never be allowed to have a proper class of objects. In this project it means that it cannot be one of the categories listed in Remark 4.2.2

Remark 4.14.4. We often write $\mathop{\mathrm{lim}}\nolimits_i M_i$, $\mathop{\mathrm{colim}}\nolimits_i M_i$, $\mathop{\mathrm{lim}}\nolimits_{i\in \mathcal{I}} M_i$, or $\mathop{\mathrm{colim}}\nolimits_{i\in \mathcal{I}} M_i$ instead of the versions indexed by $\mathcal{I}$. Using this notation, and using the description of limits and colimits of sets in Section 4.15 below, we can say the following. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram.

1. The object $\mathop{\mathrm{lim}}\nolimits_i M_i$ if it exists satisfies the following property $$\mathop{Mor}\nolimits_\mathcal{C}(W, \mathop{\mathrm{lim}}\nolimits_i M_i) = \mathop{\mathrm{lim}}\nolimits_i \mathop{Mor}\nolimits_\mathcal{C}(W, M_i)$$ where the limit on the right takes place in the category of sets.
2. The object $\mathop{\mathrm{colim}}\nolimits_i M_i$ if it exists satisfies the following property $$\mathop{Mor}\nolimits_\mathcal{C}(\mathop{\mathrm{colim}}\nolimits_i M_i, W) = \mathop{\mathrm{lim}}\nolimits_{i\in \mathcal{I}^\text{opp}} \mathop{Mor}\nolimits_\mathcal{C}(M_i, W)$$ where on the right we have the limit over the opposite category with value in the category of sets.

By the Yoneda lemma (and its dual) this formula completely determines the limit, respectively the colimit.

As an application of the notions of limits and colimits we define products and coproducts.

Definition 4.14.5. Suppose that $I$ is a set, and suppose given for every $i \in I$ an object $M_i$ of the category $\mathcal{C}$. A product $\prod_{i\in I} M_i$ is by definition $\mathop{\mathrm{lim}}\nolimits_\mathcal{I} M$ (if it exists) where $\mathcal{I}$ is the category having only identities as morphisms and having the elements of $I$ as objects.

An important special case is where $I = \emptyset$ in which case the product is a final object of the category. The morphisms $p_i : \prod M_i \to M_i$ are called the projection morphisms.

Definition 4.14.6. Suppose that $I$ is a set, and suppose given for every $i \in I$ an object $M_i$ of the category $\mathcal{C}$. A coproduct $\coprod_{i\in I} M_i$ is by definition $\mathop{\mathrm{colim}}\nolimits_\mathcal{I} M$ (if it exists) where $\mathcal{I}$ is the category having only identities as morphisms and having the elements of $I$ as objects.

An important special case is where $I = \emptyset$ in which case the coproduct is an initial object of the category. Note that the coproduct comes equipped with morphisms $M_i \to \coprod M_i$. These are sometimes called the coprojections.

Lemma 4.14.7. Suppose that $M : \mathcal{I} \to \mathcal{C}$, and $N : \mathcal{J} \to \mathcal{C}$ are diagrams whose colimits exist. Suppose $H : \mathcal{I} \to \mathcal{J}$ is a functor, and suppose $t : M \to N \circ H$ is a transformation of functors. Then there is a unique morphism $$\theta : \mathop{\mathrm{colim}}\nolimits_\mathcal{I} M \longrightarrow \mathop{\mathrm{colim}}\nolimits_\mathcal{J} N$$ such that all the diagrams $$\xymatrix{ M_i \ar[d]_{t_i} \ar[r] & \mathop{\mathrm{colim}}\nolimits_\mathcal{I} M \ar[d]^{\theta} \\ N_{H(i)} \ar[r] & \mathop{\mathrm{colim}}\nolimits_\mathcal{J} N }$$ commute.

Proof. Omitted. $\square$

Lemma 4.14.8. Suppose that $M : \mathcal{I} \to \mathcal{C}$, and $N : \mathcal{J} \to \mathcal{C}$ are diagrams whose limits exist. Suppose $H : \mathcal{I} \to \mathcal{J}$ is a functor, and suppose $t : N \circ H \to M$ is a transformation of functors. Then there is a unique morphism $$\theta : \mathop{\mathrm{lim}}\nolimits_\mathcal{J} N \longrightarrow \mathop{\mathrm{lim}}\nolimits_\mathcal{I} M$$ such that all the diagrams $$\xymatrix{ \mathop{\mathrm{lim}}\nolimits_\mathcal{J} N \ar[d]^{\theta} \ar[r] & N_{H(i)} \ar[d]_{t_i} \\ \mathop{\mathrm{lim}}\nolimits_\mathcal{I} M \ar[r] & M_i }$$ commute.

Proof. Omitted. $\square$

Lemma 4.14.9. Let $\mathcal{I}$, $\mathcal{J}$ be index categories. Let $M : \mathcal{I} \times \mathcal{J} \to \mathcal{C}$ be a functor. We have $$\mathop{\mathrm{colim}}\nolimits_i \mathop{\mathrm{colim}}\nolimits_j M_{i, j} = \mathop{\mathrm{colim}}\nolimits_{i, j} M_{i, j} = \mathop{\mathrm{colim}}\nolimits_j \mathop{\mathrm{colim}}\nolimits_i M_{i, j}$$ provided all the indicated colimits exist. Similar for limits.

Proof. Omitted. $\square$

Lemma 4.14.10. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. Write $I = \mathop{\mathrm{Ob}}\nolimits(\mathcal{I})$ and $A = \text{Arrows}(\mathcal{I})$. Denote $s, t : A \to I$ the source and target maps. Suppose that $\prod_{i \in I} M_i$ and $\prod_{a \in A} M_{t(a)}$ exist. Suppose that the equalizer of $$\xymatrix{ \prod_{i \in I} M_i \ar@<1ex>[r]^\phi \ar@<-1ex>[r]_\psi & \prod_{a \in A} M_{t(a)} }$$ exists, where the morphisms are determined by their components as follows: $p_a \circ \psi = M(a) \circ p_{s(a)}$ and $p_a \circ \phi = p_{t(a)}$. Then this equalizer is the limit of the diagram.

Proof. Omitted. $\square$

Lemma 4.14.11. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. Write $I = \mathop{\mathrm{Ob}}\nolimits(\mathcal{I})$ and $A = \text{Arrows}(\mathcal{I})$. Denote $s, t : A \to I$ the source and target maps. Suppose that $\coprod_{i \in I} M_i$ and $\coprod_{a \in A} M_{s(a)}$ exist. Suppose that the coequalizer of $$\xymatrix{ \coprod_{a \in A} M_{s(a)} \ar@<1ex>[r]^\phi \ar@<-1ex>[r]_\psi & \coprod_{i \in I} M_i }$$ exists, where the morphisms are determined by their components as follows: The component $M_{s(a)}$ maps via $\psi$ to the component $M_{t(a)}$ via the morphism $a$. The component $M_{s(a)}$ maps via $\phi$ to the component $M_{s(a)}$ by the identity morphism. Then this coequalizer is the colimit of the diagram.

Proof. Omitted. $\square$

The code snippet corresponding to this tag is a part of the file categories.tex and is located in lines 1150–1436 (see updates for more information).

\section{Limits and colimits}
\label{section-limits}

\noindent
Let $\mathcal{C}$ be a category. A {\it diagram} in $\mathcal{C}$ is
simply a functor $M : \mathcal{I} \to \mathcal{C}$. We say that
$\mathcal{I}$ is the {\it index category} or that $M$ is an
$\mathcal{I}$-diagram. We will use the notation $M_i$ to denote the
image of the object
$i$ of $\mathcal{I}$. Hence for $\phi : i \to i'$ a morphism
in $\mathcal{I}$ we have $M(\phi) : M_i \to M_{i'}$.

\begin{definition}
\label{definition-limit}
A {\it limit} of the $\mathcal{I}$-diagram $M$ in the category
$\mathcal{C}$ is given by an object $\lim_\mathcal{I} M$ in $\mathcal{C}$
together with morphisms $p_i : \lim_\mathcal{I} M \to M_i$ such that
\begin{enumerate}
\item for $\phi : i \to i'$ a morphism
in $\mathcal{I}$ we have $p_{i'} = M(\phi) \circ p_i$, and
\item for any object $W$ in $\mathcal{C}$ and any family of
morphisms $q_i : W \to M_i$ (indexed by $i \in \mathcal{I}$)
such that for all $\phi : i \to i'$
in $\mathcal{I}$ we have $q_{i'} = M(\phi) \circ q_i$ there
exists a unique morphism $q : W \to \lim_\mathcal{I} M$ such that
$q_i = p_i \circ q$ for every object $i$ of $\mathcal{I}$.
\end{enumerate}
\end{definition}

\noindent
Limits $(\lim_\mathcal{I} M, (p_i)_{i\in \Ob(\mathcal{I})})$ are
(if they exist)
unique up to unique isomorphism by the uniqueness requirement
in the definition. Products of pairs, fibred products, and equalizers are
examples of limits. The limit over the empty diagram is a final object
of $\mathcal{C}$.
In the category of sets all limits exist.
The dual notion is that of colimits.

\begin{definition}
\label{definition-colimit}
A {\it colimit} of the $\mathcal{I}$-diagram $M$ in the category
$\mathcal{C}$ is given by an object $\colim_\mathcal{I} M$ in $\mathcal{C}$
together with morphisms $s_i : M_i \to \colim_\mathcal{I} M$ such that
\begin{enumerate}
\item for $\phi : i \to i'$ a morphism
in $\mathcal{I}$ we have $s_i = s_{i'} \circ M(\phi)$, and
\item for any object $W$ in $\mathcal{C}$ and any family of
morphisms $t_i : M_i \to W$ (indexed by $i \in \mathcal{I}$)
such that for all $\phi : i \to i'$
in $\mathcal{I}$ we have $t_i = t_{i'} \circ M(\phi)$ there
exists a unique morphism $t : \colim_\mathcal{I} M \to W$ such that
$t_i = t \circ s_i$ for every object $i$ of $\mathcal{I}$.
\end{enumerate}
\end{definition}

\noindent
Colimits $(\colim_\mathcal{I} M, (s_i)_{i\in \Ob(\mathcal{I})})$ are
(if they exist) unique up to unique isomorphism by the uniqueness requirement
in the definition. Coproducts of pairs, pushouts, and coequalizers are
examples of colimits. The colimit over an empty diagram is an initial object
of $\mathcal{C}$. In the category of sets all colimits exist.

\begin{remark}
\label{remark-diagram-small}
The index category of a (co)limit will never be allowed to have
a proper class of objects. In this project it means that
it cannot be one of the categories listed in
Remark \ref{remark-big-categories}
\end{remark}

\begin{remark}
\label{remark-limit-colim}
We often write $\lim_i M_i$, $\colim_i M_i$,
$\lim_{i\in \mathcal{I}} M_i$, or $\colim_{i\in \mathcal{I}} M_i$
instead of the versions indexed by $\mathcal{I}$.
Using this notation, and using the description of
limits and colimits of sets in Section \ref{section-limit-sets}
below, we can say the following.
Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram.
\begin{enumerate}
\item The object $\lim_i M_i$ if it exists satisfies the following property
$$\Mor_\mathcal{C}(W, \lim_i M_i) = \lim_i \Mor_\mathcal{C}(W, M_i)$$
where the limit on the right takes place in the category of sets.
\item The object $\colim_i M_i$ if it
exists satisfies the following property
$$\Mor_\mathcal{C}(\colim_i M_i, W) = \lim_{i\in \mathcal{I}^\text{opp}} \Mor_\mathcal{C}(M_i, W)$$
where on the right we have the limit over the opposite category
with value in the category of sets.
\end{enumerate}
By the Yoneda lemma (and its dual) this formula completely determines the
limit, respectively the colimit.
\end{remark}

\noindent
As an application of the notions of limits and colimits
we define products and coproducts.

\begin{definition}
\label{definition-product}
Suppose that $I$ is a set, and suppose given for every $i \in I$ an
object $M_i$ of the category $\mathcal{C}$. A {\it product}
$\prod_{i\in I} M_i$ is by definition $\lim_\mathcal{I} M$
(if it exists)
where $\mathcal{I}$ is the category having only identities as
morphisms and having the elements of $I$ as objects.
\end{definition}

\noindent
An important special case is where $I = \emptyset$ in which case the
product is a final object of the category.
The morphisms $p_i : \prod M_i \to M_i$ are called the
{\it projection morphisms}.

\begin{definition}
\label{definition-coproduct}
Suppose that $I$ is a set, and suppose given for every $i \in I$ an
object $M_i$ of the category $\mathcal{C}$. A {\it coproduct}
$\coprod_{i\in I} M_i$ is by definition $\colim_\mathcal{I} M$
(if it exists) where $\mathcal{I}$ is the category having only
identities as morphisms and having the elements of $I$ as objects.
\end{definition}

\noindent
An important special case is where $I = \emptyset$ in which case the
coproduct is an initial object of the category.
Note that the coproduct comes equipped with morphisms
$M_i \to \coprod M_i$. These are sometimes called the
{\it coprojections}.

\begin{lemma}
\label{lemma-functorial-colimit}
Suppose that $M : \mathcal{I} \to \mathcal{C}$,
and $N : \mathcal{J} \to \mathcal{C}$ are diagrams
whose colimits exist. Suppose
$H : \mathcal{I} \to \mathcal{J}$ is
a functor, and suppose $t : M \to N \circ H$
is a transformation of functors.
Then there is a unique morphism
$$\theta : \colim_\mathcal{I} M \longrightarrow \colim_\mathcal{J} N$$
such that all the diagrams
$$\xymatrix{ M_i \ar[d]_{t_i} \ar[r] & \colim_\mathcal{I} M \ar[d]^{\theta} \\ N_{H(i)} \ar[r] & \colim_\mathcal{J} N }$$
commute.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-functorial-limit}
Suppose that $M : \mathcal{I} \to \mathcal{C}$,
and $N : \mathcal{J} \to \mathcal{C}$ are diagrams
whose limits exist. Suppose $H : \mathcal{I} \to \mathcal{J}$ is
a functor, and suppose $t : N \circ H \to M$
is a transformation of functors.
Then there is a unique morphism
$$\theta : \lim_\mathcal{J} N \longrightarrow \lim_\mathcal{I} M$$
such that all the diagrams
$$\xymatrix{ \lim_\mathcal{J} N \ar[d]^{\theta} \ar[r] & N_{H(i)} \ar[d]_{t_i} \\ \lim_\mathcal{I} M \ar[r] & M_i }$$
commute.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-colimits-commute}
Let $\mathcal{I}$, $\mathcal{J}$ be index categories.
Let $M : \mathcal{I} \times \mathcal{J} \to \mathcal{C}$ be a functor.
We have
$$\colim_i \colim_j M_{i, j} = \colim_{i, j} M_{i, j} = \colim_j \colim_i M_{i, j}$$
provided all the indicated colimits exist. Similar for limits.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-limits-products-equalizers}
Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram.
Write $I = \Ob(\mathcal{I})$ and $A = \text{Arrows}(\mathcal{I})$.
Denote $s, t : A \to I$ the source and target maps.
Suppose that $\prod_{i \in I} M_i$ and $\prod_{a \in A} M_{t(a)}$
exist. Suppose that the equalizer of
$$\xymatrix{ \prod_{i \in I} M_i \ar@<1ex>[r]^\phi \ar@<-1ex>[r]_\psi & \prod_{a \in A} M_{t(a)} }$$
exists, where the morphisms are determined by their components
as follows: $p_a \circ \psi = M(a) \circ p_{s(a)}$
and $p_a \circ \phi = p_{t(a)}$. Then this equalizer is the
limit of the diagram.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-colimits-coproducts-coequalizers}
\begin{slogan}
If all coproducts and coequalizers exist, all colimits exist.
\end{slogan}
Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram.
Write $I = \Ob(\mathcal{I})$ and $A = \text{Arrows}(\mathcal{I})$.
Denote $s, t : A \to I$ the source and target maps.
Suppose that $\coprod_{i \in I} M_i$ and $\coprod_{a \in A} M_{s(a)}$
exist. Suppose that the coequalizer of
$$\xymatrix{ \coprod_{a \in A} M_{s(a)} \ar@<1ex>[r]^\phi \ar@<-1ex>[r]_\psi & \coprod_{i \in I} M_i }$$
exists, where the morphisms are determined by their components
as follows: The component $M_{s(a)}$ maps via $\psi$
to the component $M_{t(a)}$ via the morphism $a$.
The component $M_{s(a)}$ maps via $\phi$ to the component
$M_{s(a)}$ by the identity morphism. Then this coequalizer is the
colimit of the diagram.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

Comment #3183 by Diego Antonio on February 9, 2018 a 12:29 am UTC

I have a question. Other references define limit by means of a contravariant functor. By the way limits and colimits are defined in this tag, one can take/form the limit and colimit of the same functor. Is this correct? I mean, doing this will imply that there's always a map from the limit to the colimit. Then whenever the category has an initial and a terminal object, there will always be a map from the terminal object to the initial one. This map would then be an isomorphism, which is not always the case as in Set.

Maybe I'm missing something.

Comment #3186 by Johan (site) on February 9, 2018 a 1:00 pm UTC

What you say is incorrect. Suggest computing some examples.

Comment #3198 by DiegoAntonio on February 11, 2018 a 4:26 pm UTC

Yes! I realized what was wrong. I was very confused at the moment.

## Add a comment on tag 002D

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the lower-right corner).