Euclidean domains are principal ideal domains

[summary: The [-division_algorithm] is a fundamental property of the [48l integers], and it turns out that almost all of the nicest properties of the integers stem from the division algorithm. All [3gq rings] which have the division algorithm (that is, [euclidean_domain Euclidean domains]) are [5r5 principal ideal domains]: they have the property that every [ideal_ring_theory ideal] has just one generator.]

[summary(Technical): Let $R$ be a [euclidean_domain]. Then $R$ is a [-5r5].]

A common theme in [3gq ring theory] is the idea that we identify a property of the [48l integers], and work out what that property means in a more general setting.
The idea of the [euclidean_domain] captures the fact that in $\mathbb{Z}$, we may perform the [-division_algorithm] (which can then be used to work out [5mw greatest common divisors] and other such nice things from $\mathbb{Z}$).
Here, we will prove that this simple property actually imposes a lot of structure on a ring: it forces the ring to be a [-5r5], so that every [ideal_ring_theory ideal] has just one generator.

In turn, this forces the ring to have [5vk unique factorisation] ([pid_implies_ufd proof]), so in some sense the [5rh Fundamental Theorem of Arithmetic] (i.e. the statement that $\mathbb{Z}$ is a unique factorisation domain) is true entirely because the division algorithm works in $\mathbb{Z}$.

This result is essentially why we care about Euclidean domains: because if we know a Euclidean function for an integral domain, we have a very easy way of recognising that the ring is a principal ideal domain.

# Formal statement

Let $R$ be a [euclidean_domain].
Then $R$ is a [-5r5].

# Proof

This proof essentially mirrors the first proof one might find in the concrete case of the integers, if one sat down to discover an integer-specific proof; but we cast it into slightly different language using an equivalent definition of "ideal", because it is a bit cleaner that way.
It is a very useful exercise to work through the proof, using $\mathbb{Z}$ instead of the general ring $R$ and using "size" %%note:That is, if $n > 0$ then the size is $n$; if $n < 0$ then the size is $-n$. We just throw away the sign.%% as the Euclidean function.

Let $R$ be a Euclidean domain, and say $\phi: \mathbb{R} \setminus \{ 0 \} \to \mathbb{N}^{\geq 0}$ is a Euclidean function.
That is,

- if $a$ divides $b$ then $\phi(a) \leq \phi(b)$;
- for every $a$, and every $b$ not dividing $a$, we can find $q$ and $r$ such that $a = qb+r$ and $\phi(r) < \phi(b)$.

We need to show that every [ideal_ring_theory ideal] is principal, so take an ideal $I \subseteq R$.
We'll view $I$ as the [5r6 kernel] of a [ring_homomorphism homomorphism] $\alpha: R \to S$; recall that this is the proper way to think of ideals. ([5r9 Proof of the equivalence.])
Then we need to show that there is some $r \in R$ such that $\alpha(x) = 0$ if and only if $x$ is a multiple of $r$.

