Kernel of ring homomorphism

Given a [https://arbital.com/p/-ring_homomorphism](https://arbital.com/p/-ring_homomorphism) $f: R \to S$ between [rings](https://arbital.com/p/3gq) $R$ and $S$, we say the **kernel** of $f$ is the collection of elements of $R$ which $f$ sends to the zero element of $S$.

Formally, it is $$\{ r \in R \mid f(r) = 0_S \}$$
where $0_S$ is the zero element of $S$.

# Examples

- Given the "identity" (or "do nothing") ring homomorphism $\mathrm{id}: \mathbb{Z} \to \mathbb{Z}$, which sends $n$ to $n$, the kernel is just $\{ 0 \}$.
- Given the ring homomorphism $\mathbb{Z} \to \mathbb{Z}$ taking $n \mapsto n \pmod{2}$ (using the usual shorthand for [https://arbital.com/p/-5ns](https://arbital.com/p/-5ns)), the kernel is the set of even numbers.

# Properties

Kernels of ring homomorphisms are very important because they are precisely [ideals](https://arbital.com/p/ideal_ring_theory). ([Proof.](https://arbital.com/p/5r9))
In a way, "ideal" is to "ring" as "[https://arbital.com/p/-576](https://arbital.com/p/-576)" is to "[group](https://arbital.com/p/3gd)", and certainly [subrings](https://arbital.com/p/subring_ring_theory) are much less interesting than ideals; a lot of ring theory is about the study of ideals.

The kernel of a ring homomorphism always contains $0$, because a ring homomorphism always sends $0$ to $0$.
This is because it may be viewed as a [https://arbital.com/p/-47t](https://arbital.com/p/-47t) acting on the underlying additive group of the ring in question, and [the image of the identity is the identity](https://arbital.com/p/49z) in a group.

If the kernel of a ring homomorphism contains $1$, then the ring homomorphism sends everything to $0$.
Indeed, if $f(1) = 0$, then $f(r) = f(r \times 1) = f(r) \times f(1) = f(r) \times 0 = 0$.

The kernel of a [https://arbital.com/p/-ring_homomorphism](https://arbital.com/p/-ring_homomorphism) is the collection of elements which the homomorphism sends to $0$.


0.999...=1

Although some people find it counterintuitive, the [decimal expansions](https://arbital.com/p/4sl) $0.999\dotsc$ and $1$ represent the same [https://arbital.com/p/-4bc](https://arbital.com/p/-4bc).

# Informal proofs

These "proofs" can help give insight, but be careful; a similar technique can "prove" that $1+2+4+8+\dotsc=-1$. They work in this case because the [https://arbital.com/p/-series](https://arbital.com/p/-series) corresponding to $0.999\dotsc$ is [https://arbital.com/p/-absolutely_convergent](https://arbital.com/p/-absolutely_convergent).

* \begin{align}
x &= 0.999\dotsc \newline
10x &= 9.999\dotsc \newline
10x-x &= 9.999\dotsc-0.999\dotsc \newline
9x &= 9 \newline
x &= 1 \newline
\end{align}

* \begin{align}
\frac 1 9 &= 0.111\dotsc \newline
1 &= \frac 9 9 \newline
&= 9 \times \frac 1 9 \newline
&= 9 \times 0.111\dotsc \newline
&= 0.999\dotsc
\end{align}

* The real numbers are [https://arbital.com/p/-dense](https://arbital.com/p/-dense), which means that if $0.999\dots\neq1$, there must be some number in between. But there's no decimal expansion that could represent a number in between $0.999\dots$ and $1$.

# Formal proof

This is a more formal version of the first informal proof, using the definition of [https://arbital.com/p/-4sl](https://arbital.com/p/-4sl).

%%hidden(Show proof):
$0.999\dots$ is the decimal expansion where every digit after the decimal point is a $9$. By definition, it is the value of the series $\sum_{k=1}^\infty 9 \cdot 10^{-k}$. This value is in turn defined as the [https://arbital.com/p/-limit](https://arbital.com/p/-limit) of the sequence $(\sum_{k=1}^n 9 \cdot 10^{-k})_{n\in\mathbb N}$. Let $a_n$ denote the $n$th term of this sequence. I claim the limit is $1$. To prove this, we have to show that for any $\varepsilon>0$, there is some $N\in\mathbb N$ such that for every $n>N$, $|1-a_n|<\varepsilon$.

Let's prove by [induction](https://arbital.com/p/5fz) that $1-a_n=10^{-n}$. Since $a_0$ is the sum of {$0$ terms, $a_0=0$, so $1-a_0=1=10^0$. If $1-a_i=10^{-i}$, then

\begin{align}
1 - a_{i+1} &= 1 - (a_i + 9 \cdot 10^{-(i+1)}) \newline
&= 1-a_i - 9 \cdot 10^{-(i+1)} \newline
&= 10^{-i} - 9 \cdot 10^{-(i+1)} \newline
&= 10 \cdot 10^{-(i+1)} - 9 \cdot 10^{-(i+1)} \newline
&= 10^{-(i+1)}
\end{align}

So $1-a_n=10^{-n}$ for all $n$. What remains to be shown is that $10^{-n}$ eventually gets (and stays) arbitrarily small; this is true by the [https://arbital.com/p/archimedean_property](https://arbital.com/p/archimedean_property) and because $10^{-n}$ is monotonically decreasing.
%%

# Arguments against $0.999\dotsc=1$

These arguments are used to try to refute the claim that $0.999\dotsc=1$. They're flawed, since they claim to prove a false conclusion.

* $0.999\dotsc$ and $1$ have different digits, so they can't be the same. In particular, $0.999\dotsc$ starts "$0.$," so it must be less than 1.

%%hidden(Why is this wrong?):
Decimal expansions and real numbers are different objects. Decimal expansions are a nice way to represent real numbers, but there's no reason different decimal expansions have to represent different real numbers.
%%

* If two numbers are the same, their difference must be $0$. But $1-0.999\dotsc=0.000\dotsc001\neq0$.

%%hidden(Why is this wrong?):
Decimal expansions go on infinitely, but no farther. $0.000\dotsc001$ doesn't represent a real number because the $1$ is supposed to be after infinitely many $0$s, but each digit has to be a finite distance from the decimal point. If you have to pick a real number to for $0.000\dotsc001$ to represent, it would be $0$.
%%

* $0.999\dotsc$ is the limit of the sequence $0.9, 0.99, 0.999, \dotsc$. Since each term in this sequence is less than $1$, the limit must also be less than $1$. (Or "the sequence can never reach $1$.")

%%hidden(Why is this wrong?):
The sequence gets arbitrarily close to $1$, so its limit is $1$. It doesn't matter that all of the terms are less than $1$.
%%

* In the first proof, when you subtract $0.999\dotsc$ from $9.999\dotsc$, you don't get $9$. There's an extra digit left over; just as $9.99-0.999=8.991$, $9.999\dotsc-0.999\dotsc=8.999\dotsc991$.

%%hidden(Why is this wrong?):
There are infinitely many $9$s in $0.999\dotsc$, so when you shift it over a digit there are still the same amount. And the "decimal expansion" $8.999\dotsc991$ doesn't make sense, because it has infinitely many digits and then a $1$.
%%


Ideals are the same thing as kernels of ring homomorphisms

In [ring theory](https://arbital.com/p/3gq), the notion of "[ideal](https://arbital.com/p/ideal_ring_theory)" corresponds precisely with the notion of "[kernel](https://arbital.com/p/5r6) of [https://arbital.com/p/-ring_homomorphism](https://arbital.com/p/-ring_homomorphism)".

This result is analogous to the fact from [group theory](https://arbital.com/p/3gd) that [normal subgroups](https://arbital.com/p/4h6) are the same thing as [kernels of group homomorphisms](https://arbital.com/p/49y) ([proof](https://arbital.com/p/4h7)).

# Proof

## Kernels are ideals

Let $f: R \to S$ be a ring homomorphism between rings $R$ and $S$.
We claim that the kernel $K$ of $f$ is an ideal.

Indeed, it is clearly a [https://arbital.com/p/-576](https://arbital.com/p/-576) of the ring $R$ when viewed as just an additive group %%note:That is, after removing the multiplicative structure from the ring.%% because $f$ is a *group* homomorphism between the underlying additive groups, and kernels of *group* homomorphisms are subgroups (indeed, *normal* subgroups). ([Proof.](https://arbital.com/p/4h7))

We just need to show, then, that $K$ is closed under multiplication by elements of the ring $R$.
But this is easy: if $k \in K$ and $r \in R$, then $f(kr) = f(k)f(r) = 0 \times r = 0$, so $kr$ is in $K$ if $k$ is.

## Ideals are kernels


Fundamental Theorem of Arithmetic

summary: The Fundamental Theorem of Arithmetic is a statement about the [natural numbers](https://arbital.com/p/45h); it says that every natural number may be decomposed as a product of [primes](https://arbital.com/p/4mf), and this expression is unique up to reordering the factors. It is an extremely important theorem, and it is the basis of the field of [https://arbital.com/p/-number_theory](https://arbital.com/p/-number_theory).

The Fundamental Theorem of Arithmetic states that every [https://arbital.com/p/-45h](https://arbital.com/p/-45h) (greater than or equal to $2$) may be expressed as a product of [prime numbers](https://arbital.com/p/4mf), and the product is unique up to reordering.

This theorem is one of the main reasons $1$ is not considered to be prime: indeed, if it were prime then $3 \times 5$ could be factorised into primes as $3 \times 5 \times 1$, but these would be two *different* factorisations of the number $15$.
The FTA's statement is much cleaner if $1$ is not thought of as prime.

In a more general context, the FTA says precisely that the [ring](https://arbital.com/p/3gq) $\mathbb{Z}$ is a [https://arbital.com/p/-unique_factorisation_domain](https://arbital.com/p/-unique_factorisation_domain); there is therefore a much more abstract proof than the elementary one we will present further on in this article:

- $\mathbb{Z}$ is a [Euclidean domain](https://arbital.com/p/euclidean_domain) (with Euclidean function given by "take the modulus");
- Therefore $\mathbb{Z}$ is a [https://arbital.com/p/-5r5](https://arbital.com/p/-5r5) ([proof](https://arbital.com/p/euclidean_domain_is_pid));
- And principal ideal domains are unique factorisation domains ([proof](https://arbital.com/p/principal_ideal_domain_has_unique_factorisation)).

# Examples

- The FTA does not talk about $0$ or $1$; this is because these numbers are conventionally considered neither prime nor composite.
- Even if we haven't bothered to calculate $17 \times 23 \times 23$, we can immediately say that it is odd. Indeed, by the FTA, $2$ cannot divide $17 \times 23^2$, because the complete list of prime factors of this number is $\{ 17, 23, 23\}$, and $2$ is prime.

# Proof

Timothy Gowers has an [excellent article](https://gowers.wordpress.com/2011/11/18/proving-the-fundamental-theorem-of-arithmetic/) about the proof of the FTA.

The FTA consists of two parts: we must show that every number can be decomposed as primes, and also that every number can be decomposed *uniquely*.

## Every number can be written as a product of primes

This part is the easier, and it uses [https://arbital.com/p/-strong_induction](https://arbital.com/p/-strong_induction) (a version of [proof by induction](https://arbital.com/p/5fz)).

Clearly $2$ can be written as a product of primes, because it *is* prime; so it can be written as just itself.

Now, for $n$ bigger than $2$, if $n$ is prime then we are immediately done (just write it as itself).
Otherwise, $n$ is not prime, so it can be written as $a \times b$, say, with $a$ and $b$ both less than $n$.

But by the inductive hypothesis, we can express $a$ and $b$ each as products of primes, so we can express $n$ as the combined product of the two sets of factors of $a$ and $b$.

%%hidden(Example):
Consider $n = 1274$.
We have two options: $n$ is prime or $n$ is composite.

It turns out that $n$ is actually equal to $49 \times 26$, so it's not prime.

By the inductive hypothesis, we can factor $49$ as a product of primes (indeed, it's $7^2$); and we can factor $26$ as a product of primes (indeed, it's $2 \times 13$); so we can factor $1274$ as $2 \times 7^2 \times 13$.

(If you like, you can view this as just "start again at $49$ instead of at $1274$, and spit out what you get; then start again at $26$ instead of $1274$, and spit out what you get; and finally combine the spittings-out"; no mention of a spooky "inductive hypothesis" at all.)

Note that at this point, we haven't any guarantee at all that this is the *only* prime factorisation; all we assert so far is that it is *a* prime factorisation.
%%

## Every number can be decomposed *uniquely* as a product of primes

For this, we will need a basic (but non-obvious and important) fact about the behaviour of prime numbers: [Euclid's lemma](https://arbital.com/p/5mh), which states that if a prime $p$ divides a product $ab$, then $p$ divides at least one of $a$ and $b$.

We will work by induction on $n$ again.
If $n = 2$ then the result is immediate: a number can only be divided by numbers which are not larger than it, but $1$ and $2$ are the only such numbers.

Suppose $n$ can be written as both $p_1 p_2 \dots p_r$ and $q_1 q_2 \dots q_s$, where each $p_i$ and $q_j$ is prime (but there might be repeats: maybe $p_1 = p_2 = q_3 = q_7$, for instance).
We need to show that $r=s$ and that (possibly after reordering the lists) $p_i = q_i$ for each $i$.

Certainly $p_1$ divides $n$, because it divides $p_1 p_2 \dots p_r$.
Therefore it divides $q_1 q_2 \dots q_s$, and hence it divides one of $q_1$ or $q_2 \dots q_s$, by Euclid's lemma.
Therefore either it divides $q_1$, or it divides one of $q_2$ or $q_3 \dots q_s$; by induction, $p_1$ divides some $q_i$.
Because we don't care about the ordering of the list, let us reorder the list if necessary so that in fact $i=1$: put the factor $q_i$ at the start of the list.

Now, $q_1$ is prime, and $p_1$ is not equal to $1$ but it divides $q_1$; hence $p_1 = q_1$.

Dividing through by $p_1$, then, we obtain $p_2 \dots p_r = q_2 \dots q_s$, a strictly smaller number; so by the inductive hypothesis, $r-1 = s-1$ (so $r=s$) and the unordered list of $p_i$ is the same as the unordered list of $q_i$ for $i \geq 2$.

This proves the theorem.

# Why is this not obvious?

Timothy Gowers has a [good piece](https://gowers.wordpress.com/2011/11/13/why-isnt-the-fundamental-theorem-of-arithmetic-obvious/) on why this result is not just obvious.
Of course, what is "obvious" and what is not "obvious" varies heavily depending on who you're talking to.
For this author personally, the true reason it's not obvious is Gowers's reason number 4: because there are very similar structures which do *not* have the property of unique factorisation.
(Gowers uses $\mathbb{Z}[https://arbital.com/p/\sqrt{-5}](https://arbital.com/p/\sqrt{-5})$; on the [page on irreducibles](https://arbital.com/p/5m1), we show that $\mathbb{Z}[https://arbital.com/p/\sqrt{-3}](https://arbital.com/p/\sqrt{-3})$ could be used just as well.)


Formal definition of the free group

The [https://arbital.com/p/-5kg](https://arbital.com/p/-5kg) may be constructed formally using van der Waerden's trick, which is not intuitive at all but leads to a definition that is very easy to work with. This page will detail van der Waerden's construction, and will prove that the trick yields a group which has all the right properties to be the free group.

# The construction

Write $X^r$ for the set that contains all the [freely reduced words](https://arbital.com/p/5jc) over $X \cup X^{-1}$ (so, for instance, excluding the word $aa^{-1}$). %%note:We use the superscript $r$ to denote "reduced".%%

We define the *free group* $F(X)$, or $FX$, on the set $X$ to be a certain [https://arbital.com/p/-576](https://arbital.com/p/-576) of the [https://arbital.com/p/-497](https://arbital.com/p/-497) $\mathrm{Sym}(X^r)$: namely that which is generated by the following elements, one for each $x \in X \cup X^{-1}$:

- $\rho_x : \mathrm{Sym}(X^r) \to \mathrm{Sym}(X^r)$, sending $a_1 a_2 \dots a_n \mapsto a_1 a_2 \dots a_n x$ if $a_n \not = x^{-1}$, and $a_1 a_2 \dots a_{n-1} x^{-1} \mapsto a_1 a_2 \dots a_{n-1}$.
- $\rho_{x^{-1}} : \mathrm{Sym}(X^r) \to \mathrm{Sym}(X^r)$, sending $a_1 a_2 \dots a_n \mapsto a_1 a_2 \dots a_n x^{-1}$ if $a_n \not = x$, and $a_1 a_2 \dots a_{n-1} x \mapsto a_1 a_2 \dots a_{n-1}$.

Recall that each $\rho_x$ lies in $\mathrm{Sym}(X^r)$, so each is a [https://arbital.com/p/-499](https://arbital.com/p/-499) from $X^r$ to $X^r$.
We specify it by stating what it does to every element of $X^r$ (that is, to every freely reduced word over $X$).

We first specify what it does to those words which don't end in $x^{-1}$: $\rho_x$ simply appends an $x$ to such words.
We then specify it to the remaining words, those which do end in $x^{-1}$: then $\rho_x$ just removes the $x^{-1}$.

It's easy to check that if $\rho_x$ is given a freely-reduced word as input, then it produces a freely-reduced word as output, because the only change to the word is at the end and we make sure to provide a separate definition if $x$ is to be cancelled.
Therefore each $\rho_x$ is a function $X^r \to X^r$.

Then we do it all again for all the inverses $x^{-1}$, creating the functions $\rho_{x^{-1}}$; and finally, we add in the [https://arbital.com/p/-54p](https://arbital.com/p/-54p), denoted $\rho_{\varepsilon}$, which simply returns its input unchanged.

Notice that the $\rho_x$ and $\rho_{x^{-1}}$ are all indeed bijective (and therefore members of $\mathrm{Sym}(X^r)$), because in fact $\rho_x$ and $\rho_{x^{-1}}$ are [inverse](https://arbital.com/p/4sn) to each other (each cancelling off what the other did), and a function with an inverse is bijective.

So, we've defined the free group as a certain subgroup of the symmetric group.
Remember that the subgroup has as its group operation "function composition"; so $\rho_x \cdot \rho_y = \rho_x \circ \rho_y$, for instance.
We will write $\rho_x \rho_y$ for this, omitting the group operation.

Something key to notice is that if we apply $\rho_{a_n} \rho_{a_{n-1}} \dots \rho_{a_1}$ to the empty word $\varepsilon$, we get $$\rho_{a_n} \rho_{a_{n-1}} \dots \rho_{a_1}(\varepsilon) = \rho_{a_n} \rho_{a_{n-1}} \dots \rho_{a_3}(\rho_{a_2}(a_1)) = \rho_{a_n a_{n-1} \dots a_3}(a_1 a_2) = \dots = a_1 a_2 \dots a_n$$
if $a_1 a_2 \dots a_n$ is a freely reduced word.
(Indeed, if the word is freely reduced then none of the successive $\rho_{a_i}, \rho_{a_{i+1}}$ can have cancelled each other's effect out, so every application of a $\rho_{a_i}$ must be appending a letter.)
Hence we might hope to have captured the freely reduced words in our subgroup.

# The formal definition is the same as the intuitive definition

We'll show that there is a bijection between the free group and the set of reduced words, by "converting" each reduced word into a corresponding member of the free group.

Take a reduced word, $w = a_1 a_2 \dots a_n$, and produce the member of the free group (that is, the function) $\rho_{a_1} \rho_{a_2} \dots \rho_{a_n}$. %%note:Recall that the group operation here is composition of functions, so this is actually the function $\rho_{a_1} \circ \rho_{a_2} \circ \dots \circ \rho_{a_n}$.%%
This really does produce a member of the free group (i.e. of the subgroup of the symmetry group), because each $a_i$ is an element of $X \cup X^{-1}$ and we have already specified how to make $\rho_{a_i}$ from such an element.

Now, we claim that in fact this map is injective: that is, we can't take two words $a_1 a_2 \dots a_n$ and $b_1 b_2 \dots b_m$ and produce the same member of the free group.
(That is, we show that $\rho_{a_1} \rho_{a_2} \dots \rho_{a_n} = \rho_{b_1} \rho_{b_2} \dots \rho_{b_m}$ implies $a_1 \dots a_n = b_1 \dots b_m$.)
Indeed, if the two functions ("elements of the free group") are equal, then they must in particular do the same thing when they are applied to the empty word $\varepsilon$.
But by the "key notice" above, when we evaluate $\rho_{a_1} \rho_{a_2} \dots \rho_{a_n}$ at the empty word, we get $a_n a_{n-1} \dots a_2 a_1$; and when we evaluate $\rho_{b_1} \rho_{b_2} \dots \rho_{b_m}$ at the empty word, we get $b_m b_{m-1} \dots b_2 b_1$; so the two words must be equal after all.

Finally, the map is surjective: we can make any member of the free group by "converting the appropriate reduced word into a function".
Indeed, the free group is generated by the $\rho_x$ and $\rho_{x^{-1}}$ for $x \in X$, so every element is some $\rho_{x_1} \dots \rho_{x_n}$ for some selection of $x_1, \dots, x_n \in X \cup X^{-1}$.
Note that $x_1 \dots x_n$ need not necessarily be freely reduced as a word at the moment; but if it is indeed not freely reduced, so some $x_i, x_{i+1}$ cancel each other out, then removing that pair completely doesn't change the function $\rho_{x_1} \dots \rho_{x_n}$.
For example, $\rho_{x_1} \rho_{x_1^{-1}} \rho_{x_2} = \rho_{x_2}$.
Hence the process of "performing one step of a free reduction" (i.e. removing a cancelling pair) doesn't change the member of the free group as a function; and since each such removal makes the word shorter, it must eventually terminate.
It remains to show that it doesn't matter in what order we remove the cancelling pairs; but that is immediate because we've already shown that our "conversion" process is injective: we started with a member of the free group, so if it corresponds to a freely reduced word then it corresponds to a *unique* freely reduced word.
Since we've just shown that it does indeed correspond to a freely reduced word (by repeatedly removing cancelling pairs), we are done.

The above shows that the free group can be considered just to be the set of reduced words.


Operations in Set theory

An operation in [set](https://arbital.com/p/3jz) theory is a [https://arbital.com/p/-3jy](https://arbital.com/p/-3jy) of two sets, that returns a set.

Common set operations include [Union ](https://arbital.com/p/5s8), [Intersection ](https://arbital.com/p/5sb), [Relative complement ](https://arbital.com/p/5sc), and [Cartesian product ](https://arbital.com/p/3xb).

![illustrations of the output of four basic set operations](https://imgh.us/basic_set_operations_1.svg)


Absolute Complement

The complement $A^\complement$ of a set $A$ is the set of all things that are not in $A$. Put simply, the complement is its opposite.

Where $U$ denotes the universe, $A^\complement = U \setminus A$. That is, $A^\complement$ is the [Relative complement](https://arbital.com/p/set_relative_complement) of $U$ and $A$.


Union

The union of two sets $A$ and $B$, denoted $A \cup B$, is the set of things which are either in $A$ or in $B$ or both.

![illustration of the output of the union operation](https://imgh.us/set_union.svg)

Formally stated, where $C = A \cup B$

$$x \in C \leftrightarrow (x \in A \lor x \in B)$$

That is, [https://arbital.com/p/46m](https://arbital.com/p/46m) $x$ is in the union $C$, then either $x$ is in $A$ or $B$ or possibly both.

%%todo: more lengthy explanation for [https://arbital.com/p/1r6](https://arbital.com/p/1r6) level%%

# Examples

 - $\{1,2\} \cup \{2,3\} = \{1,2,3\}$
 - $\{1,2\} \cup \{8,9\} = \{1,2,8,9\}$
 - $\{0,2,4,6\} \cup \{3,4,5,6\} = \{0,2,3,4,5,6\}$
 - $\mathbb{R^-} \cup \mathbb{R^+} \cup \{0\} = \mathbb{R}$ (In other words, the union of the negative reals, the positive reals and zero make up all of the [real numbers](https://arbital.com/p/4bc).)

M Yass
Alexei Andreev
Eric Rogstad
Patrick Stevens
Eric Bruylant
Joe Zeng


Intersection

The intersection of two sets $A$ and $B$, denoted $A \cap B$, is the set of elements which are in both $A$ and $B$.

![illustration of the output of an intersection](https://imgh.us/set_intersection_1.svg)

Formally stated, where $C = A \cap B$

$$x \in C \leftrightarrow (x \in A \land x \in B)$$

That is, [https://arbital.com/p/46m](https://arbital.com/p/46m) $x$ is in the intersection $C$, then $x$ is in $A$ and $x$ is in $B$.

For example,

 - $\{1,2\} \cap \{2,3\} = \{2\}$
 - $\{1,2\} \cap \{8,9\} = \{\}$
 - $\{0,2,4,6\} \cap \{3,4,5,6\} = \{4,6\}$


Relative complement

The relative complement of two sets $A$ and $B$, denoted $A \setminus B$, is the set of elements that are in $A$ while not in $B$.

![illustration of the output of a relative complement](https://imgh.us/set_relative_complement.svg)

Formally stated, where $C = A \setminus B$

$$x \in C \leftrightarrow (x \in A \land x \notin B)$$

That is, [https://arbital.com/p/46m](https://arbital.com/p/46m) $x$ is in the relative complement $C$, then $x$ is in $A$ and x is not in $B$.

For example,

 - $\{1,2,3\} \setminus \{2\} = \{1,3\}$
 - $\{1,2,3\} \setminus \{9\} = \{1,2,3\}$
 - $\{1,2\} \setminus \{1,2,3,4\} = \{\}$

If we name the set $U$ as the set of all things, then we can define the [Absolute complement](https://arbital.com/p/5s7) of the set $A$, $A^\complement$, as $U \setminus A$


Cantor-Schröder-Bernstein theorem

summary(Technical): The Cantor-Schröder-Bernstein theorem states that the [class](https://arbital.com/p/class_set_theory) of [cardinals](https://arbital.com/p/4w5) forms a [total order](https://arbital.com/p/540). (Though not a totally ordered *set*, because [there is no set of all cardinals](https://arbital.com/p/cardinals_form_a_proper_class)).

Recall that we say a [set](https://arbital.com/p/3jz) $A$ is *smaller than or equal to* a set $B$ if there is an [injection](https://arbital.com/p/4b7) from $A$ to $B$.
The set $A$ *has the same [size](https://arbital.com/p/4w5)* as $B$ if there is a [bijection](https://arbital.com/p/499) between $A$ and $B$.

The Cantor-Schröder-Bernstein theorem states that if $A$ is smaller than or equal to $B$, and $B$ is smaller than or equal to $A$, then $A$ and $B$ have the same size.
This tells us that the arithmetic of [cardinals](https://arbital.com/p/4w5) is well-behaved in that it behaves like a [total order](https://arbital.com/p/540).
It is similar to the arithmetic of the [natural numbers](https://arbital.com/p/45h) in that it can never be the case that simultaneously $a < b$ and $b < a$.

# Proofs

There are several proofs, some concrete and some less so.

## Concrete proof

A clear explanation of the intuition of this proof [has been written](https://www.math.brown.edu/~res/infinity.pdf) by Richard Evan Schwartz; see page 61 of the linked PDF, or search on the word "dog" (which appears in the first page of the explanation).
[The intuition is Math0 suitable.](https://arbital.com/p/comment:)

Let $f: A \to B$ and $g: B \to A$ be injections; we will define a bijective function $h: A \to B$.

Because $f$ is injective, if $f$ ever hits $b$ (that is, if there is $a \in A$ such that $f(a) = b$) then it is possible to define $f^{-1}(b)$ to be the *unique* $a \in A$ such that $f(a) = b$; similarly with $g$.
The slogan is "if $f^{-1}(a)$ exists, then it is well-defined: there is no leeway about which element we might choose to be $f^{-1}(a)$".

Fix some $a \in A$, and consider the sequence $$\dots, f^{-1}(g^{-1}(a)), g^{-1}(a), a, f(a), g(f(a)), \dots$$
Now, this sequence might not extend infinitely to the left; it may not even get past $a$ to the left (if $g^{-1}(a)$ doesn't exist, for instance). %%note:On the other hand, perhaps the sequence does extend infinitely to the left.%%
Also, the sequence might duplicate elements: it might be the case that $gfgf(a) = a$, for instance. %%note:And maybe there is a repeat somewhere to the left, too.%%

Similarly, we can fix some $b \in B$, and consider $$\dots g^{-1} f^{-1}(b), f^{-1}(b), b, g(b), f(g(b)), \dots$$

Every element of $A$, and every element of $B$, appears in one of these chains.
Moreover, if $a \in A$ appears in two different chains, then in fact the two chains are the same %%note:Though maybe we're looking at a different place on the same chain. If we compare the $g^{-1} f^{-1}(b)$-chain with the $b$-chain, we see they're the same chain viewed two different ways: one viewing is two places offset from the other viewing.%%, because each element of the chain specifies and is specified by the previous element in the chain (if it exists) and each element of the chain specifies and is specified by the next element of the chain.

So every element of $A$ and every element of $B$ is in exactly one chain.
Now, it turns out that there are exactly four distinct "types" of chain.

- It could extend infinitely in both directions without repeats. In this case, we define $h(a) = f(a)$ for each element of $A$ in the chain. (Basically assigning to each element of $A$ the element of $B$ which is next in the chain.)
- It could extend infinitely off to the right, but it has a hard barrier at the left, and has no repeats: the chain stops at an element of $A$. In this case, again we define $h(a) = f(a)$ for each element of $A$ in the chain. (Again, basically assigning to each element of $A$ the element of $B$ which is next in the chain.)
- It could extend infinitely off to the right, but it has a hard barrier at the left, and has no repeats: the chain stops at an element of $B$. In this case, we define $h(a) = g^{-1}(a)$ for each element of $A$ in the chain. (Basically assigning to each element of $A$ the element of $B$ which is *previous* in the chain.)
- It could have repeats. Then it must actually be a cycle of even length (unrolled into an infinite line), because each element of the chain only depends on the one before it, and because we can't have two successive elements of $A$ (since the elements are alternating between $A$ and $B$). In this case, we define $h(a) = f(a)$ for each element of $A$ in the chain. (Basically assigning to each element of $A$ the element of $B$ which is next in the chain.)

Have we actually made a bijection?
Certainly our function is well-defined: every element of $A$ appears in exactly one chain, and we've specified where every element of $A$ in any chain goes, so we've specified where every element of $A$ goes.

Our function is [surjective](https://arbital.com/p/4bg), because every element of $B$ is in a chain; if $b \in B$ has an element $a$ of $A$ before it in its chain, then we specified that $h$ takes $a$ to $b$, while if $b \in B$ is at the leftmost end of its chain, we specified that $h$ takes $g(b)$ (that is, the following element in the chain) to $b$.

Our function is injective.
Since the chains don't overlap, and the first three cases of "what a chain might look like" have no repeats at all, the only possible way an element of $B$ can be hit twice by $h$ is if that element lies in one of the cyclical chains.
But then to elements of $A$ in that chain, $h$ assigns the following element of $B$; so $b \in B$ is hit only by the preceding element of $A$, which is the same in all cases because the chain is a cycle.
%%note:The picture in the linked intuitive document makes this much clearer.%%

## Proof from the [Knaster-Tarski theorem](https://arbital.com/p/knaster_tarski_theorem)
This proof is very quick, but almost completely opaque.
It relies on the [Knaster-Tarski fixed point theorem](https://arbital.com/p/knaster_tarski_theorem), which states that if $X$ is a [complete poset](https://arbital.com/p/complete_poset) and $f: X \to X$ is [order-preserving](https://arbital.com/p/order_preserving_map), then $f$ has a [https://arbital.com/p/-fixed_point](https://arbital.com/p/-fixed_point) (i.e. $x$ such that $f(x) = x$).

Let $f: A \to B$ and $g: B \to A$ be injective.

We are looking for a [partition](https://arbital.com/p/set_partition) $P \cup Q$ of $A$, and a partition $R \cup S$ of $B$, such that $f$ is injective from $P$ to $R$, and $g$ is injective from $S$ to $Q$.
(Then we can just define our bijection $A \to B$ by "do $f$ on $P$, and do $g^{-1}$ on $Q$".)

Now, the function $P \mapsto A \setminus g(B \setminus f(P))$ is order-preserving from the [https://arbital.com/p/-power_set](https://arbital.com/p/-power_set) $\mathcal{P}(A)$ to $\mathcal{P}(A)$ (ordered by inclusion), because there is an even number of complements.

But $\mathcal{P}(A)$ is complete as a poset ([proof](https://arbital.com/p/power_set_poset_is_complete)), so by Knaster-Tarski there is a set $P$ such that $P = A \setminus g(B \setminus f(P))$.

This yields our partition as required.

The Cantor-Schröder-Bernstein theorem tells us that if one [set](https://arbital.com/p/3jz) is [smaller-than-or-equal-to](https://arbital.com/p/4w5) another, and the other is smaller-than-or-equal-to the one, then they are the same size. That is, "comparison of set sizes" behaves itself, analogously to the fact in the [natural numbers](https://arbital.com/p/45h) that it can't be the case that both $1 < 2$ and $2<1$.


Well-defined

"Well-defined" is a slightly fuzzy word in mathematics.
Broadly, an object is said to be "well-defined" if it has been given a definition that is completely unambiguous, can be executed without regard to any arbitrary choices the mathematician might make, or generally is crisply defined.

(The [Wikipedia page](https://en.wikipedia.org/wiki/Well-defined) on well-definedness contains many examples for those who are more comfortable with mathematical notation.)

# Specific instances

## Functions
One of the most common uses of the phrase "well-defined" is when talking about [functions](https://arbital.com/p/3jy).
A function is **well-defined** if it really is a bona fide function.
This usually manifests itself as the following:

> Whenever $x=y$, we have $f(x) = f(y)$: that is, the output of the function doesn't depend on how we specify the input to the function, only on the input itself.

This property is often pretty easy to check.
For instance, the function from [$\mathbb{N}$](https://arbital.com/p/45h) to itself given by $n \mapsto n+1$ is "obviously" well-defined: it's trivially obvious that if $n=m$ then $f(n) = f(m)$.

However, sometimes it is not so easy.
The function $\mathbb{N} \to \mathbb{N}$ given by "take the number of prime factors" is not obviously well-defined, because it could in principle be the case that some number $n$ is equal to both $p_1 p_2 p_3$ and $q_1 q_2$ for some primes $p_1, p_2, p_3, q_1, q_2$; then our putative function might plausibly attempt to output either $3$ or $2$ on the same natural number input $n$, so the function would not be well-defined.
(It turns out that there is a non-trivial theorem, the [Fundamental Theorem of Arithmetic](https://arbital.com/p/5rh), guaranteeing that this function *is* in fact well-defined.)

Well-definedness in this context comes up very often when we are attempting to take a [quotient](https://arbital.com/p/quotient_by_equivalence_relation).
The fact that we can take the quotient of a [https://arbital.com/p/-3jz](https://arbital.com/p/-3jz) $X$ by an [https://arbital.com/p/-53y](https://arbital.com/p/-53y) $\sim$ is tantamount to saying:

> The function $X \to \frac{X}{\sim}$, given by $x \mapsto [https://arbital.com/p/x](https://arbital.com/p/x)$ the equivalence class of $X$, is well-defined.

---

Another, different, way a function could fail to be well-defined is if we tried to take the function $\mathbb{N} \to \mathbb{N}$ given by $n \mapsto n-5$.
This function is unambiguous, but it's not well-defined, because on the input $2$ it tries to output $-3$, which is not in the specified [codomain](https://arbital.com/p/3lg).

"Well-defined" is a slightly fuzzy word in mathematics. An object is said to be "well-defined" if it has been given a definition that is completely unambiguous, can be executed without regard to any arbitrary choices the mathematician might make, or generally is crisply defined.


Needs splitting by mastery

Readers who come to Arbital pages with different levels of mathematical background require different pages to explain the same concept. Sometimes a page is written in a way that seems to cater for multiple audiences (e.g. having a careful wordy explanation designed for people with little background, then throwing out formulas and proofs that could only be followed by someone with much more background). In these cases, it's often best to split the page into multiple [lenses](https://arbital.com/p/17b), designed for different [math level](https://arbital.com/p/52x) audiences.


Proof of Rice's theorem

Recall the formal statement of [Rice's theorem](https://arbital.com/p/5mv):

> We will use the notation $[https://arbital.com/p/n](https://arbital.com/p/n)$ for the $n$th [Turing machine](https://arbital.com/p/5pd) under some fixed [numbering system](https://arbital.com/p/description_number).
Each such machine induces a [https://arbital.com/p/-3jy](https://arbital.com/p/-3jy), which we will also write as $[https://arbital.com/p/n](https://arbital.com/p/n)$ where this is unambiguous due to context; then it makes sense to write $[n](m)$ for the value that machine $[https://arbital.com/p/n](https://arbital.com/p/n)$ outputs when it is run on input $m$.

> Let $A$ be a non-empty, proper %%note:That is, it is not the entire set.%% subset of $\{ \mathrm{Graph}(n) : n \in \mathbb{N} \}$, where $\mathrm{Graph}(n)$ is the [graph](https://arbital.com/p/graph_of_a_function) of the [https://arbital.com/p/-5p2](https://arbital.com/p/-5p2) computed by $[https://arbital.com/p/n](https://arbital.com/p/n)$, the $n$th Turing machine.
Then there is no Turing machine $[https://arbital.com/p/r](https://arbital.com/p/r)$ such that:

> - $[r](i)$ is $1$ if $\mathrm{Graph}(i) \in A$
> - $[r](i)$ is $0$ if $\mathrm{Graph}(i) \not \in A$.

We give a proof that is (very nearly) constructive: one which (if we could be bothered to work it all through) gives us an explicit example %%note:Well, very nearly; see the next note.%% of a [Turing machine](https://arbital.com/p/5pd) whose "am-I-in-$A$" nature cannot be determined by a Turing machine.
%%note:It's only "very nearly" constructive. It would be *actually* constructive if we knew in advance a specific example of a program whose function is in $A$, and a program whose function is in $B$. The proof here assumes the existence of a program of each type, but ironically the theorem itself guarantees that there is no fully-general way to *find* such programs.%%

We will present an intermediate lemma which does all the heavy lifting; this makes the actual reasoning rather unclear but very succinct, so we will also include an extensive worked example of what this lemma does for us.

# Fixed point theorem

The intermediate lemma is a certain fixed-point theorem.

> Let $h: \mathbb{N} \to \mathbb{N}$ be [total](https://arbital.com/p/total_function) computable: that is, it halts on every input.
Then there is $n \in \mathbb{N}$ such that $\mathrm{Graph}(n) = \mathrm{Graph}(h(n))$. %%note:And, moreover, we can actually *find* such an $n$.%%

That is, the "underlying function" of $n$ - the partial function computed by $[https://arbital.com/p/n](https://arbital.com/p/n)$ - has the same output, at every point, as the function computed by $[https://arbital.com/p/h](https://arbital.com/p/h)$.
If we view $h$ as a way of manipulating a program (as specified by its [https://arbital.com/p/-description_number](https://arbital.com/p/-description_number)), then this fixed-point theorem states that we can find a program whose underlying function is not changed at all by $h$.

The proof of this lemma is quite simple once the magic steps have been discovered, but it is devilishly difficult to intuit, because it involves two rather strange and confusing recursions and some self-reference.

Recall the [$s_{mn}$ theorem](https://arbital.com/p/translation_lemma), which states that there is a total computable function $S$ of two variables $m, n$ such that for every $e \in \mathbb{N}$, we have $[e](m, n) = [S(e,m)](n)$: that is, there is a total computable way $S$ of [https://arbital.com/p/-50p](https://arbital.com/p/-50p) computable functions.
(Strictly speaking, our Turing machines only take one argument. Therefore we should use a computable pairing scheme such as [Cantor's pairing function](https://arbital.com/p/cantor_pairing_function), so that actually $[e](m,n)$ should be interpreted as $[e](\mathrm{pair}) (m, n))$.)

Then the function which takes the pair $(e, x)$ and outputs the value of $[ h(S(e,e)) ](x)$ is computable, so it has a description number $a$, say.
%%note:This is the first strange part: we are treating $e$ both as a description number, and as an input to $[https://arbital.com/p/e](https://arbital.com/p/e)$, when we consider $S(e,e)$.%%

Now we claim that $S(a, a)$ is the $n$ we seek. %%note:This is the second strange part, for the same reason as $S(e,e)$ was the first; but this one is even worse, because the definition of $a$ already involves a weird recursion and we've just added another one on top.%%
Indeed, for any $x$, $[n](x) = [S(a,a)](x)$ by definition of $n$; this is $[a](a, x)$ by the $s_{mn}$ theorem; this is $[h(S(a,a))](x)$ by definition of $[https://arbital.com/p/a](https://arbital.com/p/a)$; and that is $[h(n)](x)$ by definition of $n$.

Therefore $[n](x) = [h(n)](x)$, so we have found our fixed point.

%%hidden(Worked example):

Suppose our description numbering scheme is just "expand $n$ as a number in base $128$, and interpret the result as an [ASCII](https://en.wikipedia.org/wiki/ASCII) %%note:This is a standard, agreed-upon method of turning a number between $0$ and $128$ into a character.%% string; then interpret that string as [Python](https://en.wikipedia.org/wiki/Python_) (programming_language)) code".

Then our function $h$, whatever it may be, can be viewed just as transforming Python code.

Suppose $h$ does nothing more than insert the following line of code as the second line of its input:

	x = 0

So, for instance, it takes the string

	x = 1
	print(x)

and returns

	x = 1
	x = 0
	print(x)

thereby changing the function computed from "return the constant $1$" to "return the constant $0$", in this case.
Note that many other functions will not change at all: for example, those which don't contain a variable $x$ in the first place will be unchanged, because all the modification does is add in an initialisation of a variable which will never subsequently be used.

The fixed-point theorem guarantees that there is indeed a Python program which will not change at all under this modification (though in this case it's very obvious).
In fact the theorem *constructs* such a program; can we work out what it is?

First of all, $S(m, n)$ can be implemented as follows.
We will take our Python code to be written so that their input is given in the variable `r1`, so $[e](5)$ is simply the Python code represented by $e$ but where the code-variable `r1` is initialised to $5$ first; that is, it can be found by prepending the line `r1 = 5` to the code represented by $e$.
Then we will assume that Python comes with a function `eval` (corresponding to $S$) which takes as its input a string %%note:The string is standing in place of $m$, but we have just skipped the intermediate step of "unpack the integer into a string" and gone straight to assuming it is a string.%% and another argument with which `eval` initialises the variable `x` before running the string as a Python program in a separate instance of Python:

	eval("print(r1)", 5)  # does nothing other than print the number 5
	eval("print(y)", 5)  # throws an error because `y` is not defined when it comes to printing it
	eval("print(6)", 5)  # prints 6, ignoring the fact that the variable `r1` is equal to `5` in the sub-instance

Remember, our proof of the fixed point theorem says that the program we want has code $S(a, a)$, where $a$ takes a pair $(e, x)$ as input, and outputs $[h(S(e,e))](x)$.
What is $a$ specifically here?
Well, on the one hand we're viewing it as a string of code (because it comes as the first argument to $S$), and on the other we're viewing it as an integer (because it also comes as the second argument to $S$).

As code, `a` is the following string, where `h` is to be replaced by whatever we've already decided $h$ is:

	eval("r1 = e; h(eval(r1, str_as_int(r1)))", x)

We are assuming the existence of a function `str_as_int` which takes an ASCII string and returns the integer whose places in base 128 are the ASCII for each character of the string in turn.

For example, we have $h$ inserting the line `x = 0` as the second line, so our `a` is:

	eval("r1 = e; x = 0; eval(r1, str_as_int(r1))", x)

As a number, `a` is just the ASCII for this, interpreted in base 128 (i.e. a certain number which in this case happens to have 106 digits, which is why we don't give it here).

The claim of the fixed-point theorem, then, is that the following program is unchanged by $h$:

	eval("eval(\"r1 = e; x = 0; eval(r1, str_as_int(r1))\", x)", str_to_int("eval(\"r1 = e; x = 0; eval(r1, str_as_int(r1))\", x)"))

You may recognise this as a [quining](https://arbital.com/p/322) construction.
%%

# Deducing Rice's theorem from the fixed point theorem

Finally, Rice's theorem follows quickly: suppose we could decide in general whether $\mathrm{Graph}(n) \in A$ or not, and label by $\iota$ the computable function which decides this (that is, whose value is $1$ if $\mathrm{Graph}(n) \in A$, and $0$ otherwise).

Since $A$ is nonempty and proper, there are natural numbers $a$ and $b$ such that $\mathrm{Graph}(a) \in A$ but $\mathrm{Graph}(b) \not \in A$.
Define the computable function $g$ which takes $n$ and outputs $a$ if $\iota(n) = 0$, and $b$ otherwise.
(That is, it flips its input: if its input had the property of $A$, the function $g$ outputs $b$ whose graph is not in $A$, and vice versa.
Informally, it is the program-transformer that reads in a program, determines whether the program computes a function in $A$ or not, and transforms the program into a specific canonical example of something which has the *opposite* $A$-ness status.)

By the fixed-point theorem, we can find $n$ such that $\mathrm{Graph}(n) = \mathrm{Graph}(g(n))$.

But now we can ask whether $\mathrm{Graph}(n)$ is in $A$ (and therefore whether $\mathrm{Graph}(g(n))$ is in $A$).

- If it is in $A$, then $g(n) = b$ and so $\mathrm{Graph}(g(n)) = \mathrm{Graph}(b)$ which is not in $A$.
- If it is not in $A$, then $g(n) = a$ and so $\mathrm{Graph}(g(n)) = \mathrm{Graph}(a)$ is in $A$.

We have obtained [contradictions](https://arbital.com/p/46z) in both cases (namely that $\mathrm{Graph}(g(n))$ is both in $A$ and not in $A$), so it must be the case that $\iota$ does not exist after all.

This lens proves [Rice's theorem](https://arbital.com/p/5mv) via a fixed-point theorem on computable functions.


Needs links

Some pages don't have many [greenlinks](https://arbital.com/p/17f), making them less useful than they could be.


Algorithmic complexity

Algorithmic complexity is a formal measure of the minimum amount of information required to specify some message, binary string, computer program, classification rule, etcetera.  The algorithmic complexity or Kolmogorov complexity of a message is the number of 1s and 0s required to specify a Turing machine that reproduces the message.

(The relevant Wikipedia article is filed under [Kolmogorov complexity](http://en.wikipedia.org/wiki/Kolmogorov_complexity).  Not to be confused with "[computational complexity](https://arbital.com/p/49w)", which isn't the same thing at all.)

A string of a million 1s has around as much K-complexity as the number 1,000,000, since getting a Turing machine to print out exactly a million 1s and then stop, is mostly a matter of encoding the number 1,000,000.  The number 1,000,000 can itself potentially be compressed further, since it's an unusually simple number of that magnitude: it's 10 to the 6th power, so if we already have a concept of 'exponentiation' or can encode it simply, we just need to encode the numbers 10 and 6, which are quite small.

When we say that a message has high Kolmogorov complexity, we mean that it *can't be compressed beyond a certain point* (unless the 'compression algorithm' is itself large and contains much of the key information baked in).  Things have high Kolmogorov complexity when they're made up of many independent facts that can't be predicted from knowing the previous facts.

Shakespeare's _Romeo and Juliet_ will compress by a lot using simple algorithms, because there are many words used more than once, and some words are much more frequent than others.  But we are exceedingly unlikely to find, anywhere in the first trillion Turing machines, any Turing machine that prints out the exact text of this play.  2^40 is greater than a trillion, so if we consider the set of all 40-bit binary strings, it's clear we can't print out *all* of them exactly using the first trillion Turing machines.  Finding a 40-bit Turing machine that printed out the exact text of _Romeo and Juliet_ would be vastly improbable.

On the other hand, it wouldn't be particularly surprising to find a small Turing machine that printed out $3\uparrow\uparrow\uparrow3$ 1s and then stopped, because the algorithm for this enormous number seems simple, and easy to encode as a computer program or Turing machine.

The algorithmic complexity of a system shouldn't be confused with the total number of visible, complicated-looking details.  The [Mandelbrot set](https://en.wikipedia.org/wiki/Mandelbrot_set) looks very complicated visually - you can keep zooming in using more and more detail - but there's a very simple rule that generates it, so we say the algorithmic complexity is very low.

As a corollary, a piece of a big-looking object can easily have more Kolmogorov complexity than the whole.  If you zoom far down into the Mandelbrot set and isolate a particular piece of the fractal, the information of that image now includes both the Mandelbrot-generating rule and also the exact location of that particular piece.

Similarly, the Earth is much more algorithmically complex than the laws of physics, and if there's a multiverse that developed deterministically out of the laws of physics, the Earth would be much more complex than that multiverse.  To print out the whole multiverse, you'd only need to start from the laws of physics and work forward; to print out *Earth in particular* you'd need a huge number of additional bits to locate Earth *inside* the multiverse.

Or more simply, we can observe that a program that prints out all possible books in order, is much simpler than a program that prints out only _Romeo and Juliet_.  To put it another way, Borge's "Library of Babel" containing every possible book has far lower algorithmic complexity than an Earth library containing only some books.  The moral is that the amount of visible stuff and its seeming surface complexity should not be confused with the notion of algorithmic complexity or theoretical compressibility.

Jaime Sevilla Molina
Eliezer Yudkowsky
Alexei Andreev


Image requested

An editor has requested an image for this page, described in a \.


Euclidean domains are principal ideal domains

summary(Technical): Let $R$ be a [https://arbital.com/p/euclidean_domain](https://arbital.com/p/euclidean_domain). Then $R$ is a [https://arbital.com/p/-5r5](https://arbital.com/p/-5r5).

A common theme in [ring theory](https://arbital.com/p/3gq) is the idea that we identify a property of the [integers](https://arbital.com/p/48l), and work out what that property means in a more general setting.
The idea of the [https://arbital.com/p/euclidean_domain](https://arbital.com/p/euclidean_domain) captures the fact that in $\mathbb{Z}$, we may perform the [https://arbital.com/p/-division_algorithm](https://arbital.com/p/-division_algorithm) (which can then be used to work out [greatest common divisors](https://arbital.com/p/5mw) 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 [https://arbital.com/p/-5r5](https://arbital.com/p/-5r5), so that every [ideal](https://arbital.com/p/ideal_ring_theory) has just one generator.

In turn, this forces the ring to have [unique factorisation](https://arbital.com/p/5vk) ([proof](https://arbital.com/p/pid_implies_ufd)), so in some sense the [Fundamental Theorem of Arithmetic](https://arbital.com/p/5rh) (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 [https://arbital.com/p/euclidean_domain](https://arbital.com/p/euclidean_domain).
Then $R$ is a [https://arbital.com/p/-5r5](https://arbital.com/p/-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](https://arbital.com/p/ideal_ring_theory) is principal, so take an ideal $I \subseteq R$.
We'll view $I$ as the [kernel](https://arbital.com/p/5r6) of a [homomorphism](https://arbital.com/p/ring_homomorphism) $\alpha: R \to S$; recall that this is the proper way to think of ideals. ([Proof of the equivalence.](https://arbital.com/p/5r9))
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}[](https://arbital.com/p/\frac{1}{2})$ is an example. ([Proof.](http://www.maths.qmul.ac.uk/~raw/MTH5100/PIDnotED.pdf))

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


Unique factorisation domain

summary: A [ring](https://arbital.com/p/3gq) $R$ is a *unique factorisation domain* if an analog of the [https://arbital.com/p/5rh](https://arbital.com/p/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 [irreducibles](https://arbital.com/p/5m1), and the expression must be unique if we do not care about ordering or about multiplying by elements which have multiplicative inverses.

[Ring theory](https://arbital.com/p/3gq) is the art of extracting properties from the [integers](https://arbital.com/p/48l) 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' [https://arbital.com/p/5rh](https://arbital.com/p/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 [$\mathbb{C}$](https://arbital.com/p/4zw) 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 [https://arbital.com/p/-5md](https://arbital.com/p/-5md).
Then $R$ is a *unique factorisation domain* if every nonzero non-[unit](https://arbital.com/p/5mg) element of $R$ may be expressed as a product of [irreducibles](https://arbital.com/p/5m1), 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 [https://arbital.com/p/-5r5](https://arbital.com/p/-5r5) is a unique factorisation domain. ([Proof.](https://arbital.com/p/pid_implies_ufd)) This fact is not trivial! Therefore $\mathbb{Z}$ is a UFD, though we can also prove this directly; this is the [https://arbital.com/p/5rh](https://arbital.com/p/5rh).
- $\mathbb{Z}[https://arbital.com/p/-\sqrt{3}](https://arbital.com/p/-\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 [irreducibles](https://arbital.com/p/5m1) 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 [prime](https://arbital.com/p/5m2). ([Proof.](https://arbital.com/p/alternative_condition_for_ufd))

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


Factorial

# 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 [https://arbital.com/p/-54s](https://arbital.com/p/-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$.

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


Transcendental number

summary: A *transcendental* number $z$ is one such that there is no (nonzero) [https://arbital.com/p/-polynomial](https://arbital.com/p/-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 [real](https://arbital.com/p/4bc) or [complex](https://arbital.com/p/4zw) number is said to be *transcendental* if it is not the root of any (nonzero) [https://arbital.com/p/-48l](https://arbital.com/p/-48l)-coefficient [https://arbital.com/p/-polynomial](https://arbital.com/p/-polynomial).
("Transcendental" means "not [algebraic](https://arbital.com/p/algebraic_number)".)

# 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 [rational](https://arbital.com/p/4zq) 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 all](https://arbital.com/p/almost_every)" real numbers are transcendental.
(The same proof can be used to demonstrate the existence of [irrational numbers](https://arbital.com/p/54z).)

It is a fairly easy fact that the *non*-transcendental numbers (that is, the algebraic numbers) form a [https://arbital.com/p/-countable](https://arbital.com/p/-countable) subset of the real numbers.
Indeed, the [Fundamental Theorem of Algebra](https://arbital.com/p/fundamental_theorem_of_algebra) states that every polynomial of degree $n$ has exactly $n$ complex roots (if we count them with [multiplicity](https://arbital.com/p/multiplicity), so that $x^2+2x+1$ has the "two" roots $x=-1$ and $x=-1$).
There are only countably many integer-coefficient polynomials , 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 ([proof](https://arbital.com/p/reals_are_uncountable)), 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

Chris Barnett
Eric Bruylant
Patrick Stevens
Joe Zeng

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


Ordered field

An **ordered field** is an [https://arbital.com/p/-55j](https://arbital.com/p/-55j) with the additional property that [https://arbital.com/p/-division](https://arbital.com/p/-division) is possible, making it a [field](https://arbital.com/p/481).


Placeholder

This is an empty page created for a [parent](https://arbital.com/p/3n), [requisite](https://arbital.com/p/1ln), or [teaches](https://arbital.com/p/3jg) 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 [Arbital's knowledge network](https://arbital.com/p/1sm)!

Contrast:

* [https://arbital.com/p/72](https://arbital.com/p/72), for tiny pages containing only a paragraph or a couple of sentences of text.
* [https://arbital.com/p/5xq](https://arbital.com/p/5xq), for outlines of pages.

**[Quality scale](https://arbital.com/p/4yg)**

* [https://arbital.com/p/4ym](https://arbital.com/p/4ym)
* [https://arbital.com/p/4gs](https://arbital.com/p/4gs)
* [https://arbital.com/p/5xs](https://arbital.com/p/5xs)
* [https://arbital.com/p/5xq](https://arbital.com/p/5xq)
* [https://arbital.com/p/72](https://arbital.com/p/72)
* [https://arbital.com/p/3rk](https://arbital.com/p/3rk)
* [https://arbital.com/p/4y7](https://arbital.com/p/4y7)
* [https://arbital.com/p/4yd](https://arbital.com/p/4yd)
* [https://arbital.com/p/4yf](https://arbital.com/p/4yf)
* [https://arbital.com/p/4yl](https://arbital.com/p/4yl)


LaTeX


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(Technical): The phrase "disjoint union" is used to mean one of two slightly different operations on [sets](https://arbital.com/p/3jz). It indicates either "just take the [union](https://arbital.com/p/5s8), but also notice that we've been careful to ensure that the sets have empty [intersection](https://arbital.com/p/5sb)", 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 [sets](https://arbital.com/p/3jz) is just the [union](https://arbital.com/p/5s8), 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 [intersection](https://arbital.com/p/5sb). 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 [union](https://arbital.com/p/5s8), 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$ [bijects](https://arbital.com/p/499) 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 [natural numbers](https://arbital.com/p/45h) 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 [more than one way](https://arbital.com/p/ordered_pair_formal_definitions) to define the ordered pair in the [https://arbital.com/p/ZF](https://arbital.com/p/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.)

Eric Rogstad
David Roldán Palacio
Patrick Stevens


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 [axiom of extensionality](https://arbital.com/p/618).
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 [https://arbital.com/p/-46m](https://arbital.com/p/-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 [https://arbital.com/p/-4w5](https://arbital.com/p/-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.

[Punctuation can be weird in this edit, as the author is not a native English speaker. Might need to be improved](https://arbital.com/p/comment:)

Ilia Zaichuk
Alexei Andreev
Dylan Hendrickson
Eric Rogstad
Patrick Stevens
Luke Sciarappa


Universal property of the empty set

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

To start us off, recall that the [https://arbital.com/p/-5zc](https://arbital.com/p/-5zc) $\emptyset$ is usually defined as the [set](https://arbital.com/p/3jz) which contains no elements.
That property picks it out uniquely, because we have the "[Axiom of Extensionality](https://arbital.com/p/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 ([vacuously](https://arbital.com/p/vacuous_truth)) 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 *[functions](https://arbital.com/p/3jy) which have the set as their [domain](https://arbital.com/p/3js)*.
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 [codomain](https://arbital.com/p/3lg). %%note:We usually only care about the [image](https://arbital.com/p/3lh) 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 [https://arbital.com/p/-5ss](https://arbital.com/p/-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 [https://arbital.com/p/vacuous_truth](https://arbital.com/p/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 [https://arbital.com/p/-identity_function](https://arbital.com/p/-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](https://arbital.com/p/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 [domain](https://arbital.com/p/-3js) 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 [image](https://arbital.com/p/3lh)?
%%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 [codomain](https://arbital.com/p/-3lg)?
%%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 ([vacuously](https://arbital.com/p/vacuous_truth)).
- 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.
[There are three proofs](https://arbital.com/p/603), 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 [here](https://arbital.com/p/603)), 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 [bijection](https://arbital.com/p/499) 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 [group](https://arbital.com/p/3gd) $G$ such that for every group $H$, there is a unique [homomorphism](https://arbital.com/p/47t) from $H$ to $G$.
- The [ring](https://arbital.com/p/3gq) $R$ such that for every ring $S$, there is a unique [homomorphism](https://arbital.com/p/ring_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 [isomorphism](https://arbital.com/p/4f4)": 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.

Eric Bruylant
Patrick Stevens
Alexei Andreev

The [https://arbital.com/p/-5zc](https://arbital.com/p/-5zc) can be characterised by how it interacts with *other* [sets](https://arbital.com/p/3jz), 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 [https://arbital.com/p/-600](https://arbital.com/p/-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$.)


Set product

summary(Technical): The product of [sets](https://arbital.com/p/3jz) $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)\}

The product of two [sets](https://arbital.com/p/3jz) $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.