# I don't understand the difference between initial and terminal objects

I have trouble understanding the difference between initial and terminal objects in category theory. I get the definitions, but when seeing examples, I am confused.

Example 1: The empty set is the unique initial object in the category of sets. Every one-element set is a terminal object in this category.

• Why there can be morphism from empty set to any other set? And why there is not morphism to empty set as well? I would find it more intuitive if one-element set would be initial object too.

Example 2: Similarly, the empty space is the unique initial object in Top, the category of topological spaces and every one-point space is a terminal object in this category.

• Why we can create a topological space from empty space? And why the space cannot be mapped into empty space uniquely too?

I don't know why I am stuck with this. Maybe I have a wrong idea about how morphisms behave?

Thank you for your help.

• These might not be the best examples to think about. In the category of rings, $\Bbb Z$ is initial. This is because any ring homomorphism must take $1$ to $1$, and this determines a unique map from $\Bbb Z$ to any other ring. Aug 29 at 18:15
• The only map from the empty set is the empty map. However, there are multiple maps from a singleton set to any set with more than one element, so the singleton set can't be initial. Meanwhile, there can only be one map from any set to the singleton: the one mapping every element to the single element of the singleton. So the singleton is terminal. Aug 29 at 18:22
• You can't define a function (morphism) from $X$ to $Y$ if $X$ has elements and $Y$ has no elements. For $x \in X$ you need $f(x) = y$ but there is no $y \in Y$ if $Y$ is $\{ \}$. As for the existence of morphism from $\{ \}$, a morphism in the category of sets just needs to associate an element of the codomain to every element of the domain. This is always possible if the domain has no elements. Aug 29 at 18:26
• "The category of sets" is ambiguous, or at least contains an assumption that the morphisms are (total) functions. If you were talking about Rel, the category of sets and relations, then the empty set is both the initial and terminal object. It's the definition of a function (which must map every element of the domain to an element of the codomain, but does not require every element of the codomain be an image of an element of the domain) that introduces the asymmetry in Set (the category of sets and total functions). Aug 30 at 14:48
• Related to your first question: Why is there no function with a nonempty domain and an empty range? Aug 30 at 20:39

Your confusion seems to be not so much about initial and terminal objects, but about what those look like in the category of sets. Looking at the formal definition of “function” will help make clear some of the unusual cases such as functions with empty domains.

A function from $$A$$ to $$B$$ can be understood as a set of pairs $$\langle a,b\rangle$$ where $$a\in A$$ and $$b\in B$$. And:

There must be exactly one pair $$\langle a,b\rangle$$ for each element $$a$$ of $$A$$.

Exactly one, no more and no less, or the set of pairs is not a function.

For example, the function that takes an integer $$n$$ and yields its square $$n^2$$ can be understood as the (infinite) set of ordered pairs:

$$\{ \ldots ,\langle -2, 4\rangle, \langle -1, 1\rangle, \langle 0, 0\rangle ,\langle 1, 1\rangle, \langle 2, 4\rangle\ldots\}$$

And for each integer $$n$$ there is exactly one pair $$\langle n, n^2\rangle$$. Some numbers can be missing on the right side (for example, there is no pair $$\langle n, 3\rangle$$) and some numbers can be repeated on the right (for example the function contains both $$\langle -2, 4\rangle$$ and $$\langle 2, 4\rangle$$) but on the left each number appears exactly once.

Now suppose $$A$$ is some set $$\{a_1, a_2, \ldots\}$$ and $$B$$ is a set with only one element $$\{b\}$$. What does a function from $$A$$ to $$B$$ look like? There is only one possible function: it must be: $$\{ \langle a_1, b\rangle, \langle a_2, b\rangle, \ldots\}.$$ There is no choice about the left-side elements of the pairs, because there must be exactly one pair for each element of $$A$$. There is also no choice about the right-side element of each pair. $$B$$ has only one element, $$b$$, so the right-side element of each pair must be $$b$$.

So, if $$B$$ is a one-element set, there is exactly one function from $$A$$ to $$B$$. This is the definition of “terminal”, and one-element sets are terminal.

Now what if it's $$A$$ that has only one element? We have $$A=\{a\}$$ and $$B=\{b_1, b_2, \ldots\}$$. How many functions are there now? Only one?

One function is $$\{\langle a, b_1\rangle\}$$ another is $$\{\langle a, b_2\rangle\}$$ and another is $$\{\langle a, b_3\rangle\}$$ and so on. Each function is a set of pairs where the left-side elements come from $$A$$, and each element of $$A$$ is in exactly one pair. $$A$$ has only one element, so there can only be one pair in each function. Still, the functions are all different.

You said:

I would find it more intuitive if one-element set would be initial object too.

But for a one-element set $$A$$ to be initial, there must be exactly one function $$A\to B$$ for each $$B$$. And we see above that usually there are many functions $$A\to B$$.

Now we do functions on the empty set. Suppose $$A$$ is $$\{a_1, a_2, \ldots\}$$ and $$B$$ is empty. What does a function from $$A\to B$$ look like? It must be a set of pairs, it must have exactly one pair for each element of $$a$$, and the right-side of each pair must be an element of $$B$$. But $$B$$ has no elements, so this is impossible: $$\{\langle a_1, ?\rangle, \langle a_2, ?\rangle, \ldots\}.$$

There is nothing to put on the right side of the pairs. So there are no functions $$A\to\varnothing$$. (There is one exception to this claim, which we will see in a minute.)

What if $$A$$ is empty and $$B$$ is not, say $$\{b_1, b_2, \ldots\}$$? A function $$A\to B$$ is a set of pairs that has exactly one pair for each element of $$A$$. But $$A$$ has no elements. No problem, the function has no pairs! $$\{\}$$

A function is a set of pairs, and the set can be empty. This is called the “empty function”. When $$A$$ is the empty set, there is exactly one function from $$A\to B$$, the empty function, no matter what $$B$$ is. This is the definition of “initial”, so the empty set is initial.

Does the empty set have an identity morphism? It does; the empty function $$\{ \}$$ is its identity morphism. This is the one exception to the claim that there are no functions from $$A\to\varnothing$$: if $$A$$ is also empty, the empty function is such a function, the only one.

The issue for topological spaces is exactly the same:

• When $$B$$ has only one element, there is exactly one continuous map $$A\to B$$ for every $$A$$.
• When $$A$$ is empty, there is exactly one continuous map $$A\to B$$ for every $$B$$: the empty function is the unique map.
• When $$A$$ has only one element, there are usually many continuous maps $$A\to B$$, one different one for each element of $$B$$.

There are categories in which the initial and terminal objects are the same. For example, in the category of groups the trivial group (with one element) is both initial and terminal.

I hope this was some help.

• Simpler example of a category where initial and final objects are the same: the category of “pointed sets”. The objects are nonempty sets in which one element has been painted red. The morphisms are functions that map the red element in the domain to the red element in the domain.
– MJD
Aug 29 at 21:47