[proofplan]
We prove completeness and cocompleteness by giving explicit constructions for arbitrary small diagrams. The limit is the subset of the Cartesian product consisting of compatible tuples. The colimit is the quotient of the disjoint union by the [equivalence relation](/page/Equivalence%20Relation) generated by the identifications prescribed by the morphisms of the diagram. In each case, we verify the relevant universal property directly.
[/proofplan]
[step:Construct the limit as the set of compatible tuples]
Let $\mathcal{J}$ be a small category and let $F: \mathcal{J} \to \mathsf{Set}$ be a functor. Since $\mathcal{J}$ is small, the collection $\operatorname{Ob}(\mathcal{J})$ is a set. Define the Cartesian product set
\begin{align*}
P := \prod_{j \in \operatorname{Ob}(\mathcal{J})} F(j).
\end{align*}
An element of $P$ is a tuple $x = (x_j)_{j \in \operatorname{Ob}(\mathcal{J})}$ with $x_j \in F(j)$ for each object $j$.
Define
\begin{align*}
L := \{x \in P : F(\alpha)(x_j) = x_k \text{ for every morphism } \alpha: j \to k \text{ in } \mathcal{J}\}.
\end{align*}
For each object $j \in \operatorname{Ob}(\mathcal{J})$, define the projection map
\begin{align*}
\pi_j: L &\to F(j) \\
x &\mapsto x_j.
\end{align*}
If $\alpha: j \to k$ is a morphism in $\mathcal{J}$ and $x \in L$, then by the definition of $L$,
\begin{align*}
F(\alpha)(\pi_j(x)) = F(\alpha)(x_j) = x_k = \pi_k(x).
\end{align*}
Thus the family $(\pi_j)_{j \in \operatorname{Ob}(\mathcal{J})}$ is a cone from $L$ to $F$.
[guided]
We want a set whose elements encode one compatible choice of an element in every set $F(j)$ appearing in the diagram. The unrestricted Cartesian product
\begin{align*}
P := \prod_{j \in \operatorname{Ob}(\mathcal{J})} F(j)
\end{align*}
contains all choices $x = (x_j)_{j \in \operatorname{Ob}(\mathcal{J})}$ with $x_j \in F(j)$, but not all such choices respect the maps in the diagram.
Compatibility means the following: whenever $\alpha: j \to k$ is a morphism in $\mathcal{J}$, applying $F(\alpha): F(j) \to F(k)$ to the $j$-component should give the $k$-component. Therefore we define
\begin{align*}
L := \{x \in P : F(\alpha)(x_j) = x_k \text{ for every morphism } \alpha: j \to k \text{ in } \mathcal{J}\}.
\end{align*}
This is a subset of $P$, hence a set.
For each object $j$, define
\begin{align*}
\pi_j: L &\to F(j) \\
x &\mapsto x_j.
\end{align*}
These maps form a cone because for every morphism $\alpha: j \to k$ and every $x \in L$, the defining compatibility condition gives
\begin{align*}
F(\alpha)(\pi_j(x)) = F(\alpha)(x_j) = x_k = \pi_k(x).
\end{align*}
So the diagram commutes at every morphism of $\mathcal{J}$.
[/guided]
[/step]
[step:Verify the universal property of the limit]
Let $S$ be a set, and let $(q_j: S \to F(j))_{j \in \operatorname{Ob}(\mathcal{J})}$ be any cone from $S$ to $F$. Thus, for every morphism $\alpha: j \to k$ in $\mathcal{J}$,
\begin{align*}
F(\alpha) \circ q_j = q_k.
\end{align*}
Define
\begin{align*}
u: S &\to L \\
s &\mapsto (q_j(s))_{j \in \operatorname{Ob}(\mathcal{J})}.
\end{align*}
This map is well-defined because for every morphism $\alpha: j \to k$,
\begin{align*}
F(\alpha)(q_j(s)) = q_k(s),
\end{align*}
so the tuple $(q_j(s))_j$ lies in $L$.
For each object $j$ and each $s \in S$,
\begin{align*}
(\pi_j \circ u)(s) = \pi_j((q_i(s))_{i \in \operatorname{Ob}(\mathcal{J})}) = q_j(s).
\end{align*}
Hence $\pi_j \circ u = q_j$ for every $j$.
If $v: S \to L$ is another map satisfying $\pi_j \circ v = q_j$ for every object $j$, then for every $s \in S$ and every object $j$,
\begin{align*}
(v(s))_j = \pi_j(v(s)) = q_j(s) = (u(s))_j.
\end{align*}
Since elements of $L \subset P$ are determined by all their coordinates, $v(s) = u(s)$ for every $s \in S$, so $v = u$. Therefore $L$ with the projections $(\pi_j)_j$ is a limit of $F$.
Since $\mathcal{J}$ and $F$ were arbitrary, $\mathsf{Set}$ is complete.
[/step]
[step:Construct the colimit as a quotient of the disjoint union]
Again let $\mathcal{J}$ be a small category and let $F: \mathcal{J} \to \mathsf{Set}$ be a functor. Define the disjoint union set
\begin{align*}
D := \coprod_{j \in \operatorname{Ob}(\mathcal{J})} F(j)
= \{(j,x) : j \in \operatorname{Ob}(\mathcal{J}),\ x \in F(j)\}.
\end{align*}
Let $\sim$ be the smallest equivalence relation on $D$ such that, for every morphism $\alpha: j \to k$ in $\mathcal{J}$ and every $x \in F(j)$,
\begin{align*}
(j,x) \sim (k,F(\alpha)(x)).
\end{align*}
Define the quotient set
\begin{align*}
C := D/{\sim}.
\end{align*}
For each object $j$, define
\begin{align*}
\iota_j: F(j) &\to C \\
x &\mapsto [(j,x)].
\end{align*}
If $\alpha: j \to k$ is a morphism and $x \in F(j)$, then by the definition of $\sim$,
\begin{align*}
\iota_k(F(\alpha)(x)) = [(k,F(\alpha)(x))] = [(j,x)] = \iota_j(x).
\end{align*}
Thus $\iota_k \circ F(\alpha) = \iota_j$, so $(\iota_j)_j$ is a cocone from $F$ to $C$.
[guided]
The colimit should identify elements that the diagram forces to be the same. We first place all sets $F(j)$ side by side without overlap by forming the disjoint union
\begin{align*}
D := \coprod_{j \in \operatorname{Ob}(\mathcal{J})} F(j)
= \{(j,x) : j \in \operatorname{Ob}(\mathcal{J}),\ x \in F(j)\}.
\end{align*}
The tag $j$ records which component the element $x$ originally came from.
Now every morphism $\alpha: j \to k$ gives a function $F(\alpha): F(j) \to F(k)$. In a cocone, the element $x \in F(j)$ and its image $F(\alpha)(x) \in F(k)$ must have the same image. Therefore we impose the identifications
\begin{align*}
(j,x) \sim (k,F(\alpha)(x)).
\end{align*}
To make these identifications compatible with equality, symmetry, and transitivity, we take $\sim$ to be the smallest equivalence relation on $D$ containing all such pairs.
Define the quotient set
\begin{align*}
C := D/{\sim}.
\end{align*}
For each object $j$, define the canonical map
\begin{align*}
\iota_j: F(j) &\to C \\
x &\mapsto [(j,x)].
\end{align*}
If $\alpha: j \to k$ is a morphism and $x \in F(j)$, then the defining relation gives
\begin{align*}
[(j,x)] = [(k,F(\alpha)(x))].
\end{align*}
Therefore
\begin{align*}
\iota_j(x) = \iota_k(F(\alpha)(x)).
\end{align*}
This is exactly the cocone condition $\iota_k \circ F(\alpha) = \iota_j$.
[/guided]
[/step]
[step:Verify the universal property of the colimit]
Let $T$ be a set, and let $(r_j: F(j) \to T)_{j \in \operatorname{Ob}(\mathcal{J})}$ be any cocone from $F$ to $T$. Thus, for every morphism $\alpha: j \to k$ in $\mathcal{J}$,
\begin{align*}
r_k \circ F(\alpha) = r_j.
\end{align*}
Define
\begin{align*}
w: D &\to T \\
(j,x) &\mapsto r_j(x).
\end{align*}
If $\alpha: j \to k$ is a morphism and $x \in F(j)$, then
\begin{align*}
w(j,x) = r_j(x) = r_k(F(\alpha)(x)) = w(k,F(\alpha)(x)).
\end{align*}
Hence $w$ is constant on every generating identified pair. Since equality in $T$ is an equivalence relation, $w$ is constant on every $\sim$-equivalence class. Therefore there is a well-defined map
\begin{align*}
\bar{w}: C &\to T \\
[(j,x)] &\mapsto r_j(x).
\end{align*}
For every object $j$ and every $x \in F(j)$,
\begin{align*}
(\bar{w} \circ \iota_j)(x) = \bar{w}([(j,x)]) = r_j(x),
\end{align*}
so $\bar{w} \circ \iota_j = r_j$.
If $\bar{v}: C \to T$ is another map satisfying $\bar{v} \circ \iota_j = r_j$ for every object $j$, then every element of $C$ has the form $[(j,x)]$ for some object $j$ and some $x \in F(j)$, and
\begin{align*}
\bar{v}([(j,x)]) = \bar{v}(\iota_j(x)) = r_j(x) = \bar{w}([(j,x)]).
\end{align*}
Thus $\bar{v} = \bar{w}$. Therefore $C$ with the maps $(\iota_j)_j$ is a colimit of $F$.
Since $\mathcal{J}$ and $F$ were arbitrary, $\mathsf{Set}$ is cocomplete. Combining this with completeness proves that $\mathsf{Set}$ is complete and cocomplete.
[/step]