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.


Solution 1:

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.