If $\alpha$ only sends $0$ to $0$ (that is, everything else doesn't get sent to $0$), then we're immediately done: just let $r = 0$.

Otherwise, $\alpha$ sends something nonzero to $0$; choose $r$ to be nonzero with minimal $\phi$.
We claim that this $r$ works.

Indeed, let $x$ be a multiple of $r$, so we can write it as $ar$, say.
Then $\alpha(ar) = \alpha(a) \alpha(r) = \alpha(a) \times 0 = 0$.
Therefore multiples of $r$ are sent by $\alpha$ to $0$.

Conversely, if $x$ is *not* a multiple of $r$, then we can write $x = ar+b$ where $\phi(b) < \phi(r)$ and $b$ is nonzero. %%note: The fact that we can do this is part of the definition of the Euclidean function $\phi$.%%
Then $\alpha(x) = \alpha(ar)+\alpha(b)$; we already have $\alpha(r) = 0$, so $\alpha(x) = \alpha(b)$.
But $b$ has a smaller $\phi$-value than $r$ does, and we picked $r$ to have the *smallest* $\phi$-value among everything that $\alpha$ sent to $0$; so $\alpha(b)$ cannot be $0$, and hence nor can $\alpha(x)$.

So we have shown that $\alpha(x) = 0$ if and only if $x$ is a multiple of $r$, as required.

# The converse is false

There do exist principal ideal domains which are not Euclidean domains: $\mathbb{Z}[\frac{1}{2} (1+\sqrt{-19})]$ is an example. ([Proof.](http://www.maths.qmul.ac.uk/~raw/MTH5100/PIDnotED.pdf))


Unique factorisation domain

[summary(Technical): An [-5md] $R$ is said to be a *unique factorisation domain* if every nonzero non-[5mg unit] element of $R$ may be written as a product of [5m1 irreducibles], and moreover this product is unique up to reordering and multiplying by units.]

[summary: A [3gq ring] $R$ is a *unique factorisation domain* if an analog of the [5rh] holds in it. The condition is as follows: every nonzero element, which does not have a multiplicative inverse, must be expressible as a product of [5m1 irreducibles], and the expression must be unique if we do not care about ordering or about multiplying by elements which have multiplicative inverses.]

[3gq Ring theory] is the art of extracting properties from the [48l integers] and working out how they interact with each other.
From this point of view, a *unique factorisation domain* is a ring in which the integers' [5rh] holds.

There have been various incorrect "proofs" of Fermat's Last Theorem throughout the ages; it turns out that if we assume the false "fact" that all subrings of [4zw $\mathbb{C}$] are unique factorisation domains, then FLT is not particularly difficult to prove.
This is an example of where abstraction really is helpful: having a name for the concept of a UFD, and a few examples, makes it clear that it is not a trivial property and that it does need to be checked whenever we try and use it.

# Formal statement

Let $R$ be an [-5md].
Then $R$ is a *unique factorisation domain* if every nonzero non-[5mg unit] element of $R$ may be expressed as a product of [5m1 irreducibles], and moreover this expression is unique up to reordering and multiplying by units.

# Why ignore units?

We must set things up so that we don't care about units in the factorisations we discover.
Indeed, if $u$ is a unit %%note:That is, it has a multiplicative inverse $u^{-1}$.%%, then $p \times q$ is always equal to $(p \times u) \times (q \times u^{-1})$, and this "looks like" a different factorisation into irreducibles.
($p \times u$ is irreducible if $p$ is irreducible and $u$ is a unit.)
The best we could possibly hope for is that the factorisation would be unique if we ignored multiplying by invertible elements, because those we may always forget about.

## Example

In $\mathbb{Z}$, the units are precisely $1$ and $-1$.
We have that $-10 = -1 \times 5 \times 2$ or $-5 \times 2$ or $5 \times -2$; we need these to be "the same" somehow.

The way we make them be "the same" is to insist that the $5$ and $-5$ are "the same" and the $2$ and $-2$ are "the same" (because they only differ by multiplication of the unit $-1$), and to note that $-1$ is not irreducible (because irreducibles are specifically defined to be non-unit) so $-1 \times 5 \times 2$ is not actually a factorisation into irreducibles.

That way, $-1 \times 5 \times 2$ is not a valid decomposition anyway, and $-5 \times 2$ is just the same as $5 \times -2$ because each of the irreducibles is the same up to multiplication by units.

# Examples

- Every [-5r5] is a unique factorisation domain. ([pid_implies_ufd Proof.]) This fact is not trivial! Therefore $\mathbb{Z}$ is a UFD, though we can also prove this directly; this is the [5rh].
- $\mathbb{Z}[-\sqrt{3}]$ is *not* a UFD. Indeed, $4 = 2 \times 2$ but also $(1+\sqrt{-3})(1-\sqrt{-3})$; these are both decompositions into irreducible elements. (See the page on [5m1 irreducibles] for a proof that $2$ is irreducible; the same proof can be adapted to show that $1 \pm \sqrt{-3}$ are both irreducible.)

# Properties

- If it is hard to test for uniqueness up to reordering and multiplying by units, there is an easier but equivalent condition to check: an integral domain is a unique factorisation domain if and only if every element can be written (not necessarily uniquely) as a product of irreducibles, and all irreducibles are [5m2 prime]. ([alternative_condition_for_ufd Proof.])


Factorial

[summary: The *factorial* of a number $n$ is how we describe "how many different ways we can arrange $n$ objects in a row".]

# Three objects in a line

How many ways are there to arrange three objects in a line?
(I'll use numbers $1,2,3$ to represent the objects; pretend I painted the numbers onto the respective objects.)
For example, $1,2,3$ is one way to arrange the three objects; $1,3,2$ is another; and so on.

To be completely concrete, let's say I have three same-sized cubes and I have three same-sized boxes to place them in; the boxes are arranged into one row and can't be moved (they're too heavy), but the cubes are made of balsa wood and can be moved freely.
The number $1$ is painted on one cube; $2$ on another; and $3$ on the third.
How many ways are there to arrange the cubes into the fixed boxes?

Have a think about this, then reveal the answer and a possible way of getting the answer.

%%hidden(Show solution):
The total number of ways is $6$.
The complete list of possible options is:

- $1,2,3$
- $1,3,2$
- $2,1,3$
- $2,3,1$
- $3,1,2$
- $3,2,1$

I've listed them in an order that hopefully makes it fairly easy to see that there are no more possibilities.
First I listed every possible way $1$ could come at the beginning; then every possible way $2$ could; then every possible way $3$ could.

If you got the answer $6$ through some *other* method, that's (probably) fine: there are many ways to think about this problem.
%%

How about arranging four objects in a line? (That is, four cubes into four fixed boxes.)

The total number of ways is $24$.
The complete list of possible options is:

- $1,2,3,4$
- $1,2,4,3$
- $1,3,2,4$
- $1,3,4,2$
- $1,4,2,3$
- $1,4,3,2$
- $2,1,3,4$

… I got bored.

How could we do this *without* listing all the possibilities?
I promise the answer really is $24$, but you should think about this for a bit before continuing.

# How to arrange four objects

There's an insight that makes everything much easier.

> Once we've placed a cube into the leftmost box, all we have left to do is fit the remaining three cubes into the remaining three boxes.

We've already seen above that there are $6$ ways to arrange three cubes among three boxes!

So the total number of ways of doing four cubes among four boxes is:

- $6$ ways where the leftmost box contains cube $1$ (and I actually listed all of those above before I got bored);
- $6$ ways where the leftmost box contains cube $2$;
- $6$ ways where the leftmost box contains cube $3$;
- $6$ ways where the leftmost box contains cube $4$.

That comes to $24$ in total.

# Interlude: Exercise

Can you work out how many ways there are to arrange *five* cubes into *five* fixed boxes?
Take a hint from how we did four boxes above.

%%hidden(Show solution):
There are $120$ ways to do this.
Remember, there are $24$ ways to arrange four cubes among four boxes.

Then to arrange five cubes among five boxes:

- $24$ ways where the leftmost box contains cube $1$
- $24$ ways where the leftmost box contains cube $2$
- $24$ ways where the leftmost box contains cube $3$
- $24$ ways where the leftmost box contains cube $4$
- $24$ ways where the leftmost box contains cube $5$

That comes to $120$ in total.
%%

# In general

OK, that was all well and good.
But if we didn't already know how to arrange four objects into four boxes, how could we jump straight to arranging five objects into five boxes?

Well, you might have noticed a pattern already.

- To arrange five boxes, we added the four-boxes number to itself five times; that is, we multiplied the four-boxes number by $5$.
- To arrange four boxes, we added the three-boxes number to itself four times; that is, we multiplied the three-boxes number by $4$.

Perhaps you can see that this will *always* work: to arrange $n$ boxes, we add the $n-1$-boxes number to itself $n$ times. That is, we multiply the $n-1$-boxes number by $n$.
Indeed, there are $n$ possible ways to fill the leftmost box %%note:We can do it with the number $1$, or the number $2$, or… or the number $n$; that's $n$ ways.%% and once we've done that, there are "the $n-1$-boxes number" ways to fill the remaining $n-1$ boxes.

But this still doesn't help us jump straight to how to arrange five objects into five boxes.
Here comes the clever bit.

Let's write $5!$ (with an exclamation mark) for the number that is "how many ways to arrange five objects into five boxes". %%note:We already know this number is actually $120$.%%
Similarly, $4!$ is "how many ways to arrange four objects into four boxes", and in general $n!$ is "how many ways to arrange $n$ objects into $n$ boxes".

Then the patterns we noted earlier become:

- $5! = 5 \times 4!$
- $4! = 4 \times 3!$

(Notice how much cleaner that is than "To arrange five boxes, we added the four-boxes number to itself five times; that is, we multiplied the four-boxes number by $5$". This is why mathematicians use notation: to make everything easier to say.)

And the general rule is: %%note: Being careful to put $n-1$ in brackets, because otherwise it looks like $n \times n - 1!$, which means $(n \times n)-1!$ according to the [-54s].%% $$n! = n \times (n-1)!$$

OK, we have

- $n! = n \times (n-1)!$, and
- $(n-1)! = (n-1) \times (n-2)!$, and
- $(n-2)! = (n-2) \times (n-3)!$, and so on.

So $$n! = n \times (n-1)! = n \times (n-1) \times (n-2)! = n \times (n-1) \times (n-2) \times (n-3)!$$
and so on.

If we just keep going, we'll eventually reach $$n \times (n-1) \times (n-2) \times \dots \times 5 \times 4 \times 3!$$
and we already know that $3! = 6$, which I'll write as $3 \times 2 \times 1$ for reasons which are about to become obvious.

So we have the following formula, which is how we define the **factorial**:

$$n! = n \times (n-1) \times \dots \times 4 \times 3 \times 2 \times 1$$

"$n!$" is read out loud as "$n$ factorial", and it means "the number of ways to arrange $n$ objects into any order".

# Edge cases

We've seen $3!$, but never $2!$ or $1!$.

- It's easy to see that there are two ways to arrange two objects into an order: $1,2$ or $2,1$.
So $2! = 2$.
- It's also easy (if a bit weird) to see that there is just one way of arranging one object into an order: $1$ is the only possible way. So $1! = 1$.
- How about arranging *no* objects into an order? This is even weirder, but the answer is $1$. There *is* a way to arrange no objects into an order: just don't put down any objects. This is something which you should just accept without thinking about it too hard, and it almost never crops up. Anyway, $0! = 1$.


Transcendental number

[summary(Technical): A [4bc real] or [4zw complex] number $z$ is said to be *transcendental* if there is no (nonzero) [-48l]-coefficient [-polynomial] which has $z$ as a [root_of_polynomial root].]

[summary: A *transcendental* number $z$ is one such that there is no (nonzero) [-polynomial] function which outputs $0$ when given $z$ as input. $\frac{1}{2}$, $\sqrt{6}$, $i$ and $e^{i \pi/2}$ are not transcendental; $\pi$ and $e$ are both transcendental.]

A [4bc real] or [4zw complex] number is said to be *transcendental* if it is not the root of any (nonzero) [-48l]-coefficient [-polynomial].
("Transcendental" means "not [algebraic_number algebraic]".)

# Examples and non-examples

Many of the most interesting numbers are *not* transcendental.

- Every integer is *not* transcendental (i.e. is algebraic): the integer $n$ is the root of the integer-coefficient polynomial $x-n$.
- Every [4zq rational] is algebraic: the rational $\frac{p}{q}$ is the root of the integer-coefficient polynomial $qx - p$.
- $\sqrt{2}$ is algebraic: it is a root of $x^2-2$.
- $i$ is algebraic: it is a root of $x^2+1$.
- $e^{i \pi/2}$ (or $\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}i$) is algebraic: it is a root of $x^4+1$.

However, $\pi$ and $e$ are both transcendental. (Both of these are difficult to prove.)

# Proof that there is a transcendental number

There is a very sneaky proof that there is some transcendental real number, though this proof doesn't give us an example.
In fact, the proof will tell us that "[almost_every almost all]" real numbers are transcendental.
(The same proof can be used to demonstrate the existence of [54z irrational numbers].)

It is a fairly easy fact that the *non*-transcendental numbers (that is, the algebraic numbers) form a [-countable] subset of the real numbers.
Indeed, the [fundamental_theorem_of_algebra Fundamental Theorem of Algebra] states that every polynomial of degree $n$ has exactly $n$ complex roots (if we count them with [multiplicity multiplicity], so that $x^2+2x+1$ has the "two" roots $x=-1$ and $x=-1$).
There are only countably many integer-coefficient polynomials [todo: spell out why], and each has only finitely many complex roots (and therefore only finitely many—possibly $0$—*real* roots), so there can only be countably many numbers which are roots of *any* integer-coefficient polynomial.

But there are uncountably many reals ([reals_are_uncountable proof]), so there must be some real (indeed, uncountably many!) which is not algebraic.
That is, there are uncountably many transcendental numbers.

# Explicit construction of a transcendental number
[todo: Liouville's constant]


Ordered field

An **ordered field** is an [-55j] with the additional property that [-division] is possible, making it a [481 field].


Placeholder

This is an empty page created for a [3n parent], [1ln requisite], or [3jg teaches] relationship. If you know about this topic and want to help others understand it, you're welcome to [fill in this gap](https://arbital.com/edit/) in [1sm Arbital's knowledge network]!

Contrast:

* [72], for tiny pages containing only a paragraph or a couple of sentences of text.
* [5xq], for outlines of pages.

**[4yg Quality scale]**

* [4ym]
* [4gs]
* [5xs]
* [5xq]
* [72]
* [3rk]
* [4y7]
* [4yd]
* [4yf]
* [4yl]


LaTeX

**[5xs Placeholder]**


Mathematical object


Element


Proof technique


Turing machine: External resources

* [Wikipedia](https://en.wikipedia.org/wiki/Turing_machine)
* [Wolfram MathWorld](http://mathworld.wolfram.com/TuringMachine.html)
* [Stanford Encyclopedia of Philosophy](http://plato.stanford.edu/entries/turing-machine/)


Disjoint union of sets

[summary: The *disjoint union* of two [3jz sets] is just the [5s8 union], but with the additional information that the two sets also don't have any elements in common. That is, we can use the phrase "disjoint union" to indicate that we've taken the union of two sets which have empty [5sb intersection]. The phrase can also be used to indicate a very slightly different operation: "do something to the elements of each set to make sure they don't overlap, and then take the union".]

[summary(Technical): The phrase "disjoint union" is used to mean one of two slightly different operations on [3jz sets]. It indicates either "just take the [5s8 union], but also notice that we've been careful to ensure that the sets have empty [5sb intersection]", or "perform a specific operation on each set to ensure that the resulting sets have empty intersection, and then take the union".]

The *disjoint union* of two [3jz sets] is just the [5s8 union], but with the additional information that the two sets also don't have any elements in common. That is, we can use the phrase "disjoint union" to indicate that we've taken the union of two sets which have empty [5sb intersection]. The phrase can also be used to indicate a very slightly different operation: "do something to the elements of each set to make sure they don't overlap, and then take the union".

# Definition of the disjoint union

"Disjoint union" can mean one of two things:

- The simple [5s8 union], together with the assertion that the two sets don't overlap;
- The operation "do something to the elements of each set to make sure they don't overlap, and then take the union".

(Mathematicians usually let context decide which of these meanings is intended.)

The disjoint union has the symbol $\sqcup$: so the disjoint union of sets $A$ and $B$ is $A \sqcup B$.

## The first definition

Let's look at $A = \{6,7\}$ and $B = \{8, 9\}$.
These two sets don't overlap: no element of $A$ is in $B$, and no element of $B$ is in $A$.
So we can announce that the union of $A$ and $B$ (that is, the set $\{6,7,8,9\}$) is in fact a *disjoint* union.

In this instance, writing $A \sqcup B = \{6,7,8,9\}$ is just giving the reader an extra little hint that $A$ and $B$ are disjoint; I could just have written $A \cup B$, and the formal meaning would be the same.
For the purposes of the first definition, think of $\sqcup$ as $\cup$ but with a footnote reading "And, moreover, the union is disjoint".

As a non-example, we could *not* legitimately write $\{1,2\} \sqcup \{1,3\} = \{1,2,3\}$, even though $\{1,2\} \cup \{1,3\} = \{1,2,3\}$; this is because $1$ is in both of the sets we are unioning.

## The second definition

This is the more interesting definition, and it requires some fleshing out.

Let's think about $A = \{6,7\}$ and $B = \{6,8\}$ (so the two sets overlap).
We want to massage these two sets so that they become disjoint, but are somehow "still recognisably $A$ and $B$".

There's a clever little trick we can do.
We tag every member of $A$ with a little note saying "I'm in $A$", and every member of $B$ with a note saying "I'm in $B$".
To turn this into something that fits into set theory, we tag an element $a$ of $A$ by putting it in an ordered pair with the number $1$: $(a, 1)$ is "$a$ with its tag".
Then our massaged version of $A$ is the set $A'$ consisting of all the elements of $A$, but where we tag them first:
$$A' = \{ (a, 1) : a \in A \}$$

Now, to tag the elements of $B$ in the same way, we should avoid using the tag $1$ because that means "I'm in $A$"; so we will use the number $2$ instead.
Our massaged version of $B$ is the set $B'$ consisting of all the elements of $B$, but we tag them first as well:
$$B' = \{ (b,2) : b \in B \}$$

Notice that $A$ [499 bijects] with $A'$ %%note: Indeed, a bijection from $A$ to $A'$ is the map $a \mapsto (a,1)$.%%, and $B$ bijects with $B'$, so we've got two sets which are "recognisably $A$ and $B$".

But magically $A'$ and $B'$ are disjoint, because everything in $A'$ is a tuple with second element equal to $1$, while everything in $B'$ is a tuple with second element equal to $2$.

We define the *disjoint union of $A$ and $B$* to be $A' \sqcup B'$ (where $\sqcup$ now means the first definition: the ordinary union but where we have the extra information that the two sets are disjoint).
That is, "make the sets $A$ and $B$ disjoint, and then take their union".

# Examples

## $A = \{6,7\}$, $B=\{6,8\}$
Take a specific example where $A = \{6,7\}$ and $B=\{6,8\}$.
In this case, it only makes sense to use $\sqcup$ in the second sense, because $A$ and $B$ overlap (they both contain the element $6$).

Then $A' = \{ (6, 1), (7, 1) \}$ and $B' = \{ (6, 2), (8, 2) \}$, and the disjoint union is $$A \sqcup B = \{ (6,1), (7,1), (6,2), (8,2) \}$$

Notice that $A \cup B = \{ 6, 7, 8 \}$ has only three elements, because $6$ is in both $A$ and $B$ and that information has been lost on taking the union.
On the other hand, the disjoint union $A \sqcup B$ has the required four elements because we've retained the information that the two $6$'s are "different": they appear as $(6,1)$ and $(6,2)$ respectively.

## $A = \{1,2\}$, $B = \{3,4\}$

In this example, the notation $A \sqcup B$ is slightly ambiguous, since $A$ and $B$ are disjoint already.
Depending on context, it could either mean $A \cup B = \{1,2,3,4\}$, or it could mean $A' \cup B' = \{(1,1), (2,1), (3,2), (4,2) \}$ (where $A' = \{(1,1), (2,1)\}$ and $B' = \{(3,2), (4,2) \}$).
It will usually be clear which of the two senses is meant; the former is more common in everyday maths, while the latter is usually intended in set theory.

## Exercise

What happens if $A = B = \{6,7\}$?

%%hidden(Show): Only the second definition makes sense.

Then $A' = \{(6,1), (7,1)\}$ and $B' = \{(6,2), (7,2)\}$, so $$A \sqcup B = \{(6,1),(7,1),(6,2),(7,2)\}$$
which has four elements.%%

## $A = \mathbb{N}$, $B = \{ 1, 2, x \}$

Let $A$ be the set $\mathbb{N}$ of [45h natural numbers] including $0$, and let $B$ be the set $\{1,2,x\}$ containing two natural numbers and one symbol $x$ which is not a natural number.

Then $A \sqcup B$ only makes sense under the second definition; it is the union of $A' = \{ (0,1), (1,1), (2,1), (3,1), \dots\}$ and $B' = \{(1,2), (2,2), (x,2)\}$, or $$\{(0,1), (1,1),(2,1),(3,1), \dots, (1,2),(2,2),(x,2)\}$$

## $A = \mathbb{N}$, $B = \{x, y\}$

In this case, again the notation $A \sqcup B$ is ambiguous; it could mean $\{ 0,1,2,\dots, x, y \}$, or it could mean $\{(0,1), (1,1), (2,1), \dots, (x,2), (y,2)\}$.

# Multiple operands

We can generalise the disjoint union so that we can write $A \sqcup B \sqcup C$ instead of just $A \sqcup B$.

To use the first definition, the generalisation is easy to formulate: it's just $A \cup B \cup C$, but with the extra information that $A$, $B$ and $C$ are pairwise disjoint (so there is nothing in any of their intersections: $A$ and $B$ are disjoint, $B$ and $C$ are disjoint, and $A$ and $C$ are disjoin).

To use the second definition, we just tag each set again: let $A' = \{(a, 1) : a \in A \}$, $B' = \{ (b, 2) : b \in B \}$, and $C' = \{ (c, 3) : c \in C \}$.
Then $A \sqcup B \sqcup C$ is defined to be $A' \cup B' \cup C'$.

## Infinite unions
In fact, both definitions generalise even further, to unions over arbitrary sets.
Indeed, in the first sense we can define $$\bigsqcup_{i \in I} A_i = \bigcup_{i \in I} A_i$$ together with the information that no pair of $A_i$ intersect.

In the second sense, we can define $$\bigsqcup_{i \in I} A_i = \bigcup_{i \in I} A'_i$$
where $A'_i = \{ (a, i) : a \in A_i \}$.

For example, $$\bigsqcup_{n \in \mathbb{N}} \{0, 1,2,\dots,n\} = \{(0,0)\} \cup \{(0,1), (1,1) \} \cup \{ (0,2), (1,2), (2,2)\} \cup \dots = \{ (n, m) : n \leq m \}$$

# Why are there two definitions?

The first definition is basically just a notational convenience: it saves a few words when saying "… and moreover the sets are pairwise disjoint".

The real meat of the idea is the second definition, which provides a way of forcing the sets to be disjoint.
It's not necessarily the *only* way we could coherently define a disjoint union (since there's more than one way we could have tagged the sets; if nothing else, $A \sqcup B$ could be defined the other way round, as $A' \cup B'$ where $A' = \{ (a, 2) : a \in A \}$ and $B' = \{ (b,1) : b \in B \}$, swapping the tags).
But it's the one we use by convention.
Usually when we're using the second definition we don't much care exactly how we force the sets to be disjoint; we only care that there *is* such a way.
(For comparison, there is [ordered_pair_formal_definitions more than one way] to define the ordered pair in the [ZF] set theory, but we almost never care really which exact definition we use; only that there is a definition that has the properties we want from it.)


Empty set

The empty set is the set having no members. It is usually denoted as $\emptyset$. Whatever object is considered, it can't be a member of $\emptyset$. It might be useful in the beginning to think about the empty set as an empty box. It has nothing inside it, but it still does exist.

Formally, the existence of the empty set is asserted by the __Empty Set Axiom__:

$$\exists B \forall x : x∉B$$

The empty set axiom itself does not postulate the uniqueness of $\emptyset$. However, this fact is easy to prove using the [618 axiom of extensionality].
Consider sets $A$ and $B$ such that both $\forall x : x∉A$ and $\forall x: x∉B$. %%note: That is, suppose we had two empty sets.%% Remember that the extensionality axiom tells us that if we can show $\forall x : (x ∈ A \Leftrightarrow x ∈ B)$, then we may deduce that $A=B$.
In this case, for every $x$, both parts of the statement $(x ∈ A \Leftrightarrow x ∈ B)$ are false: we have $x \not \in A$ and $x \not \in B$.
Therefore the [-46m] relation is true.

The existence of the empty set can be derived from the existence of any other set using the axiom schema of bounded comprehension, which states that for any formula $\phi$ in the language of set theory, $\forall a \exists b \forall x : x \in b \Leftrightarrow (x \in a \wedge \phi(x))$. In particular, taking $\phi$ to be $\bot$, the always-false formula, we have that $\forall a \exists b \forall x : x \in b \Leftrightarrow (x \in a \wedge \bot)$. Since $x \in b \Leftrightarrow (x \in a \wedge \bot)$ is logically equivalent to $x \in b \Leftrightarrow \bot$ and hence to $x \notin b$, the quantified statement is logically equivalent to $\forall a \exists b \forall x : x \notin b$, and as soon as we have the existence of at least one set to use as $a$, we obtain the Empty Set Axiom above.

It is worth noting that the empty set is itself a single object. One can construct a set *containing* the empty set: $\{\emptyset\}$. $\{\emptyset\} \not= \emptyset$, because $\emptyset ∈ \{\emptyset\}$ but $\emptyset ∉ \emptyset$; so the two sets have different elements and therefore cannot be equal by extensionality.
%%note: In terms of the box metaphor above, $\{\emptyset\}$ is a box, containing an empty box, whilst $\emptyset$ is just an empty box%%

Another way to think about this is using [-4w5].
Indeed, $|\{\emptyset\}| = 1$ (as this set contains a single element - $\emptyset$) and $|\emptyset| = 0$ (as it contains no elements at all). Consequently, the two sets have different amounts of members and can not be equal.

[todo: the empty set is often used to represent the ordinal 0]

[comment: Punctuation can be weird in this edit, as the author is not a native English speaker. Might need to be improved]


Universal property of the empty set

[summary: The [-5zc] can be characterised by how it interacts with *other* [3jz sets], rather than by the usual definition as "the set that contains no elements". It therefore makes a very concrete example of defining an object through its [-600]. The property is:

> The empty set is the unique set $X$ such that for every set $A$, there is a unique function from $X$ to $A$.
(To bring this property in line with our usual definition, we denote that unique set $X$ by the symbol $\emptyset$.)
]

[summary(Technical): The [-5zc] $\emptyset$ satisfies the following [-600]: for every [3jz set] $X$, there is a unique [-3jy] $f: \emptyset \to X$. That is, the empty set is an [-initial_object] in the [4cx category] of sets.]

To start us off, recall that the [-5zc] $\emptyset$ is usually defined as the [3jz set] which contains no elements.
That property picks it out uniquely, because we have the "[axiom_of_extensionality Axiom of Extensionality]":

> Two sets are the same if and only if their elements are all the same.

If we had two sets which both contained no elements, then all their elements would ([vacuous_truth vacuously]) be the same, so by extensionality the sets are the same.

In this article, we will introduce another way to characterise the empty set.
Rather than working with the *elements of the set*, though, we will consider the *[3jy functions] which have the set as their [3js domain]*.
You might think at first that this is a very strange way to look at a set; and you might be right. But it turns out that if we do it this new way, characterising the empty set by examining the maps *between* sets %%note: "Map" is just a synonym for "function", in this context.%%, we end up with a recipe that is much, much more widely applicable.

# The empty function

When we use set theory to capture the idea of a "function", we would usually implement $f: A \to B$ as a set of ordered pairs $(a, f(a))$, one for each element $a$ of the domain $A$, with the requirement that the elements $f(a)$ all must lie in $B$.
This set of ordered pairs holds all of the information about the function, except that it has omitted the (almost always unimportant) fact that $B$ is the [3lg codomain]. %%note:We usually only care about the [3lh image] of the function.%%

This implementation of the function $f$ is just a set; it might look like $\{ (0,1), (1,2), (2,3), (3,4), \dots \}$, which would represent the function $f: \mathbb{N} \to \mathbb{N}$ given by $n \mapsto n+1$.

And we might ask, can we go the other way round? Given a set $X$, can we interpret it as a function?
Well, of course we need $X$ to contain only ordered pairs (what could it mean for $(0,1,2)$ to lie in the implementation of the function $f$?), but also we must make sure that the function is [-5ss] by ensuring that the first coordinates of each pair are all distinct.
If we had the set $\{ (0,1), (0,2) \}$, that would indicate a function that was trying to take $0$ to both $1$ and $2$, and that's ambiguous as a function definition.
But those are the *only* requirements: for any set that obeys those two conditions, we can find a function which is implemented as that set.

Very well. Now look at the empty set.
That only contains ordered pairs: indeed, it doesn't contain anything at all, so everything in it is an ordered pair. %%note:If you're squeamish about this, see [vacuous_truth].%%
And the first coordinates of each pair are distinct: indeed, there aren't any pairs at all, so certainly no two pairs have the same first coordinate.

So the empty set itself is implementing a function.
We call this the "empty function"; it is the [-identity_function] on the empty set. %%note:Don't get worried about the empty set representing a function that is the identity function on itself. To worry about this is to make a [type_error type error] in your thinking. The same object (the empty set) is here standing for two *different* things, under two different "encoding schemes". Under one encoding scheme, where we look at sets as being functions, it's the empty function. Under another encoding scheme, where we look at sets just as being sets, it's the empty set.%%

## Meditation: domain, codomain and image

If the empty set implements a function, then that function should have a domain.
What is the [-3js domain] here?
%%hidden(Show solution):
The domain is the empty set.

Indeed, there are no elements in the domain, because an *element of the domain* is just a *thing in the first coordinate of one of the ordered pairs*, but there aren't any ordered pairs so there can't be any elements of the domain.
%%

What is the [3lh image]?
%%hidden(Show solution):
The image is also the empty set.

Indeed, there are no elements in the image, because an *element of the image* is just a *thing in the second coordinate of one of the ordered pairs*, but there aren't any ordered pairs so there can't be any elements of the image.
%%

What is the [-3lg codomain]?
%%hidden(Show solution):
Aha! Trick question. We said earlier that in looking at functions being implemented as sets, we threw away information about the codomain.
We can't actually tell what the codomain of the function implemented by $\emptyset$ is.
%%

## Important fact

From the domain/image/codomain meditation above, we can now note that for *every* set $A$, there is a function from $\emptyset$ to $A$: namely, the empty function.
Put another way, we can *always* interpret the empty set as being a function from $\emptyset$ to $A$, whatever $A$ is.

%%hidden(Example):
Let $A = \{ 1 \}$, so we're showing that there is a function from $\emptyset$ to $\{1\}$: namely, the empty function, which is implemented as a set by $\emptyset$.
This is a valid implementation of a function from $\emptyset$ to $\{1\}$, because $\emptyset$ is a set which satisfies the three properties that are required for us to be able to interpret it as a function from the domain $\emptyset$ to the codomain $\{1\}$:

- Everything in $\emptyset$ is an ordered pair ([vacuous_truth vacuously]).
- Every ordered pair in $\emptyset$ consists of one element from the domain $\emptyset$, followed by one element from the codomain $\{1\}$ (again vacuously).
- Every element of the domain $\emptyset$ appears exactly once in the first slot of an ordered pair in the function-implementation $\emptyset$.

%%

Moreover, for every set $A$, there is *only one* function from $\emptyset$ to $A$.
Indeed, if we had a different function $f: \emptyset \to A$, then there would have to be some element of the domain $\emptyset$ on which $f$ differed from the empty function.
But there aren't *any* elements of the domain at all, so there can't be one on which $f$ and the empty function differ.
Hence $f$ is actually the same as the empty function.

# The universal property of the empty set

The universal property of the empty set is as follows:

> The empty set is the unique set $X$ such that for every set $A$, there is a unique function from $X$ to $A$.
To bring this property in line with our usual definition, we denote that unique set $X$ by the symbol $\emptyset$.

We've just proved that our standard definition of $\emptyset$ does satisfy that universal property; that was the Important Fact just above.

## Aside: why "universal"?

The property is a "universal property" because it's not "local" but "universal".
Rather than considering the individual things we can say about the object $\emptyset$, the property talks about it in terms of *every other set*.
That is, the property defines $\emptyset$ by reference to the "universe" of sets.

In general, a "universal property" is one which defines an object by specifying some way that the object interacts with everything else, rather than by looking into the object for some special identifying feature.

# Does the universal property uniquely pick out $\emptyset$?

I sneakily slipped the words "is the unique set" into the property, without proving that they were justified.
What use would it be if our universal property didn't actually characterise the good old $\emptyset$ we know and love?
%%note:Well, it might still be of some use. But it would mean the universal property might not work as a *definition* of $\emptyset$. %%
Let's see now that at least the property isn't totally stupid: there is a set which *doesn't* have the universal property.

## $\{1\}$ doesn't satisfy the universal property

We need to show that the following is *not* true:

> For every set $X$, there is a unique function from $\{1\}$ to $X$.

Have a think about this yourself.

%%hidden(Show possible solution):
Let $X$ be any set at all with more than one element.
For concreteness, let $X$ be $\{ a, b \}$.

Now, there are two functions from $\{1\}$ to $\{a,b\}$: namely, $f: 1 \mapsto a$, and $g: 1 \mapsto b$.

So $\{1\}$ fails to satisfy the universal property of $\emptyset$, and indeed it fails massively: for every set $X$ which has more than one element, there is more than one function $\{1\} \to X$.
(Though all we needed was for this to hold for *some* $X$.)
%%

## Only the empty set satisfies the universal property

It's actually the case that the empty set is the only set which satisfies the universal property.
[603 There are three proofs], none of them very complicated and all of them pedagogically useful in different ways.
Here, we will duplicate one of the most "category-theory-like" proofs, because it's really rather a new way of thinking to a student who has not met category theory before, and the style turns up all over category theory.
To distinguish it from the other two proofs (which, remember, are detailed [603 here]), we'll call it the "maps" proof.

### The "maps" way

We'll approach this in a slightly sneaky way: we will show that if two sets have the universal property, then there is a [499 bijection] between them. %%note: The most useful way to think of "bijection" in this context is "function with an inverse".%%
Once we have this fact, we're instantly done: the only set which bijects with $\emptyset$ is $\emptyset$ itself.

Suppose we have two sets, $\emptyset$ and $X$, both of which have the universal property of the empty set.
Then, in particular (using the UP of $\emptyset$) there is a unique map $f: \emptyset \to X$, and (using the UP of $X$) there is a unique map $g: X \to \emptyset$.
Also there is a unique map $\mathrm{id}: \emptyset \to \emptyset$. %%note: We use "id" for "identity", because as well as being the empty function, it happens to be the identity on $\emptyset$.%%

The maps $f$ and $g$ are inverse to each other. Indeed, if we do $f$ and then $g$, we obtain a map from $\emptyset$ (being the domain of $f$) to $\emptyset$ (being the image of $g$); but we know there's a *unique* map $\emptyset \to \emptyset$, so we must have the composition $g \circ f$ being equal to $\mathrm{id}$.

We've checked half of "$f$ and $g$ are inverse"; we still need to check that $f \circ g$ is equal to the identity on $X$.
This follows by identical reasoning: there is a *unique* map $\mathrm{id}_X : X \to X$ by the fact that $X$ satisfies the universal property %%note: And we know that this map is the identity, because there's always an identity function from any set $Y$ to itself.%%, but $f \circ g$ is a map from $X$ to $X$, so it must be $\mathrm{id}_X$.

So $f$ and $g$ are bijections from $\emptyset \to X$ and $X \to \emptyset$ respectively.

# Recap

To summarise the discussion above, we have shown that the universal property of the empty set uniquely characterises the empty set.
We could actually use it as a *definition* of the empty set:

> We define the *empty set* to be the unique set $X$ such that for every set $A$, there is a unique function from $X$ to $A$.

This is a bit of a strange definition when we're talking about sets, but it opens the door to many different and useful constructions.
You might like to think about the following similar universal properties, and what they define.

- The set $X$ such that for every set $A$, there is a unique function from $A$ to $X$. (That is, the "reverse" of the empty set's UP.)
- The [3gd group] $G$ such that for every group $H$, there is a unique [47t homomorphism] from $H$ to $G$.
- The [3gq ring] $R$ such that for every ring $S$, there is a unique [ring_homomorphism homomorphism] from $R$ to $S$. (This one is more interesting!)

## Aside: definition "up to isomorphism"

With universal properties, it is usually the case that we obtain a characterisation of objects only "up to [4f4 isomorphism]": the universal property doesn't care about bijections.
If the object $X$ satisfies a universal property, and the object $Y$ is isomorphic to $X$, then $Y$ will probably satisfy the universal property as well.
(Normally this doesn't really matter, since objects which are isomorphic are "basically the same" in most of the ways we care about.)

In this case, though, we do end up with a uniquely-defined object, because it so happens that the only object isomorphic %%note: In this case, when talking about sets, "isomorphic to" means "bijecting with".%% to the empty set is the empty set itself.

An example where we *don't* end up with a uniquely-defined object is the "reverse" of the empty set's universal property: "the set $X$ such that for every set $A$, there is a unique function from $A$ to $X$". (You may have thought about this property in the previous section.)
In this case, the sets which satisfy that "reverse" universal property are exactly the sets with one element.

You should try to go through the "maps" way of showing that the universal property of the empty set picks out a unique set, but instead of using the UP of the empty set, try using the "reverse" property.
The same structure of proof will show that if two sets satisfy the "reverse" universal property, then there is a bijection between them.
So we do still retain that if two sets satisfy the "reverse" UP, then they are isomorphic; and indeed if we have two sets with one element, there really is a bijection between them (given by matching up the single element of each set).

This is a general phenomenon: most universal properties don't define an object uniquely, but they *do* give us the fact that if any two objects satisfy the universal property, then the two objects are isomorphic.


Set product

[summary: The product of two [3jz sets] $A$ and $B$ is just the collection of ordered pairs $(a,b)$ where $a$ is in $A$ and $b$ is in $B$. The reason we call it the "product" can be seen if you consider the set-product of $\{1,2,\dots,n \}$ and $\{1,2,\dots, m \}$: it consists of ordered pairs $(a, b)$ where $1 \leq a \leq n$ and $1 \leq b \leq m$, but if we interpret these as integer coordinates in the plane, we obtain just an $n \times m$ rectangle.]

[summary(Technical): The product of [3jz sets] $Y_x$ indexed by the set $X$ is denoted $\prod_{x \in X} Y_x$, and it consists of all $X$-length ordered tuples of elements. For example, if $X = \{1,2\}$, and $Y_1 = \{a,b\}, Y_2 = \{b,c\}$, then $$\prod_{x \in X} Y_x = Y_1 \times Y_2 = \{(a,b), (a,c), (b,b), (b,c)\}$$
If $X = \mathbb{Z}$ and $Y_n = \{ n \}$, then $$\prod_{x \in X} Y_x = \{(\dots, -2, -1, 1, 0, 1, 2, \dots)\}]

[todo: define the product as tuples]

[todo: several examples, including R^n being the product over $\{1,2, \dots, n\}$; this introduces associativity of the product which is covered later]

[todo: product is associative up to isomorphism, though not literally]

[todo: cardinality of the product, noting that in the finite case it collapses to just the usual definition of the product of natural numbers]

[todo: as an aside, define the product formally in ZF]

[todo: link to universal property, mentioning it is a product in the category of sets]


Object identity via interactions

[summary: Central to the mindset of category theory is the idea that we don't really care what an object is; we only care about the interactions between them. But if we don't care what an object is, how can we tell even the most basic properties of the objects? For instance, how can we even tell two objects apart? But we *can* do it, and we do it by looking at the interactions with *other* objects.]

Central to the mindset of category theory is the idea that we don't really care what an object is; we only care about the interactions between them. But if we don't care what an object is, how can we tell even the most basic properties of the objects? For instance, how can we even tell two objects apart? But we *can* do it, and we do it by looking at the interactions with *other* objects.

# How to tell sets apart

If we're allowed to look at maps between sets, but not at the structure of the sets themselves, how can we tell whether two sets are the same?
We aren't allowed to look at the elements of the set directly, so it would be very optimistic to hope to do better than telling the sets apart "up to isomorphism"; indeed, it turns out not to be possible to tell whether two sets are literally identical without looking at their elements.

But how about telling whether there is a [499 bijection] between two sets or not? That is the next best thing, because a bijection between the sets would tell us that they "behave the same in all reasonable ways".

It turns out we can do this!
Let $A$ and $B$ be two sets; we want to tell if they're different or not.

Let's make a clever choice: we'll pick a kind of "anchor" set, such that the maps involving $A$, $B$ and the "anchor" set are enough to determine whether or not $A$ and $B$ are the same.
It will turn out that $\{1\}$ works.

Consider all possible maps $\{1\} \to A$ and $\{1\} \to B$.
A map from $\{1\}$ to $A$ is just a function $f$ which takes the input value $1$ (there's no choice about that) and returns a value in $A$.
So we can think of it as being "a mappy way of specifying an element of $A$": for every element of $A$, there is one of these functions, while every one of these functions denotes an element of $A$.

So $A$ is isomorphic to this collection of maps, and the key thing is that we don't need to know about $A$'s elements to say this!
If we only have access to the maps and we know nothing about the internal structure of $A$, we can still say $A$ is isomorphic to the set of all the maps from $\{1\}$ to $A$.

%%hidden(Example):
Let $A = \{ 5, 6 \}$.

Then the functions $\{1\} \to A$ are precisely the two following:

- $f: 1 \mapsto 5$;
- $g: 1 \mapsto 6$.

So we have the "mappy" way of viewing $5 \in A$: namely, $f$.
Similarly, we have the "mappy" way of viewing $6 \in A$: namely, $g$.

And $A$ is isomorphic to the set $\{ f, g \}$.
So we've specified $A$ up to isomorphism without having to look at its elements!
%%

Given access to the maps, then, we have worked out what $A$ is (up to isomorphism, which is the best we can do if we're not allowed to look into the internal structure of $A$); and we can similarly work out what $B$ is by looking at the maps $\{1\} \to B$.

[todo: another example, using f: \{2\} \to A as "pair from A"]

## Less structure

That previous construction was rather contrived, and it doesn't seem at all practical.

[todo: practical example]

[todo: example in Set, where there is a separator: {1}, and a coseparator: {0,1}. Don't define these words, or if we do, do it in passing. Remember to note that this doesn't pick out the set uniquely, but it *does* pick it out up to isomorphism. Often we only care about things up to isomorphism; explain this]

[todo: example in Top, where there is a separator {1}, and a coseparator: the closed interval 0,1. This is a nontrivial fact, and it is known as Uryson’s Lemma. ]

[todo: example in Groups, where Z is a separator]

[todo: "the entire category" together makes a coseparating class, so we can tell objects apart if we are given the freedom to look at every other object]


Universal property of the product

[summary: We can define the general notion of "product" to coincide with the product of natural numbers and with the [-5zs], by means of a [-600] that the product has.
Specifically, the product of objects $A$ and $B$ is an object denoted $A \times B$ together with maps $\pi_A : A \times B \to A$ and $\pi_B: A \times B \to B$, such that for every object $X$ and every pair of maps $f_A: X \to A$ and $f_B: X \to B$, there is a unique map $\gamma: X \to A \times B$ such that $\pi_A \circ \gamma = f_A$ and $\pi_B \circ \gamma = f_B$.]

[summary(Technical): The *product* of objects $A$ and $B$ is a certain tuple $(P, \pi_A, \pi_B)$, where $\pi_A$ is an arrow $P \to A$ and $\pi_B$ is an arrow $P \to B$. We require the product to satisfy the following [-600]: for every object $X$ and every pair of arrows $f: X \to A, g: X \to B$, there must be a unique factorisation $\gamma: X \to P$ satisfying $\pi_A \gamma = f$ and $\pi_B \gamma = g$.]

Just as we can define the [-5zc] by means of a [-600] ([5zr like this], in fact), so we can define the general notion of a "product" by referring not to what is in the product, but instead to how the product interacts with other objects.

# Motivation

The motivating example here is the [5zs product of two sets].

Remember, the product of two sets $A$ and $B$ consists of all ordered pairs, the first element from $A$ and the second element from $B$.
Category theory likes to think about *maps involving an object* rather than *elements of an object*, though, so we'd like a way of thinking about the product using only maps.

What maps can we find? Well, there's an easy way to produce an element of $A$ given an element of $A \times B$: namely, "take the first coordinate".
Concretely, if we are given $(a,b) \in A \times B$, we output $a$.
And similarly, we can take the second coordinate to get an element of $B$.

So we have two maps, one which we will denote $\pi_A: A \times B \to A$, and one denoted $\pi_B : A \times B \to B$.
%%note: We use the Greek letter $\pi$ to stand for the word "[projection_map projection]", because the operation "take a coordinate" is often called "projection".%%

Now, this is certainly not enough to characterise the product.
For one thing, there is a map from the [-5zc] to every other set ([5zr proof]), so if all we knew about the product was that it had a map to $A$ and a map to $B$, then we might deduce that the empty set was a perfectly good product of $A$ and $B$.
That's definitely not something we want our definition of "product" to mean: that the empty set is the product of every pair of sets!
So we're going to have to find something else to add to our putative definition.

What else do we know about the product?
To try for a universal property, we're going to want to talk about *all* the maps involving the product.
It turns out that the correct fact to note is that a map $f$ from any set $X$ to $A \times B$ may be defined exactly by the first coordinate and the second coordinate of the result.
Concretely, if we know $\pi_A(f(x))$ and $\pi_B(f(x))$, then we know $f(x)$: it's just $\langle \pi_A(f(x)), \pi_B(f(x)) \rangle$. %%note: I've used $\langle \text{angled brackets}\rangle$ to indicate the ordered pair here, just because otherwise there are confusingly many round brackets.%%

Another way of stating the universal property of the product is that maps $h : A \to B \times C$ are naturally in bijection with pairs of maps $f : A \to B$, $g : A \to C$. That is, a [61q generalized element] (of shape $A$) of $B \times C$ is a pair consisting of a generalized element (of the same shape) of $B$ and a generalized element of $C$; this is the same as the usual description of the product in sets, but now since we use generalized elements instead of elements it makes sense in any category. Under this correspondence, $h$ being the identity on $B \times C$ corresponds to $f$ being the projection $B \times C \to B$ and $g$ being the projection $B \times C \to C$. On the other hand, if $h$ corresponds to $f$ and $g$ via this bijection, we have $h = \langle f, g\rangle$. Naturality of the isomorphism turns out to imply that $\pi_{B} \langle f, g \rangle = f$ and $\pi_C \langle f, g \rangle = g$, as well as $\langle \pi_{B}, \pi_{C} \rangle = \text{id}$.

[todo: I think this is pretty good motivation, but it's at the cost of introducing the other version of the universal property. There's a general yoga of going between a universal property as in "representing or corepresenting a functor" and a universal property as in "being an initial or terminal object in some category", but I don't know where is a good place to discuss that.]

# The universal property

From the above, we can extract the following universal property, which really *does* define the product (up to [-4f4]):

> Given objects $A$ and $B$, we define the *product* to be the following collection of three objects, if it exists: $$A \times B \\ \pi_A: A \times B \to A \\ \pi_B : A \times B \to B$$ with the requirement that for every object $X$ and every pair of maps $f_A: X \to A, f_B: X \to B$, there is a *unique* map $f: X \to A \times B$ such that $\pi_A \circ f = f_A$ and $\pi_B \circ f = f_B$.

If you're anything like me, you're probably a bit lost at this point.
Trust me that once you've set up the right structures in your mind, the property is quite simple.
At the moment it probably feels more like I've given you a sentence in Swahili, and I've just told you it doesn't mean anything difficult.

Category theory contains lots of things like this, where it takes a lot of words to write them out and some time to get your head around them properly. %%note: In this particular instance, one unavoidable annoyance is that the object $X$ isn't really playing any interesting role other than "[3js domain] of an arbitrary function", but we have to include the words "for every object $X$" because otherwise the definitions of $f_A$ and $f_B$ don't make sense. %%
One learns category theory by gradually getting used to examples and pictures; in particular, the idea of the **commutative diagram** is an extremely powerful tool for improving understanding.

The following "commutative diagram" (really just a picture showing the objects involved and how they interact) defines the product.

![Product universal property](http://i.imgur.com/AcdaqkI.png)

The dashed arrow indicates "the presence of all the other arrows forces this arrow to exist uniquely"; and the diagram is said to **commute**, which means that if we follow any chain of arrows round the diagram, we'll get the same answer.
Here, "the diagram commutes" %%note: That is, "the diagram is a *commutative* diagram".%% is exactly expressing $\pi_A \circ f = f_A$ (following one of the triangles round) and $\pi_B \circ f = f_B$ (following the other triangle).
And the dashed-ness of the line is exactly expressing the words "there is a *unique* map $f: X \to A \times B$".

We'll see several examples now, some related to each other and some not.
Hopefully in working through these, you will pick up what the property means; and maybe you will start to get a feel for some underlying intuitions.

# Example: finite sets

(This discussion works just as well in the category of *all* sets, not just the finite ones, but finite sets are much easier to understand than general sets.)

The motivation above took some properties of the set-product, and turned them into a new general definition.
So we should hope that when we take the new general definition and bring it back into the world of sets, we recover the original set-product we started with.
That is indeed the case.

Let $A$ and $B$ be finite sets; we want to see what $A \otimes B$ %%note: Because $\times$ already has a meaning in set theory, we'll use $\otimes$ to distinguish this new concept. Of course, the aim of this section is to show that $\otimes$ is actually the same as our usual $\times$. %% is (using the universal-property definition), if it exists.

Well, it would be the finite set $A \otimes B$ (whatever that might be), together with two maps $\pi_A: A \otimes B \to A$ and $\pi_B: A \otimes B \to B$, such that:

> For every finite set $X$ and every pair of maps $f_A: X \to A, f_B: X \to B$, there is a *unique* map $f: X \to A \otimes B$ such that $\pi_A \circ f = f_A$ and $\pi_B \circ f = f_B$.

Let's try and identify what set this universal property describes %%note: If such a set exists. (Spoiler: it does.)%%.
The property is very general, talking about the entire "universe" of finite sets, so to get a grasp of it, it should help to specialise to some simple sets $X$.

You might like to work out for yourself why letting $X = \emptyset$ doesn't tell us anything about $A \otimes B$.

But a much more enlightening choice of $X$ arises if we take $X = \{ 1 \}$.
In that case, a map from $X$ to $A$ is just identifying a specific element of $A$, so for example we may refer to $f_A: X \to A$ as a "choice of element of $A$".
Indeed, if $g: \{1\} \to A$, then we have an element $g(1)$ in $A$, because there's no choice about which element of the [3js domain] we use: there's only the element $1$, so the only possible output of $g$ is the element $g(1)$ of $A$.

Specialising to this instance of $X$, then, the universal property requires that:

> For every pair of choices of element, $f_A: \{ 1 \} \to A$ and $f_B : \{ 1 \} \to B$, there is a *unique* choice of element $f: \{1\} \to A \otimes B$ such that $\pi_A \circ f = f_A$ and $\pi_B \circ f = f_B$.

(What does it mean to compose a function with a choice of element? Well, $\pi_A \circ f$ is a function from $\{1\}$ to $A$, so it's also just a choice of element of $A$; it's basically just $\pi_A$ applied to the choice-of-element embodied by $f$.)

More familiarly stated:

> For every pair of elements $a \in A$ and $b \in B$, there is a *unique* element $x \in A \otimes B$ such that $\pi_A(x) = a$ and $\pi_B(x) = b$.

That's just saying "$A \otimes B$ consists of objects which $\pi_A$ and $\pi_B$ allow us to interpret as ordered pairs"!
Specifically, it's saying that for every ordered pair of objects in $A \times B$, we can find a unique element of $A \otimes B$ which gets interpreted by $\pi_A$ and $\pi_B$ as having the same components as that ordered pair.

# Example: natural numbers

To give you an idea of where we're aiming for, in this section, we're going to use the fact that a [-3rb] may be viewed as a [4cx category], by letting there be a single arrow $a \to b$ if and only if $a \leq b$ in the poset.
That is, instead of maps $f: A \to B$, we have "facts that $A \leq B$ in the poset" which we interpret as "arrows from $A$ to $B$"; there is only ever at most one fact that $A \leq B$, so there is only ever at most one arrow from $A$ to $B$.

We'll examine what the category-theoretic product means in this category, and hopefully this should help indicate how versatile the "universal property" idea is.

## Specific poset: "less than"

Let us work in a specific poset: $\mathbb{N}$ the [45h natural numbers], ordered by the usual "less than".
For example, $1$ is less than or equal to every number except $0$, so there is an arrow from $1$ to every number except $0$.
There is an arrow from $2$ to every number bigger than or equal to $2$, and so on.
There is an arrow from $0$ to every number.

The universal property of the category-theoretic product %%note: I'll emphasise "category-theoretic" in this section, because it will turn out that in this context, "product" *doesn't* mean "usual product of natural numbers".%% here is:

> Given natural numbers $m$ and $n$, we define the *category-theoretic product* $\otimes$ %%note: Because $\times$ already has a meaning in the naturals, we'll use $\otimes$ to distinguish this new concept.%% to be the following collection of three objects, if it exists:

> - $m \otimes n$
> - The fact that $m \otimes n$ is less than or equal to $m$ %%note: In the sets case, this was the map $\pi_A$; but here, we're in a poset category, so instead of "a function from $A$ to $B$", we have "the fact that $A \leq B$".%%
> - The fact that $m \otimes n$ is less than or equal to $n$ %%note: This is corresponding to what was the map $\pi_B$.%%.

> We also have the requirement that for every natural number $x$ and every instance of the fact that $x \leq m, x \leq n$ %%note: Such an instance corresponds to the pair of maps $f_A: X \to A$ and $f_B: X \to B$.%%, there is a *unique* instance of the fact that $x \leq m \otimes n$. %%note: This corresponds to the map $f: X \to A \times B$. In fact we can omit "unique", because in a poset, there is never more than one arrow between any two given objects; in this context, there is only one way to express $x \leq m \otimes n$.%%

You might want to spend a little time convincing yourself that the requirement in the posets case is the same as the requirement in the general category-theoretic case.
Indeed, we can omit the "compositions" part entirely.
For example, half of the compositions part reads "$\pi_A \circ f = f_A$"; when translated into poset language, that is "the instance of the fact that $m \otimes n \leq m$, together with the instance of the fact that $x \leq m \otimes n$, yields the instance of the fact that $x \leq m$".
But this is immediate anyway because posets already let us deduce that $A \leq C$ from $A \leq B$ and $B \leq C$.

To summarise, then, we define $m \otimes n$, if it exists, to be the natural number which is less than or equal to $m$ and to $n$, such that for every natural $x$ with $x \leq m, x \leq n$, we have $x \leq m \otimes n$.

If you think about this for a few minutes, you might work out that this is just referring to the minimum of $m$ and $n$.
So we have defined the minimum of two natural numbers in a category-theoretic "universal properties" way: it's the category-theoretic product in this particular poset.

Notice, by the way, that in this case, the category-theoretic product (i.e. the minimum) does always exist.
Remember, the universal property comes with a caveat: it defines the product to be a certain triple of $(A \times B, \pi_A, \pi_B)$, *if those three things exist*.
It's by no means a given that the triple always *does* exist; but in this particular instance, with the natural numbers under the "less than" relation, it so happens that it does always exist.
For every pair $m, n$ of naturals, there *is* a triple $(m \otimes n, \pi_m, \pi_n)$ satisfying the universal property: namely, letting $m \otimes n$ be the minimum of $m$ and $n$, and letting $\pi_m$ and $\pi_n$ be "instances of the facts that $m \otimes n \leq m$ and $m \otimes n \leq n$" respectively.

## Specific example: divisibility

Let's now use the poset which is given by the *nonzero* naturals $\mathbb{N}^{\geq 1}$ but using the order relation of divisibility: $a \mid b$ if and only if $a$ divides $b$.
For example, $1$ divides every nonzero natural so there is an arrow $1 \to n$ for every $n$;
there are arrows $2 \to n$ for every *even* positive natural $n$, and so on.

We'll give the product definition again:

> Given natural numbers $m$ and $n$, we define the *category-theoretic product* $\otimes$ to be the following collection of three objects, if it exists:

> - $m \otimes n$
> - The fact that $m \otimes n$ divides $m$ %%note: In the sets case, this was the map $\pi_A$; but here, we're in a poset category, so instead of "a function from $A$ to $B$", we have "the fact that $A \mid B$".%%
> - The fact that $m \otimes n$ divides $n$.

> We also have the requirement that for every natural number $x$ such that $x \mid m, x \mid n$, it is the case that $x \mid m \otimes n$.

Again, a few minutes of pondering might lead you to discover that this is referring to the [-5mw], and again it so happens that it always exists.

## Moral things to notice about the above examples

Working in a poset, the nature of the category-theoretic product as some kind of "optimiser" is a bit clearer.
It is the "optimal" object such that certain conditions hold.

- In the first example, it is optimal in the sense that it is the *biggest* natural $a$ such that $a \leq m$ and $a\leq n$.
- In the second example, it is optimal in the sense that it is the natural $a$ with the *most factors* such that $a \mid m$ and $a \mid n$.

In fact this is true in general posets: the category-theoretic product of $X$ and $Y$ in a poset is the [-greatest_lower_bound] of $X$ and $Y$ in the poset.

# The property characterises the product up to isomorphism

This is what makes our new definition really make sense: this theorem tells us that our construction really does pick out a specific object.
The proof appears [60v on a different page]; it follows a similar pattern to the "maps" way of proving that [603 the empty set is uniquely characterised by its universal property].

If we can show that some easy-to-specify property (such as the universal property of the product) characterises things uniquely or up to isomorphism, we can be pretty hopeful that the property is worth thinking more about.
While the product's universal property is wordy, it has a simple diagram which defines it; the property itself is not very complicated, and the main difficulty is in understanding the background.

# Why is the product interesting?

Why should we care about having this object defined by the universal property?
Well, if we stop defining things by their internal properties (for instance, if we stop defining the product of sets $A$ and $B$ as the collection of ordered pairs) and use a universal property instead, we get a definition which doesn't care about internal properties.
It's immediately applicable to other situations.
If we make sure that, in proving things about the product, we only use the universal property (or things that can be derived from the universal property), we'll instantly get theorems that are true not just for set-products but also for more general situations.
Category theory, and its beginnings in the idea of the universal property, is in some ways the art of finding where in mathematics we're just doing the same things in a slightly different way, and seeing if we can show why they're *actually* the same rather than merely looking similar.

Ultimately, this viewpoint shows us that the following ideas are "basically the same" (and it doesn't matter if you don't know what some of these mean):

- Product of natural numbers %%note: The easiest way to obtain this is by interpreting a [natural_number_as_category natural number as a category itself]. The product of natural numbers $m$ and $n$, in the colloquial sense of "product", is then given by the [-product_category] of the two categories representing $m$ and $n$.%%
- [5zs Product of sets] %%note: We showed in this very page that the set product is captured by the category-theoretic product.%%
- Product of [topological_space topological spaces]
- Direct product of [3gd groups]
- Direct sum of [3h2 abelian groups]
- Greatest lower bounds in [3rb posets] %%note: We showed two examples of this above, looking at the minimum and greatest common divisor of two naturals.%%
- [segre_embedding Segre embedding] of two [projective_variety projective varieties], in [algebraic_geometry]. This is an example where the existence of the product is decidedly non-trivial.

I personally took algebraic geometry and didn't understand a word of it, including about the Segre embedding. The lecturer didn't tell me at the time that the Segre embedding is a product, so I just went on thinking it was incomprehensible.
But now I know that the Segre embedding is "just" a product.
That immediately tells me that in some deep moral sense it's "not too difficult": even though algebraic geometry is fiendishly hard, the Segre embedding is not at its heart one of the really difficult bits, and if I chose to learn it properly, I wouldn't need to do too much mental gymnastics to understand it.


Finite set

[summary: A finite [3jz set] is a set which is not infinite. That is, we could go through its members one by one, seeing a new member every minute, writing a mark on a piece of paper each time, and eventually we'd be done and stop writing.]

[summary(Technical): A finite [3jz set] $X$ is a set which is not infinite: that is, there is some $n \in \mathbb{N}$ such that the [-4w5] of $X$ is equal to $n$. Examples: $\{ 1,2 \}$ and $\{ \mathbb{N} \}$. Non-examples: $\mathbb{N}$, $\mathbb{R}$.]

A __finite set__ is like a package for a group of things. The package can be monstrously big to fit the amount of things it needs to hold but ultimately there is a limit to the amount of items in the package. This means that if you were to go by each item in this package one by one and count them you would eventually reach the last item. (Incidentally this number that you counted would be the cardinality of the set)

[todo: Create a  diagram expressing what a finite set is.]

[todo: examples, being the easiest way to understand what "finite set" means]

More formally a Finite set is a set that also has a bijection with one of the natural numbers.

[todo: the same as saying the cardinality is finite]

[todo: difference between "finite" and "hereditarily finite": in particular, {N} is finite though N is infinite]


Universal property

[summary: In [-4c7], we attempt to avoid thinking about what an object *is*, and look only at how it interacts with other objects. A universal property is a way of defining an object not in terms of its "internal" properties, but instead by its interactions with the "universe" of other objects in existence.]

In [-4c7], we attempt to avoid thinking about what an object *is*, and look only at how it interacts with other objects.
It turns out that even if we're not allowed to talk about the "internal" structure of an object, we can still pin down some objects just by talking about their interactions.
For example, if we are not allowed to define the [-5zc] as "the set with no elements", we [5zr can still define it] by means of a "universal property", talking instead about the *functions* from the empty set rather than about the elements of the empty set.

This page is not designed to teach you any particular universal properties, but rather to convey a sense of what the idea of "universal property" is about.
You are supposed to let it wash over you gently, without worrying particularly if you don't understand words or even entire sentences.

# Examples

- The [-5zc] can be [5zr defined by a universal property]. Specifically, it is an instance of the idea of an [-initial_object], in the category of sets. The same idea captures the trivial [3gd group], the [3gq ring] $\mathbb{Z}$ of [48l integers], and the natural number $0$.
- The [5zv product] has a universal property, generalising the [-5zs], the product of integers, the [-greatest_lower_bound] in a [-3rb], the products of many different [3gx algebraic structures], and many other things besides.
- The [-6gd free group] has a universal property (we refer to this property by the unwieldy phrase "the free-group [functor_category_theory functor] is *left-[adjoint_category_theory adjoint]* to the [-forgetful_functor]"). The same property can be used to create free rings, the [-discrete_topology] on a set, and the free [algebraic_semigroup semigroup] on a set. This idea of the *left adjoint* can also be used to define initial objects (which is the generalised version of the universal property of the empty set). %%note: Indeed, an initial object of category $\mathcal{C}$ is exactly a left adjoint to the unique functor from $\mathcal{C}$ to $\mathbf{1}$ the one-arrow category.%%

The above examples show that the ideas of category theory are very general.
For instance, the third example captures the idea of a "free" object, which turns up all over [-3h0].

# Definition "up to isomorphism"

[todo: explain that we only usually get things defined up to isomorphism, and what that means anyway]

# Universal properties might not define objects

Universal properties are often good ways to define things, but just like with any definition, we always need to check in each individual case that we've actually defined something coherent.
There is no silver bullet for this: universal properties don't just magically work all the time.

For example, consider a very similar universal property to that of the [-5zc] (detailed [5zr here]), but instead of working with sets, we'll work with [481 fields], and instead of [3jy functions] between sets, we'll work with field homomorphisms.

The corresponding universal property will turn out *not* to be coherent:

> The *initial field* %%note: Analogously with the empty set, but fields can't be empty so we'll call it "initial" for reasons which aren't important right now.%% is the unique field $F$ such that for every field $A$, there is a unique field homomorphism from $F$ to $A$.

%%%hidden(Proof that there is no initial field):
(The slick way to communicate this proof to a practised mathematician is "there are no field homomorphisms between fields of different [field_characteristic characteristic]".)

It will turn out that all we need is that there are two fields [4zq $\mathbb{Q}$] and $F_2$ the field on two elements. %%note: $F_2$ has elements $0$ and $1$, and the relation $1 + 1 = 0$.%%

Suppose we had an initial field $F$ with multiplicative identity element $1_F$; then there would have to be a field homomorphism $f$ from $F$ to $F_2$.
Remember, $f$ can be viewed as (among other things) a [-47t] from the *multiplicative* group $F^*$ %%note: That is, the group whose [-3gz] is $F$ without $0$, with the group operation being "multiplication in $F$".%% to $F_2^*$.

Now $f(1_F) = 1_{F_2}$ because [49z the image of the identity is the identity], and so $f(1_F + 1_F) = 1_{F_2} + 1_{F_2} = 0_{F_2}$.

But field homomorphisms are either [4b7 injective] or map everything to $0$ ([76h proof]); and we've already seen that $f(1_F)$ is not $0_{F_2}$.
So $f$ must be injective; and hence $1_F + 1_F$ must be $0_F$ because $f(1_F + 1_F) = 0_{F_2} = f(0_F)$.

Now examine $\mathbb{Q}$.
There is a field homomorphism $g$ from $F$ to $\mathbb{Q}$.
We have $g(1_F + 1_F) = g(1_F) + g(1_F) = 1 + 1 = 2$; but also $g(1_F + 1_F) = g(0_F) = 0$.
This is a contradiction.
%%%


The empty set is the only set which satisfies the universal property of the empty set

[summary: Here we give three proofs that the only [3jz set] which satisfies the [-5zr] is the [-5zc] itself.]

Here, we will prove that the only [3jz set] which satisfies the [-5zr] is the [-5zc] itself.
This will tell us that defining the empty set by this [-600] is actually a coherent thing to do, because it's not ambiguous as a definition.

There are three ways to prove this fact: one way looks at the objects themselves, one way takes a more maps-oriented approach, and one way is sort of a mixture of the two.
All of the proofs are enlightening in different ways.

Recall first that the universal property of the empty set is as follows:

> The empty set is the unique set $X$ such that for every set $A$, there is a unique function from $X$ to $A$.
(To bring this property in line with our usual definition, we denote that unique set $X$ by the symbol $\emptyset$.)

# The "objects" way

Suppose we have a set $X$ which is not empty.
Then it has an element, $x$ say.
Now, consider maps from $X$ to $\{ 1, 2 \}$.

We will show that there cannot be a unique [-3jy] from $X$ to $\{ 1, 2 \}$.
Indeed, suppose $f: X \to \{ 1, 2 \}$.
Then $f(x) = 1$ or $f(x) = 2$.
But we can now define a new function $g: X \to \{1,2\}$ which is given by setting $g(x)$ to be the *other* one of $1$ or $2$ to $f(x)$, and by letting $g(y) = f(y)$ for all $y \not = x$.

This shows that the universal property of the empty set fails for $X$: we have shown that there is no unique function from $X$ to the specific set $\{1,2\}$.

# The "maps" ways

We'll approach this in a slightly sneaky way: we will show that if two sets have the universal property, then there is a [499 bijection] between them. %%note: The most useful way to think of "bijection" in this context is "function with an inverse".%%
Once we have this fact, we're instantly done: the only set which bijects with $\emptyset$ is $\emptyset$ itself.

Suppose we have two sets, $\emptyset$ and $X$, both of which have the universal property of the empty set.
Then, in particular (using the UP of $\emptyset$) there is a unique map $f: \emptyset \to X$, and (using the UP of $X$) there is a unique map $g: X \to \emptyset$.
Also there is a unique map $\mathrm{id}: \emptyset \to \emptyset$. %%note: We use "id" for "identity", because as well as being the empty function, it happens to be the identity on $\emptyset$.%%

The maps $f$ and $g$ are inverse to each other. Indeed, if we do $f$ and then $g$, we obtain a map from $\emptyset$ (being the domain of $f$) to $\emptyset$ (being the image of $g$); but we know there's a *unique* map $\emptyset \to \emptyset$, so we must have the composition $g \circ f$ being equal to $\mathrm{id}$.

We've checked half of "$f$ and $g$ are inverse"; we still need to check that $f \circ g$ is equal to the identity on $X$.
This follows by identical reasoning: there is a *unique* map $\mathrm{id}_X : X \to X$ by the fact that $X$ satisfies the universal property %%note: And we know that this map is the identity, because there's always an identity function from any set $Y$ to itself.%%, but $f \circ g$ is a map from $X$ to $X$, so it must be $\mathrm{id}_X$.

So $f$ and $g$ are bijections from $\emptyset \to X$ and $X \to \emptyset$ respectively.

# The mixture

This time, let us suppose $X$ is a set which satisfies the universal property of the empty set.
Then, in particular, there is a (unique) map $f: X \to \emptyset$.

If we pick any element $x \in X$, what is $f(x)$?
It has to be a member of the empty set $\emptyset$, because that's the codomain of $f$.
But there aren't any members of the empty set!

So there is no such $f$ after all, and so $X$ can't actually satisfy the universal property after all: we have found a set $Y = \emptyset$ for which there is no map (and hence certainly no *unique* map) from $X$ to $Y$.

This method was a bit of a mixture of the two ways: it shows that a certain map can't exist if we specify a certain object.


Opinion page

Opinion pages represent one view or opinion on a topic, and are not necessarily balanced or a reflection of consensus.


Product is unique up to isomorphism

[summary: Here, we prove that the [-5zv] characterises objects uniquely up to [4f4]. That is, if two objects both satisfy the universal property of the product of $A$ and $B$, then they are isomorphic objects.]

Recall the [-600] of the [5zv product]:

> Given objects $A$ and $B$, we define the *product* to be the following collection of three objects, if it exists: $$A \times B \\ \pi_A: A \times B \to A \\ \pi_B : A \times B \to B$$ with the requirement that for every object $X$ and every pair of maps $f_A: X \to A, f_B: X \to B$, there is a *unique* map $f: X \to A \times B$ such that $\pi_A \circ f = f_A$ and $\pi_B \circ f = f_B$.

We wish to show that if the collections $(R, \pi_A, \pi_B)$ and $(S, \phi_A, \phi_B)$ satisfy the above condition, then there is an [-4f4] between $R$ and $S$. %%note: I'd write $A \times_1 B$ and $A \times_2 B$ instead of $R$ and $S$, except that would be really unwieldy. Just remember that $R$ and $S$ are both standing for products of $A$ and $B$.%%

# Proof

The proof follows a pattern which is standard for these things.

Since $R$ is a product of $A$ and $B$, we can let $X = S$ in the universal property to obtain:

> For every pair of maps $f_A: S \to A, f_B: S \to B$ there is a unique map $f: S \to R$ such that $\pi_A \circ f = f_A$ and $\pi_B \circ f = f_B$.

Now let $f_A = \phi_A, f_B = \phi_B$:

> There is a unique map $\phi: S \to R$ such that $\pi_A \circ \phi = \phi_A$ and $\pi_B \circ \phi = \phi_B$.

Doing the same again but swapping $R$ for $S$ and $\phi$ for $\pi$ (basically starting over with the line "Since $S$ is a product of $A$ and $B$, we can let $X = R$…"), we obtain:

> There is a unique map $\pi: R \to S$ such that $\phi_A \circ \pi = \pi_A$ and $\phi_B \circ \pi = \pi_B$.

Now, $\pi \circ \phi: S \to S$ is a map which we wish to be the identity on $S$; that would get us halfway to the answer, because it would tell us that $\pi$ is left-inverse to $\phi$.

But we can use the universal property of $S$ once more, this time looking at maps into $S$:

> For every pair of maps $f_A: S \to A, f_B: S \to B$ there is a unique map $f: S \to S$ such that $\phi_A \circ f = f_A$ and $\phi_B \circ f = f_B$.

Letting $f_A = \phi_A$ and $f_B = \phi_B$, we obtain:

> There is a unique map $f: S \to S$ such that $\phi_A \circ f = \phi_A$ and $\phi_B \circ f = \phi_B$.

But I claim that both the identity $1_S$ and also $\pi \circ \phi$ satisfy the same property as $f$, and hence they're equal by the uniqueness of $f$.
Indeed,

- $1_S$ certainly satisfies the property, since that would just say that $\phi_A = \phi_A$ and $\phi_B = \phi_B$;
- $\pi \circ \phi$ satisfies the property, since we already found that $\phi_A \circ \pi = \pi_A$ and that $\phi_B \circ \pi = \pi_B$.

Therefore $\pi$ is left-inverse to $\phi$.

Now to complete the proof, we just need to repeat *exactly* the same steps but with $(R, \pi_A, \pi_B)$ and $(S, \phi_A, \phi_B)$ interchanged throughout.
The outcome is that $\phi$ is left-inverse to $\pi$.

Hence $\pi$ and $\phi$ are genuinely inverse to each other, so they are both isomorphisms $R \to S$ and $S \to R$ respectively.

# The characterisation is not unique

To show that we can't do better than "characterised up to isomorphism", we show that the product is not characterised *uniquely*.
Indeed, if $(A \times B, \pi_A, \pi_B)$ is a product of $A$ and $B$, then so is $(B \times A, \pi'_A, \pi'_B)$, where $\pi'_A(b, a) = a$ and $\pi'_B(b, a) = b$.
(You can check that this does satisfy the universal property for a product of $A$ and $B$.)

Notice, though, that $A \times B$ and $B \times A$ are isomorphic as guaranteed by the theorem.
The isomorphism is the map $A \times B \to B \times A$ given by $(a,b) \mapsto (b,a)$.


Category of finite sets

[summary: The category of finite sets is a nice easy [4c7 category] to work in. Its objects are the finite sets, and its arrows are the [3jy functions] between the [5zy finite sets].This makes it a very concrete and understandable category to present some of the basic ideas of category theory.]

[comment: This page is more of a definition page; it's not really intended to explain anything, because all the necessary explanations should already have been done in finite_set.]

The category of finite sets is a nice easy [4c7 category] to work in. Its objects are the finite sets, and its arrows are the [3jy functions] between the [5zy finite sets].This makes it a very concrete and understandable category to present some of the basic ideas of category theory.

[todo: give example objects and arrows]

[todo: it has all finite limits and colimits]

[todo: mention that it is a full subcategory of Set]


Extensionality Axiom

The axiom of extensionality is one of the fundamental axioms of set theory. Basically, it postulates the condition, by which two sets can be equal. This condition can be described as follows: *if any two sets have exactly the same members, then these sets are equal*. A formal notation of the extensionality axiom can be written as:

$$ \forall A \forall B : ( \forall x : (x \in A \iff x \in B) \Rightarrow A=B)$$

##Examples

 - $\{1,2\} = \{2,1\}$, because whatever object we choose, it either belongs to both of these sets ($1$ or $2$), or to neither of them (e.g. $5$, $73$)

%%comment:

- If $A = \{x \mid x = 2n \text{ for some integer } n \}$ and $B = \{x \mid x \text{ is even } \}$, then $A=B$. The proof goes as follows: $\forall x : (x \in A \Leftrightarrow (x = 2n \text{ for some integer } n ) \Leftrightarrow (x/2 = n \text{ for some integer } n) \Leftrightarrow (x/2 \text{ is an integer}) \Leftrightarrow (x \text{ is even}) \Leftrightarrow x \in B)$

that, if simplified, gives $\forall x : (x \in A \iff x \in B)$, which, by extensionality, implies $A=B$

%%

[fixme: Fix the formatting in the currently commeneted example. Every new statement needs to be in a new line, lined up.]

[todo: Add more examples.]

##Axiom's converse

Note, that the axiom itself only works in one way - it implies that two sets are equal **if** they have the same elements, but does not provide the converse, i.e. any two equal sets have the same elements. Proving the converse requires giving a precise definition of equality, which in different cases can be done differently. %note: Sometimes the extensionality axiom itself can be used to define equality, in which case the converse is simply stated by the axiom.% However, generally, the converse fact can always be considered true, as the equality of two sets means that they are the same one thing, obviously consisting of a fixed selection of objects. [comment: The substitution property of equality?]


Comprehensive guide to Bayes' Rule

Click below to start reading!


Generalized element

In [-4c7], a **generalized element** of an object $X$ of a category is any morphism $x : A \to X$ with [3lg codomain] $X$. In this situation, $A$ is called the **shape**, or **domain of definition**, of the element $x$. We'll unpack this.

## Generalized elements generalize elements ##
 We'll need a set with a single element: for concreteness, let us denote it $I$, and say that its single element is $*$. That is, let $I = \{*\}$.
 For a given set $X$, there is a natural correspondence between the following notions: an element of $X$, and a function from the set $I$ to the set $X$. On the one hand, if you have an element $x$ of $X$, you can define a function from $I$ to $X$ by setting $f(i) = x$ for any $i \in I$; that is, by taking $f$ to be the constant function with value $x$. On the other hand, if you have a function $f : I \to X$, then since $*$ is an element of $I$, $f(*)$ is an element of $X$. So in the category of sets, generalized elements of a set $X$ that have shape $I$, which are by definition maps $I \to X$, are the same thing (at least up to isomorphism, which as usual is all we care about).

## Generalized elements in sets ##
 In the category of sets, if a set $A$ has $n$ elements, a generalized element of shape $A$ of a set $X$ is an $n$-tuple of elements of $X$.
[todo: is there more to say here? or less?]

## Sometimes there is no `best shape' ##
Based on the case of sets, you might initially think that it suffices to consider generalized elements whose shape is the terminal object [todo: add link] $1$. However, in the category of groups, since the terminal object is also initial [todo: explain this somewhere], each object has a unique generalized element of shape $1$. However, in this case, there is a single shape that suffices, namely the integers $\mathbb{Z}$. A generalized element of shape $\mathbb{Z}$ of an abelian group $A$ is just an ordinary element of $A$.

However, sometimes there is no single object whose generalized elements can distinguish everything up to isomorphism. For example, consider $\text{Set} \times \text{Set}$ [todo: link to a page about the product of two categories]. If we use generalized elements of shape $(X,Y)$, then they won't be able to distinguish between the objects $(2^A, 2^{X + B})$ and $(2^{Y + A}, 2^{B})$, up to isomorphism, since maps from $(X,Y)$ into the first are the same as elements of $(2^A)^X\times(2^{X+B})^Y \cong 2^{X\times A + Y \times (X + B)} \cong 2^{X \times A + Y \times B + X \times Y}$, and maps from $(X,Y)$ into the second are the same as elements of $(2^{Y+A})^X \times (2^B)^Y \cong 2^{X\times(Y+A) + Y \times B} \cong 2^{X \times A + Y \times B + X \times Y}$. These objects will themselves be non-isomorphic as long as at least one of $X$ and $Y$ is not the empty set; if both are, then clearly the functor still fails to distinguish objects up to isomorphism. (More technically, it does not reflect isomorphisms. [todo: explain or avoid this terminology])
Intuitively, because objects of this category contain the data of two sets, the information cannot be captured by a single homset. This intuition is consistent with the fact that it can be captured with two: the generalized elements of shapes $(0,1)$ and $(1,0)$ together determine every object up to isomorphism.

## Morphisms are functions on generalized elements ##
 If $x$ is an $A$-shaped element of $X$, and $f$ is a morphism from $X$ to $Y$, then $f(x) := f\circ x$ is an $A$-shaped element of $Y$. The Yoneda lemma [todo: create Yoneda lemma page] states that every function on generalized elements which commutes with reparameterization, i.e. $f(xu) = f(x) u$, is actually given by a morphism in the category.


Introduction to Bayes' Rule odds form

Click below to start reading!


Bayes' Rule and its different forms

Click below to start reading!


Bayes' Rule and its implications

Click below to start reading!