Real number (as Dedekind cut)

%%comment: Mnemonics for defined macros: \Ql = Q left, \Qr = Q right, \Qls = Q left strict, \Qrs = Q right strict.%%

The rational numbers have a problem that makes them unsuitable for use in calculus — they have "gaps" in them. This may not be obvious or even make sense at first, because between any two rational numbers you can always find infinitely many other rational numbers. How could there be *gaps* in a set like that? $\newcommand{\rats}{\mathbb{Q}} \newcommand{\Ql}{\rats^\le} \newcommand{\Qr}{\rats^\ge} \newcommand{\Qls}{\rats^<} \newcommand{\Qrs}{\rats^>}$
$\newcommand{\set}[https://arbital.com/p/1](https://arbital.com/p/1){\left\{#1\right\}} \newcommand{\sothat}{\ |\ }$

But using the construction of [Dedekind cuts](https://arbital.com/p/dedekind_cut), we can suss out these gaps into plain view. A Dedekind cut of a [https://arbital.com/p/-540](https://arbital.com/p/-540) $S$ is a pair of sets $(A, B)$ such that:

1. Every element of $S$ is in exactly one of $A$ or $B$. (That is, $(A, B)$ is a [partition](https://arbital.com/p/set_partition) of $S$.)
2. Every element of $A$ is less than every element of $B$.
3. Neither $A$ nor $B$ is [empty](https://arbital.com/p/empty_set). (We'll see why this restriction matters in a moment.)

One example of such a cut might be the set where $A$ is the negative rational numbers and $B$ is the nonnegative rational numbers (positive or zero). We see that it satisfies the three properties of a Dedekind cut:

1. Every rational number is either negative or nonnegative, but not both.
2. Every rational number which is negative is less than a rational number that is nonnegative.
3. There exists at least one negative rational number (e.g. $-1$) and one nonnegative rational number (e.g. $1$).

In fact, Dedekind cuts are intended to represent sets of rational numbers that are less than or greater than a specific real number (once we've defined them). To represent this, let's call them $\Ql$ and $\Qr$.

Knowing this, why does it matter that neither set in a Dedekind cut is empty?

%%hidden(Show solution):
If $\Ql$ were empty, then we'd have a real number less than _all_ the rational numbers, which is $-\infty$, which we don't want to define as a real number. Similarly, if $\Qr$ were empty, then we'd get $+\infty$.
%%

## Completion of a space

If a space is [complete](https://arbital.com/p/) (doesn't have any gaps in it), then in any Dedekind cut $(\Ql, \Qr)$, either $\Ql$ will have a greatest element or $\Qr$ will have a least element. (We can't have both at the same time — why?)

%%hidden(Show solution):
Suppose $\Ql$ had a greatest element $q_u$ and $\Qr$ had a least element $q_v$. We can't have $q_u = q_v$, because the same number would be in both sets. So then because the rational numbers are a dense space, there must exist a rational number $r$ so that $q_u < r < q_v$. Then $r$ is not in either $\Ql$ or $\Qr$, contradicting property 1 of a Dedekind cut.
%%

But in the rational numbers, we can find a Dedekind cut where neither $\Ql$ nor $\Qr$ have a greatest or least element respectively.

Consider the pair of sets $(\Ql, \Qr)$ where $\Ql = \set{x \in \rats \mid x^3 \le 2}$ and $\Qr = \set{x \in \rats \mid x^3 \ge 2}$.

1. Every rational number has a cube either greater than 2 or less than 2,
2. Because $f(x) = x^3$ is a [monotonically increasing](https://arbital.com/p/) function, we have that $p < q \iff p^3 < q^3$, which means that every element in $\Ql$ is less than every element in $\Qr$.

So $(\Ql, \Qr)$ is a Dedekind cut. However, there is no rational number whose cube is *equal to* $2$, so $\Ql$ has no greatest element and $\Qr$ has no least element.

This represents a gap in the numbers, because we can invent a new number to place in that gap (in this case $\sqrt[https://arbital.com/p/3](https://arbital.com/p/3){2}$), which is "between" any two numbers in $\Ql$ and $\Qr$.

## Definition of real numbers

Before we move on, we will define one more structure that makes the construction more elegant. Define a *one-sided Dedekind cut* as any Dedekind cut $(\Ql, \Qr)$ with the additional property that the set $\Ql$ has no greatest element (in which case we now call it $\Qls$). The case where $\Ql$ has a greatest element $q_g$ can be trivially transformed into the equivalent case on the other side by moving $q_g$ to $\Qr$ where it is automatically the least element due to being less than any other element in $\Qr$.

Then we define the real numbers as the set of one-sided Dedekind cuts of the rational numbers.

* A rational number $r$ is mapped to itself by the Dedekind cut where $r$ itself is the least element of $\Qr$. (If the cuts weren't one-sided, $r$ would also be mapped to the set where $r$ was the greatest element of $\Ql$, which would make the mapping non-unique.)
* An irrational number $q$ is newly defined by the Dedekind cut where all the elements of $\Qls$ are less than $q$ and all the elements of $\Qr$ are (strictly) greater than $q$.

Now we can define the [total order](https://arbital.com/p/549) $\le$ for two real numbers $a = (\Qls_a, \Qr_a)$ and $b = (\Qls_b, \Qr_b)$ as follows: $a \le b$ when $\Qls_a \subseteq \Qls_b$.

Using this, we can show that unlike in the [Cauchy sequence definition](https://arbital.com/p/50d), we don't need to define any equivalence classes — every real number is uniquely defined by a one-sided Dedekind cut.

%%hidden(Proof):
If $a = b$, then $a \le b$ and $b \le a$. By the definition of the order, we have that $\Qls_a \subseteq \Qls_b$ and $\Qls_b \subseteq \Qls_a$, which means that $\Qls_a = \Qls_b$, which means that the Dedekind cuts corresponding to $a$ and $b$ are also equal.
%%

Eric Bruylant
Kevin Clancy
Dylan Hendrickson
Patrick Stevens
Joe Zeng

Summary: The real numbers can be defined using [Dedekind cuts](https://arbital.com/p/dedekind_cut), which are [partitions](https://arbital.com/p/set_partition) of the rational numbers into two sets where every element in one set is less than every element in the other set. Each real number is uniquely defined by a one-sided Dedekind cut.


Currying

Currying converts a [https://arbital.com/p/-3jy](https://arbital.com/p/-3jy) of N [inputs](https://arbital.com/p/input) into a function of a single input, which returns a function that takes a second input, which returns a function that takes a third input, and so on, until N functions have been evaluated and N inputs have been taken, at which point the original function is evaluated on the given inputs and the result is returned.

For example:

Consider a function of four parameters, $F:(X,Y,Z,N)→R$.

The curried version of the function, $curry(F)$ would have the type signature $X→(Y→(Z→(N→R)))$, and $curry(F)(4)(3)(2)(1)$ would equal $F(4,3,2,1)$.

Currying is named after the logician Haskell Curry. If you can't remember this derivation and need a mnemonic, you might like to imagine a function being cooked in a curry so thoroughly that it breaks up into small, bite-sized pieces, just as functional currying breaks a function up into smaller functions. (It might also help to note that there is a programming language also named after Haskell Curry (Haskell), that features currying prominently. All functions in Haskell are pre-curried by convention. This often makes [partially applying](https://wiki.haskell.org/Partial_application) functions effortless.)


Proof

Proof pages provide [formal proofs](https://arbital.com/p/proof) about a statement, but don't motivate or explain them.


External resources

This lens links out to other great resources across the web. External resources lenses should never be the main lens, Arbital should always have at least a [https://arbital.com/p/-72](https://arbital.com/p/-72) with a popover [summary](https://arbital.com/p/1kl).


The set of rational numbers is countable

The set $\mathbb{Q}$ of [rational numbers](https://arbital.com/p/4zq) is countable: that is, there is a [bijection](https://arbital.com/p/499) between $\mathbb{Q}$ and the set $\mathbb{N}$ of [natural numbers](https://arbital.com/p/45h).

# Proof

By the [Schröder-Bernstein theorem](https://arbital.com/p/cantor_schroeder_bernstein_theorem), it is enough to find an [injection](https://arbital.com/p/4b7) $\mathbb{N} \to \mathbb{Q}$ and an injection $\mathbb{Q} \to \mathbb{N}$.

The former is easy, because $\mathbb{N}$ is a subset of $\mathbb{Q}$ so the identity injection $n \mapsto \frac{n}{1}$ works.

For the latter, we may define a function $\mathbb{Q} \to \mathbb{N}$ as follows.
Take any rational in its lowest terms, as $\frac{p}{q}$, say. %%note:That is, the [GCD](https://arbital.com/p/greatest_common_divisor) of the numerator $p$ and denominator $q$ is $1$.%%
At most one of $p$ and $q$ is negative (if both are negative, we may just cancel $-1$ from the top and bottom of the fraction); by multiplying by $\frac{-1}{-1}$ if necessary, assume without loss of generality that $q$ is positive.
If $p = 0$ then take $q = 1$.

Define $s$ to be $1$ if $p$ is positive, and $2$ if $p$ is negative.

Then produce the natural number $2^p 3^q 5^s$.

The function $f: \frac{p}{q} \mapsto 2^p 3^q 5^s$ is injective, because [prime factorisations are unique](https://arbital.com/p/fundamental_theorem_of_arithmetic) so if $f\left(\frac{p}{q}\right) = f \left(\frac{a}{b} \right)$ (with both fractions in their lowest terms, and $q$ positive) then $|p| = |a|, q=b$ and the sign of $p$ is equal to the sign of $a$.
Hence the two fractions were the same after all.


Pi is irrational

The number [$\pi$](https://arbital.com/p/49r) is not [rational](https://arbital.com/p/4zq).

# Proof

For any fixed real number $q$, and any [https://arbital.com/p/-45h](https://arbital.com/p/-45h) $n$, let $$A_n = \frac{q^n}{n!} \int_0^{\pi} [](https://arbital.com/p/x)^n \sin(x) dx$$
where $n!$ is the [https://arbital.com/p/-5bv](https://arbital.com/p/-5bv) of $n$, $\int$ is the [https://arbital.com/p/-definite_integral](https://arbital.com/p/-definite_integral), and $\sin$ is the [https://arbital.com/p/-sin_function](https://arbital.com/p/-sin_function).

## Preparatory work

Exercise: $A_n = (4n-2) q A_{n-1} - (q \pi)^2 A_{n-2}$.
%%hidden(Show solution):
We use [https://arbital.com/p/-integration_by_parts](https://arbital.com/p/-integration_by_parts).

%%

Now, $$A_0 = \int_0^{\pi} \sin(x) dx = 2$$
so $A_0$ is an integer.

Also $$A_1 = q \int_0^{\pi} x (\pi-x) \sin(x) dx$$ which by a simple calculation is $4q$.
%%hidden(Show calculation):
Expand the integrand and then integrate by parts repeatedly:
$$\frac{A_1}{q} = \int_0^{\pi} x (\pi-x) \sin(x) dx = \pi \int_0^{\pi} x \sin(x) dx - \int_0^{\pi} x^2 \sin(x) dx$$

The first integral term is $$[\cos](https://arbital.com/p/-x)_0^{\pi} + \int_0^{\pi} \cos(x) dx = \pi$$

The second integral term is $$[\cos](https://arbital.com/p/-x^2)_{0}^{\pi} + \int_0^{\pi} 2x \cos(x) dx$$
which is $$\pi^2 + 2 \left( [\sin](https://arbital.com/p/x)_0^{\pi} - \int_0^{\pi} \sin(x) dx \right)$$
which is $$\pi^2 -4$$

Therefore $$\frac{A_1}{q} = \pi^2 - (\pi^2 - 4) = 4$$
%%

Therefore, if $q$ and $q \pi$ are integers, then so is $A_n$ [inductively](https://arbital.com/p/5fz), because $(4n-2) q A_{n-1}$ is an integer and $(q \pi)^2 A_{n-2}$ is an integer.

But also $A_n \to 0$ as $n \to \infty$, because $\int_0^{\pi} [](https://arbital.com/p/x)^n \sin(x) dx$ is in modulus at most $$\pi \times \max_{0 \leq x \leq \pi} [](https://arbital.com/p/x)^n \sin(x) \leq \pi \times \max_{0 \leq x \leq \pi} [](https://arbital.com/p/x)^n = \pi \times \left[https://arbital.com/p/\frac{\pi^2}{4}\right](https://arbital.com/p/\frac{\pi^2}{4}\right)^n$$
and hence $$|A_n| \leq \frac{1}{n!} \left[q}{4}\right](https://arbital.com/p/\frac{\pi^2)^n$$

For $n$ larger than $\frac{\pi^2 q}{4}$, this expression is getting smaller with $n$, and moreover it gets smaller faster and faster as $n$ increases; so its limit is $0$.
%%hidden(Formal treatment):
We claim that $\frac{r^n}{n!} \to 0$ as $n \to \infty$, for any $r > 0$.

Indeed, we have $$\frac{r^{n+1}/(n+1)!}{r^n/n!} = \frac{r}{n+1}$$
which, for $n > 2r-1$, is less than $\frac{1}{2}$.
Therefore the ratio between successive terms is less than $\frac{1}{2}$ for sufficiently large $n$, and so the sequence must shrink at least geometrically to $0$.
%%

## Conclusion

Suppose (for [contradiction](https://arbital.com/p/46z)) that $\pi$ is rational; then it is $\frac{p}{q}$ for some integers $p, q$.

Now $q \pi$ is an integer (indeed, it is $p$), and $q$ is certainly an integer, so by what we showed above, $A_n$ is an integer for all $n$.

But $A_n \to 0$ as $n \to \infty$, so there is some $N$ for which $|A_n| < \frac{1}{2}$ for all $n > N$; hence for all sufficiently large $n$, $A_n$ is $0$.
We already know that $A_0 = 2$ and $A_1 = 4q$, neither of which is $0$; so let $N$ be the first integer such that $A_n = 0$ for all $n \geq N$, and we can already note that $N > 1$.

Then $$0 = A_{N+1} = (4N-2) q A_N - (q \pi)^2 A_{N-1} = - (q \pi)^2 A_{N-1}$$
whence $q=0$ or $\pi = 0$ or $A_{N-1} = 0$.

Certainly $q \not = 0$ because $q$ is the denominator of a fraction; and $\pi \not = 0$ by whatever definition of $\pi$ we care to use.
But also $A_{N-1}$ is not $0$ because then $N-1$ would be an integer $m$ such that $A_n = 0$ for all $n \geq m$, and that contradicts the definition of $N$ as the *least* such integer.

We have obtained the required contradiction; so it must be the case that $\pi$ is irrational.

Eric Bruylant
Eric Rogstad
Patrick Stevens


Arithmetic of rational numbers (Math 0)

Now that we've seen [what the rational numbers are](https://arbital.com/p/4zx), we'll move on to working out how to combine them.

There are four main ways to combine rational numbers, and collectively they are called "arithmetic":

- [Addition](https://arbital.com/p/55m)
- [Subtraction](https://arbital.com/p/56x)
- [Multiplication](https://arbital.com/p/59s)
- [Division](https://arbital.com/p/5jd)

Additionally, we can *[compare](https://arbital.com/p/5pk)* rational numbers with each other; and we can show that all of these operations [play nicely together](https://arbital.com/p/5pm) in a certain sense.

This page is the start of an arc which will go through all of these ideas.
In the process, we'll get you familiar with the notation that we use for rational numbers; it's a very convenient shorthand once you've learnt [the conventions](https://arbital.com/p/5q5).

Summary: We can take two [rational numbers](https://arbital.com/p/4zq) and [add](https://arbital.com/p/addition) them together, just as we can take two [*natural* numbers](https://arbital.com/p/45h) and add them together; and all the other operations of the integers can be viewed in the rationals too.


Field structure of rational numbers

The [rational numbers](https://arbital.com/p/4zq), being the [https://arbital.com/p/-field_of_fractions](https://arbital.com/p/-field_of_fractions) of the [integers](https://arbital.com/p/48l), have the following [field](https://arbital.com/p/481) structure:

- Addition is given by $\frac{a}{b} + \frac{p}{q} = \frac{aq+bp}{bq}$
- Multiplication is given by $\frac{a}{b} \frac{c}{d} = \frac{ac}{bd}$
- The identity under addition is $\frac{0}{1}$
- The identity under multiplication is $\frac{1}{1}$
- The additive inverse of $\frac{a}{b}$ is $\frac{-a}{b}$
- The multiplicative inverse of $\frac{a}{b}$ (where $a \not = 0$) is $\frac{b}{a}$.

It additionally inherits a [total ordering](https://arbital.com/p/540) which respects the field structure: $0 < \frac{c}{d}$ if and only if $c$ and $d$ are both positive or $c$ and $d$ are both negative.
All other information about the ordering can be derived from this fact: $\frac{a}{b} < \frac{c}{d}$ if and only if $0 < \frac{c}{d} - \frac{a}{b}$.


Elementary Algebra

How do we describe relations between different things? How can we figure out new true things from true things we already know?
How can we find and think about patterns we notice with numbers? Algebra is a unified framework for thinking about these questions, and gives us lots of tools to help us answer them, which work in an extremely wide variety of situations.

#Equations
Algebra is based on the arithmetic of numbers, and the relations between them.
Let's look at a basic equation: $$2 + 2 = 4$$
The 'equals' sign (=) tells us that both sides of the equation are actually the same. If we have two, and add two more to it, then we'll have four.

Some other relations are 'less than' (<), for example $2 < 4$. or 'greater than' (>), for example $5 > 1$.

##The right order
In equations, parenthesis tell us the right order to do things - things inside of parenthesis have to be done before the rest. This is important because doing things in different orders can give us different answers!
$$2 + (3 \times 4) = 14$$
$$(2 + 3) \times 4 = 20$$

It's annoying to have to use parentheses all the time (though it might be helpful if you find yourself getting confused about something). It would be nice if we could just write $2 + 3 \times 4$ and have everyone know that we meant $2 + (3 \times 4)$ . There's a standard [order of operations](https://arbital.com/p/54s) that everyone uses so that we don't have to use too many parentheses.

#Balancing the truth
If we know one equation, what are some ways we could get _new_ equations from it, that will still be true?
We could make a change to one side, but then the equation would stop being true... unless we did the same change to the other side also! For example, we know $2+2=4$. What if we add three to both sides? If we check
$(2 + 2) + 3 = 4 + 3$, we can see that it's still true!

##Substitution
One way of getting new true things is really important. If we know two things are the same, we can always substitute one of them for the other, and this automatically will give us an equality relation between the two things!

This is really helpful for breaking down calculations into manageable pieces. For example, if we want to calculate $2^3 \times 2^4$, we can first expand $2^3 = 2 \times 2 \times 2$, and then calculate $2 \times 2 \times 2 = 8$. Now, we combine these last two equations to see that $2^3 = 8$. Often, people will do both of these in one step, so if you ever are having a hard time figuring out how someone got an equation, you can try breaking it down like this to see if that helps. Next, we can do the same thing to see that $2^4 = 2 \times 2 \times 2 \times 2 = 16$. We can then substitute both of these back into the original expression, to get $2^3 \times 2^4 = 8 \times 16$. One final calculation lets us see that $2^3\times 2^4 = 128$.

#Naming numbers
What are all those letters doing in math, anyway?

When you first learn someone's name, do you know everything there is to know about them? Sometimes, we know that there's _some_ number that fits in an equation, but we don't know what particular number it is yet. It's really helpful to be able to talk about the number anyway, in fact, giving it a name is often the first step to figuring out what it really is.

This kind of name is called a **variable**.

## Doing lots of things at once
Another way names are useful is if we want to say something about lots of numbers at once!
For example, you might notice that $0 \times 3 = 0$, $0 \times -4 = 0$, $0 \times 1224 = 0$ and so on. In fact, it's true that zero times _any_ number is zero. We could write this as $0 \times \text{any number} = 0$. Or if we need to keep referring to that number, we could give it a shorter name, while mentioning it could be any number: $0 \times x = 0$, where $x$ can be any number. This is really useful because it allows us to express patterns much more easily!

#Important patterns
These patterns hold for all [natural numbers](https://arbital.com/p/45h), [integers](https://arbital.com/p/48l), and [rational numbers](https://arbital.com/p/4zq), including for variables that are known to be one of these types of numbers, and much more! For an in-depth exploration of these patterns and their consequences, see the page on [rings](https://arbital.com/p/3gq).
##Commutativity
$$ a + b = b + a$$
$$ a \times b = b\times a$$
##Identity
$$ 0 + a = a$$
$$ 1 \times a = a$$
##Associativity
$$ (a + b) + c = a + (b + c)$$
$$ (a \times b ) \times c = a \times (b\times c)$$
##Distributivity
$$ a \times (b + c) = a\times b + a\times c$$
##Additive inverse
$$ a + (-a) = a - a = 0 $$

#Next steps
* [https://arbital.com/p/Solving_equations](https://arbital.com/p/Solving_equations)
* [Functions](https://arbital.com/p/3jy)

Gabriel Sjöstrand
Alexei Andreev
Eric Bruylant
Kevin Clancy
Adele Lopez


The reals (constructed as classes of Cauchy sequences of rationals) form a field

The real numbers, when [constructed as equivalence classes of Cauchy sequences](https://arbital.com/p/50d) of [rationals](https://arbital.com/p/4zq), form a [totally ordered](https://arbital.com/p/540) [field](https://arbital.com/p/481), with the inherited field structure given by

- $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [https://arbital.com/p/a_n+b_n](https://arbital.com/p/a_n+b_n)$
- $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [\times b_n](https://arbital.com/p/a_n)$
- $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ if and only if either $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ or for sufficiently large $n$, $a_n \leq b_n$.

# Proof

Firstly, we need to show that those operations are even well-defined: that is, if we pick two different representatives $(x_n)_{n=1}^{\infty}$ and $(y_n)_{n=1}^{\infty}$ of the same equivalence class $[https://arbital.com/p/x_n](https://arbital.com/p/x_n) = [https://arbital.com/p/y_n](https://arbital.com/p/y_n)$, we don't somehow get different answers.

## Well-definedness of $+$

We wish to show that $[https://arbital.com/p/x_n](https://arbital.com/p/x_n)+[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/y_n](https://arbital.com/p/y_n) + [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ whenever $[https://arbital.com/p/x_n](https://arbital.com/p/x_n) = [https://arbital.com/p/y_n](https://arbital.com/p/y_n)$ and $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$; this is an exercise.
%%hidden(Show solution):
Since $[https://arbital.com/p/x_n](https://arbital.com/p/x_n) = [https://arbital.com/p/y_n](https://arbital.com/p/y_n)$, it must be the case that both $(x_n)$ and $(y_n)$ are Cauchy sequences such that $x_n - y_n \to 0$ as $n \to \infty$.
Similarly, $a_n - b_n \to 0$ as $n \to \infty$.

We require $[https://arbital.com/p/x_n+a_n](https://arbital.com/p/x_n+a_n) = [https://arbital.com/p/y_n+b_n](https://arbital.com/p/y_n+b_n)$; that is, we require $x_n+a_n - y_n-b_n \to 0$ as $n \to \infty$.

But this is true: if we fix rational $\epsilon > 0$, we can find $N_1$ such that for all $n > N_1$, we have $|x_n - y_n| < \frac{\epsilon}{2}$; and we can find $N_2$ such that for all $n > N_2$, we have $|a_n - b_n| < \frac{\epsilon}{2}$.
Letting $N$ be the maximum of the two $N_1, N_2$, we have that for all $n > N$, $|x_n + a_n - y_n - b_n| \leq |x_n - y_n| + |a_n - b_n|$ by the [https://arbital.com/p/-triangle_inequality](https://arbital.com/p/-triangle_inequality), and hence $\leq \epsilon$.
%%

## Well-definedness of $\times$

We wish to show that $[https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times [https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/y_n](https://arbital.com/p/y_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ whenever $[https://arbital.com/p/x_n](https://arbital.com/p/x_n) = [https://arbital.com/p/y_n](https://arbital.com/p/y_n)$ and $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$; this is also an exercise.
%%hidden(Show solution):
We require $[a_n](https://arbital.com/p/x_n) = [b_n](https://arbital.com/p/y_n)$; that is, $x_n a_n - y_n b_n \to 0$ as $n \to \infty$.

Let $\epsilon > 0$ be rational.
Then $$|x_n a_n - y_n b_n| = |x_n (a_n - b_n) + b_n (x_n - y_n)|$$ using the very handy trick of adding the expression $x_n b_n - x_n b_n$.

By the triangle inequality, this is $\leq |x_n| |a_n - b_n| + |b_n| |x_n - y_n|$.

We now use the fact that [https://arbital.com/p/cauchy_sequences_are_bounded](https://arbital.com/p/cauchy_sequences_are_bounded), to extract some $B$ such that $|x_n| < B$ and $|b_n| < B$ for all $n$;
then our expression is less than $B (|a_n - b_n| + |x_n - y_n|)$.

Finally, for $n$ sufficiently large we have $|a_n - b_n| < \frac{\epsilon}{2 B}$, and similarly for $x_n$ and $y_n$, so the result follows that $|x_n a_n - y_n b_n| < \epsilon$.
%%

## Well-definedness of $\leq$

We wish to show that if $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$ and $[https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [https://arbital.com/p/d_n](https://arbital.com/p/d_n)$, then $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ implies $[https://arbital.com/p/c_n](https://arbital.com/p/c_n) \leq [https://arbital.com/p/d_n](https://arbital.com/p/d_n)$.

Suppose $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, but suppose for [contradiction](https://arbital.com/p/46z) that $[https://arbital.com/p/c_n](https://arbital.com/p/c_n)$ is not $\leq [https://arbital.com/p/d_n](https://arbital.com/p/d_n)$: that is, $[https://arbital.com/p/c_n](https://arbital.com/p/c_n) \not = [https://arbital.com/p/d_n](https://arbital.com/p/d_n)$ and there are arbitrarily large $n$ such that $c_n > d_n$.
Then there are two cases.

- If $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ then $[https://arbital.com/p/d_n](https://arbital.com/p/d_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$, so the result follows immediately. %%note:We didn't need the extra assumption that $[https://arbital.com/p/c_n](https://arbital.com/p/c_n) \not \leq [https://arbital.com/p/d_n](https://arbital.com/p/d_n)$ here.%%
- If for all sufficiently large $n$ we have $a_n \leq b_n$, then

## Additive [commutative](https://arbital.com/p/3jb) [group structure](https://arbital.com/p/3gd) on $\mathbb{R}$

The additive identity is $[https://arbital.com/p/0](https://arbital.com/p/0)$ (formally, the equivalence class of the sequence $(0, 0, \dots)$).
Indeed, $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/0](https://arbital.com/p/0) = [https://arbital.com/p/a_n+0](https://arbital.com/p/a_n+0) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$.

The additive inverse of the element $[https://arbital.com/p/a_n](https://arbital.com/p/a_n)$ is $[https://arbital.com/p/-a_n](https://arbital.com/p/-a_n)$, because $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/-a_n](https://arbital.com/p/-a_n) = [https://arbital.com/p/a_n-a_n](https://arbital.com/p/a_n-a_n) = [https://arbital.com/p/0](https://arbital.com/p/0)$.

The operation is commutative: $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [https://arbital.com/p/a_n+b_n](https://arbital.com/p/a_n+b_n) = [https://arbital.com/p/b_n+a_n](https://arbital.com/p/b_n+a_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$.

The operation is closed, because the sum of two Cauchy sequences is a Cauchy sequence (exercise).
%%hidden(Show solution):
If $(a_n)$ and $(b_n)$ are Cauchy sequences, then let $\epsilon > 0$.
We wish to show that there is $N$ such that for all $n, m > N$, we have $|a_n+b_n - a_m - b_m| < \epsilon$.

But $|a_n+b_n - a_m - b_m| \leq |a_n - a_m| + |b_n - b_m|$ by the triangle inequality; so picking $N$ so that $|a_n - a_m| < \frac{\epsilon}{2}$ and $|b_n - b_m| < \frac{\epsilon}{2}$ for all $n, m > N$, the result follows.
%%

The operation is associative: $$[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + ([https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n)) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/b_n+c_n](https://arbital.com/p/b_n+c_n) = [https://arbital.com/p/a_n+b_n+c_n](https://arbital.com/p/a_n+b_n+c_n) = [https://arbital.com/p/a_n+b_n](https://arbital.com/p/a_n+b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) = ([https://arbital.com/p/a_n](https://arbital.com/p/a_n)+[https://arbital.com/p/b_n](https://arbital.com/p/b_n))+[https://arbital.com/p/c_n](https://arbital.com/p/c_n)$$

## [Ring structure](https://arbital.com/p/3gq)

The multiplicative identity is $[https://arbital.com/p/1](https://arbital.com/p/1)$ (formally, the equivalence class of the sequence $(1,1, \dots)$).
Indeed, $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/1](https://arbital.com/p/1) = [\times 1](https://arbital.com/p/a_n) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$.

$\times$ is closed, because the product of two Cauchy sequences is a Cauchy sequence (exercise).
%%hidden(Show solution):
If $(a_n)$ and $(b_n)$ are Cauchy sequences, then let $\epsilon > 0$.
We wish to show that there is $N$ such that for all $n, m > N$, we have $|a_n b_n - a_m b_m| < \epsilon$.

But $$|a_n b_n - a_m b_m| = |a_n (b_n - b_m) + b_m (a_n - a_m)| \leq |b_m| |a_n - a_m| + |a_n| |b_n - b_m|$$ by the triangle inequality.

Cauchy sequences are bounded, so there is $B$ such that $|a_n|$ and $|b_m|$ are both less than $B$ for all $n$ and $m$.

So picking $N$ so that $|a_n - a_m| < \frac{\epsilon}{2B}$ and $|b_n - b_m| < \frac{\epsilon}{2B}$ for all $n, m > N$, the result follows.
%%

$\times$ is clearly commutative: $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [\times b_n](https://arbital.com/p/a_n) = [\times a_n](https://arbital.com/p/b_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n) \times [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$.

$\times$ is associative: $$[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times ([https://arbital.com/p/b_n](https://arbital.com/p/b_n) \times [https://arbital.com/p/c_n](https://arbital.com/p/c_n)) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [\times c_n](https://arbital.com/p/b_n) = [\times b_n \times c_n](https://arbital.com/p/a_n) = [\times b_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/c_n](https://arbital.com/p/c_n) = ([https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)) \times [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$$

$\times$ distributes over $+$: we need to show that $[https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times ([https://arbital.com/p/a_n](https://arbital.com/p/a_n)+[https://arbital.com/p/b_n](https://arbital.com/p/b_n)) = [https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times [https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$.
But this is true: $$[https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times ([https://arbital.com/p/a_n](https://arbital.com/p/a_n)+[https://arbital.com/p/b_n](https://arbital.com/p/b_n)) = [https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times [https://arbital.com/p/a_n+b_n](https://arbital.com/p/a_n+b_n) = [\times ](https://arbital.com/p/x_n) = [\times a_n + x_n \times b_n](https://arbital.com/p/x_n) = [\times a_n](https://arbital.com/p/x_n) + [\times b_n](https://arbital.com/p/x_n) = [https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times [https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/x_n](https://arbital.com/p/x_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$$

## Field structure

To get from a ring to a field, it is necessary and sufficient to find a multiplicative inverse for any $[https://arbital.com/p/a_n](https://arbital.com/p/a_n)$ not equal to $[https://arbital.com/p/0](https://arbital.com/p/0)$.

Since $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \not = 0$, there is some $N$ such that for all $n > N$, $a_n \not = 0$.
Then defining the sequence $b_i = 1$ for $i \leq N$, and $b_i = \frac{1}{a_i}$ for $i > N$, we obtain a sequence which induces an element $[https://arbital.com/p/b_n](https://arbital.com/p/b_n)$ of $\mathbb{R}$; and it is easy to check that $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [https://arbital.com/p/1](https://arbital.com/p/1)$.
%%hidden(Show solution):
$[https://arbital.com/p/a_n](https://arbital.com/p/a_n) [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [b_n](https://arbital.com/p/a_n)$; but the sequence $(a_n b_n)$ is $1$ for all $n > N$, and so it lies in the same equivalence class as the sequence $(1, 1, \dots)$.
%%

## Ordering on the field

We need to show that:

- if $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, then for every $[https://arbital.com/p/c_n](https://arbital.com/p/c_n)$ we have $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$;
- if $[https://arbital.com/p/0](https://arbital.com/p/0) \leq [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$ and $[https://arbital.com/p/0](https://arbital.com/p/0) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, then $[https://arbital.com/p/0](https://arbital.com/p/0) \leq [https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times[https://arbital.com/p/b_n](https://arbital.com/p/b_n)$.

We may assume that the inequalities are strict, because if equality holds in the assumption then everything is obvious.
%%hidden(Show obvious bits):
If $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, then for every $[https://arbital.com/p/c_n](https://arbital.com/p/c_n)$ we have $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) = [https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$ by well-definedness of addition.
Therefore $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$.

If $[https://arbital.com/p/0](https://arbital.com/p/0) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$ and $[https://arbital.com/p/0](https://arbital.com/p/0) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, then $[https://arbital.com/p/0](https://arbital.com/p/0) = [https://arbital.com/p/0](https://arbital.com/p/0) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n) = [https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, so it is certainly true that $[https://arbital.com/p/0](https://arbital.com/p/0) \leq [https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$.
%%

For the former: suppose $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) < [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, and let $[https://arbital.com/p/c_n](https://arbital.com/p/c_n)$ be an arbitrary equivalence class.
Then $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) = [https://arbital.com/p/a_n+c_n](https://arbital.com/p/a_n+c_n)$; $[https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) = [https://arbital.com/p/b_n+c_n](https://arbital.com/p/b_n+c_n)$; but we have $a_n + c_n \leq b_n + c_n$ for all sufficiently large $n$, because $a_n \leq b_n$ for sufficiently large $n$.
Therefore $[https://arbital.com/p/a_n](https://arbital.com/p/a_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n) \leq [https://arbital.com/p/b_n](https://arbital.com/p/b_n) + [https://arbital.com/p/c_n](https://arbital.com/p/c_n)$, as required.

For the latter: suppose $[https://arbital.com/p/0](https://arbital.com/p/0) < [https://arbital.com/p/a_n](https://arbital.com/p/a_n)$ and $[https://arbital.com/p/0](https://arbital.com/p/0) < [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$.
Then for sufficiently large $n$, we have both $a_n$ and $b_n$ are positive; so for sufficiently large $n$, we have $a_n b_n \geq 0$.
But that is just saying that $[https://arbital.com/p/0](https://arbital.com/p/0) \leq [https://arbital.com/p/a_n](https://arbital.com/p/a_n) \times [https://arbital.com/p/b_n](https://arbital.com/p/b_n)$, as required.


Likelihood notation

The likelihood of a piece of evidence $e$ according to a hypothesis $H,$ known as "the likelihood of $e$ given $H$", is often written either $\mathcal L_e(H)$ or $\mathcal L(H \mid e).$ The latter notation is confusing, because then $\mathcal L(H \mid e) = \mathbb P(e \mid H).$ Many students of statistics find it hard enough to keep the difference between $\mathbb P(H \mid e)$ and $\mathbb P(e \mid H)$ straight in their heads if we _don't_ occasionally swap the order of the arguments when talking about similar functions, so on Arbital, we much prefer the notation $\mathcal L_e(H) = \mathbb P(e \mid H).$

[Make this a child of 'likelihood' when 'likelihood' exists.](https://arbital.com/p/fixme:)


Modal logic

Modal logic is a [https://arbital.com/p/formal_system](https://arbital.com/p/formal_system) in which we expand [https://arbital.com/p/-propositional_calculus](https://arbital.com/p/-propositional_calculus) with two new operators meant to represent necessity ($\square$) and possibility ($\diamond$).%%note:There are more [general modal logics](https://arbital.com/p/) with different modal predicates out there.%%

Those two operators can be defined in terms of each other. For example, we have that something is possible iff it is not necessary that its opposite is true; ie, $\diamond A \iff \neg \square \neg A$.

Thus in modal logic, you can express sentences as $\square A$ to express that it is necessary that $A$ is true. You can also go more abstract and say $\neg\square \bot$ to express that it is not necessary that false is true. If we read the box operator as "there is no mathematical proof of" then the previous sentence becomes "there is no mathematical proof of falsehood", which encodes the [consistency of arithmetic](https://arbital.com/p/).

There are many systems of modal logic %note: See for example [T](https://arbital.com/p/t_modal_logic),[B](https://arbital.com/p/b_modal_logic),[S5](https://arbital.com/p/s5_modal_logic),[S4](https://arbital.com/p/s4_modal_logic),[K](https://arbital.com/p/k_modal_logic), [GLS](https://arbital.com/p/gls_modal_logic)%, which differ in the sentences they take as [https://arbital.com/p/-axioms](https://arbital.com/p/-axioms) and which [rules of inference](https://arbital.com/p/) they allow.

Of particular interest are the systems called [normal systems of modal logic](https://arbital.com/p/5j8), and especially the [$Gödel-Löb$](https://arbital.com/p/5l3) system (called $GL$ for short, also known as the logic of provability). The main interest of $GL$ comes from being a [decidable](https://arbital.com/p/) logic which allows us to reason about sentences of [Peano arithmetic](https://arbital.com/p/3ft) talking about [provability](https://arbital.com/p/5gt) via [translations](https://arbital.com/p/), as proved by the [arithmetical adequacy theorems of Solomonov](https://arbital.com/p/).

Another widely studied system of modal logic is $GLS$, for which Solomonov proved [adequacy for truth](https://arbital.com/p/) in the [https://arbital.com/p/-standard_model_of_arithmetic](https://arbital.com/p/-standard_model_of_arithmetic).

The [semantics](https://arbital.com/p/semantics_mathematical) of the normal systems of modal logic come in the form of [https://arbital.com/p/Kripke_models](https://arbital.com/p/Kripke_models): digraph structures composed of worlds over which a visibility relation is defined.

##Sentences
Well formed sentences of modal logic are defined as follows:

* $\bot$ is a well-formed sentence of modal logic.
* The sentence letters $p,q,...$ are well-formed sentences of modal logic.
* If $A$ is a well-formed sentence, then $\square A$ is a well-formed sentence.
* If $A$ and $B$ are well formed sentences, then $A\to B$ is a well-formed sentence.

The rest of [logical connectors](https://arbital.com/p/) can then be defined as abbreviations for structures made from implication and $\bot$. For example , $\neg A = A\to \bot$. The possibility operator $\diamond$ is defined as $\neg\square\neg$ as per the previous discussion.

Eric Bruylant
Patrick LaVictoire
Jaime Sevilla Molina


Integers: Intro (Math 0)

The integers are an extension of the [natural numbers](https://arbital.com/p/45h) into the *negatives*.

## Negative numbers

Negative numbers are numbers less than zero. They are notated as numbers with a minus sign in front of them, like $-2$ or $-15$ or $-6387$.

When many people are first introduced to the concept of negative numbers, one question they have is, "how do negative numbers exist? How can we have less than nothing of something?"

Usually this question is answered with something about travelling along the number line and then going in the opposite direction past zero. But we can also answer this question from the traditional perspective of quantities, using _antimatter_.

## Arithmetic with anti-cows

Matter and antimatter are substances that annihilate each other — they cancel each other out. In the same way, positive and negative quantities cancel each other out to some extent when added together.

Let's create a physical example of this antimatter phenomenon, and consider a collection of cows. [diagram of cows](https://arbital.com/p/comment:) If a natural number is how many cows we have, then negative numbers are the presence of *anti-cows*. [For the sake of easy reading, let's colour a cow red, and an anti-cow blue: diagram of red cow = cow, blue cow = anticow](https://arbital.com/p/comment:)  For example, if you have $3$ anti-cows, you have $-3$ cows. If you have $128$ anti-cows, you have $-128$ cows, and so on.

When a cow and an anti-cow come into contact, they annihilate each other and nothing is left (except technically an enormous burst of energy that could cause a magnitude 9 earthquake, but we won't get into the nitty-gritty physics of antimatter annihilation here). [diagram of cow/anti-cow annihilation](https://arbital.com/p/comment:) Moreover, each cow will annihilate exactly one anti-cow, and vice versa.

This lets us perform subtraction by adding anti-cows instead of taking away cows. If you want to perform $6 - 4$, you imagine you have a collection of six cows, and you add four anti-cows to the mix, which annihilate four of the cows leaving you with two. This is exactly the same as if you'd taken away four cows (except that you've now released enough energy to power the entire world's energy demands for seven months). [diagram of 6 - 4](https://arbital.com/p/comment:)

This form of adding negatives is slightly more flexible than regular subtraction. In regular subtraction, you couldn't take away more cows than there already were. But when you add negatives, you can keep adding anti-cows after there are no cows left, at which point you just have more and more anti-cows, giving you a more and more negative number. So if you wanted to subtract $4 - 6$, you couldn't take away six cows from four, but you could add six anti-cows, and four of them would annihilate the four cows, leaving you with two anti-cows or a final answer of $-2$. [diagram of 4 - 6](https://arbital.com/p/comment:)

## Useful properties of negative numbers

Extending the natural numbers into negatives gives us lots of useful properties when doing arithmetic.

### Addition of negative numbers

Negative numbers add up just like positive ones. If you have $-3$ and $-7$, they add up to $-10$, just like three anti-cows and seven anti-cows would come together to make ten anti-cows. [diagram of ](https://arbital.com/p/comment:)

Knowing this, how would you calculate $(-6) + (-8) + (-12) + (-20)$?

%%hidden(Show solution):
Simply add up all the negative quantities together. $$6 + 8 + 12 + 20 = 46 \to (-6) + (-8) + (-12) + (-20) = -46$$
%%

### Subtraction as additive inversion

If we represent a natural number as a number of cows, then the same number of anti-cows is called the *additive inverse* of that number, because a number and its additive inverse add up to zero (equal numbers of cows and anti-cows will all annihilate each other to give nothing), which is the "additive [identity](https://arbital.com/p/54p)" (or "the number that changes nothing when you add it to something").

Using additive inverses allows us to express subtraction in the form of addition — for example, $5 - 2$ can be rewritten as $5 + (-2)$ (which just means that instead of taking away two cows, you're adding two anti-cows). When we do this, suddenly we can rearrange subtraction operations along with addition operations even though subtraction isn't [commutative](https://arbital.com/p/3jb).

Then, if you have a giant addition and subtraction problem you want to solve, you can add up all the numbers you want to add (into a big collection of cows), then add up all the numbers you want to subtract (into a big collection of anti-cows), and just do one subtraction (annihilating cow/anti-cow pairs) to get your answer. For example, $6 - 2 + 7 - 5$ is really just $6 + (-2) + 7 + (-5)$ which is equal to $6 + 7 + (-5) + (-2)$. Then, you add up the number of cows (13) and anti-cows (7), and annihilate them to get the final answer of $6$.

Here's another exercise for you: How would you calculate $13 + 8 - 5 + 6 + 4 - 12 - 9 + 1$?

%%hidden(Show solution):
First, rewrite each subtraction operation as addition of a negative number: $$13 + 8 + (-5) + 6 + 4 + (-12) + (-9) + 1$$

Then rearrange the equation to group all the positive and negative numbers (cows and anti-cows) together: $$13 + 8 + 6 + 4 + 1 + (-5) + (-12) + (-9)$$

Then add up all the positive and negative numbers separately: $$(13 + 8 + 6 + 4 + 1) + ((-5) + (-12) + (-9)) = 32 + (-26)$$

And finally, subtract it all at once: $$32 + (-26) = 32 - 26 = 6$$

And voilà, you have six cows.
%%

What about $8 - 6 + 4 - 13 + 7 - 5 - 9 + 12$?

%%hidden(Show solution):
Same as before, we rewrite, regroup, add up, and subtract:

$$8 + (-6) + 4 + (- 13) + 7 + (- 5) + (- 9) + 12 \\ \Downarrow$$

$$8 + 4 + 7 + 12 + (-6) + (-13) + (-5) + (-9) \\ \Downarrow$$

$$(8 + 4 + 7 + 12) + ((-6) + (-13) + (-5) + (-9)) = 31 + (-33)$$

$$31 + (-33) = 31 - 33$$

But hold on — now you have more anti-cows than cows, so you can't subtract directly! Not to worry — simply flip the subtraction problem around, and subtract the cows from the anti-cows, knowing that the final result will be negative instead.

$$31 - 33 = -(33 - 31) = -2$$
%%

## The set of integers

Back to defining the integers. The set of integers is simply the set of natural numbers and their additive inverses — i.e. the set of numbers of cows you can have if you can have anti-cows as well. This set branches out to infinity on both sides, and we usually write it as $\{ \ldots, -2, -1, 0, 1, 2, \ldots \}$.

Summary:
The integers are an extension of the [natural numbers](https://arbital.com/p/45h) into the *negatives*.

In this article we'll be exploring a novel way to think of negative numbers, using collections of cows and anti-cows. *Mooooo!*


The reals (constructed as Dedekind cuts) form a field

The real numbers, when [constructed as Dedekind cuts](https://arbital.com/p/50g) over the [rationals](https://arbital.com/p/4zq), form a [field](https://arbital.com/p/481).

We shall often write the one-sided [Dedekind cut](https://arbital.com/p/dedekind_cut) $(A, B)$ %%note:Recall: "one-sided" means that $A$ has no greatest element.%% as simply $\mathbf{A}$ (using bold face for Dedekind cuts); we can do this because if we already know $A$ then $B$ is completely determined.
This will make our notation less messy.

The field structure, together with the [total ordering](https://arbital.com/p/total_order) on it, is as follows (where we write $\mathbf{0}$ for the Dedekind cut $(\{ r \in \mathbb{Q} \mid r < 0\}, \{ r \in \mathbb{Q}  \mid r \geq 0 \})$):

- $(A, B) + (C, D) = (A+C, B+D)$
- $\mathbf{A} \leq \mathbf{C}$ if and only if everything in $A$ lies in $C$.
- Multiplication is somewhat complicated.
 - If $\mathbf{0} \leq \mathbf{A}$, then $\mathbf{A} \times \mathbf{C} = \{ a c \mid a \in A, a > 0, c \in C \}$.
 - If $\mathbf{A} < \mathbf{0}$ and $\mathbf{0} \leq \mathbf{C}$, then $\mathbf{A} \times \mathbf{C} = \{ a c \mid a \in A, c \in C, c > 0 \}$.
 - If $\mathbf{A} < \mathbf{0}$ and $\mathbf{C} < \mathbf{0}$, then $\mathbf{A} \times \mathbf{C} = \{\} $

where $(A, B)$ is a one-sided [Dedekind cut](https://arbital.com/p/dedekind_cut) (so that $A$ has no greatest element).

(Here, the "set sum" $A+C$ is defined as "everything that can be made by adding one thing from $A$ to one thing from $C$": namely, $\{ a+c \mid a \in A, c \in C \}$ in [https://arbital.com/p/-3lj](https://arbital.com/p/-3lj); and $A \times C$ is similarly $\{ a \times c \mid a \in A, c \in C \}$.)

# Proof

## Well-definedness

We need to show firstly that these operations do in fact produce [Dedekind cuts](https://arbital.com/p/dedekind_cut).

### Addition
Firstly, we need everything in $A+C$ to be less than everything in $B+D$.
This is true: if $a+c \in A+C$, and $b+d \in B+D$, then since $a < b$ and $c < d$, we have $a+c < b+d$.

Next, we need $A+C$ and $B+D$ together to contain all the rationals.
This is true:

Finally, we need $(A+C, B+D)$ to be one-sided: that is, $A+C$ needs to have no top element, or equivalently, if $a+c \in A+C$ then we can find a bigger $a' + c'$ in $A+C$.
This is also true: if $a+c$ is an element of $A+C$, then we can find an element $a'$ of $A$ which is bigger than $a$, and an element $c'$ of $C$ which is bigger than $C$ (since both $A$ and $C$ have no top elements, because the respective Dedekind cuts are one-sided); then $a' + c'$ is in $A+C$ and is bigger than $a+c$.

### Multiplication

### Ordering

## Additive [commutative](https://arbital.com/p/3jb) [group structure](https://arbital.com/p/3gd)

## [Ring structure](https://arbital.com/p/3gq)

## [Field structure](https://arbital.com/p/481)

## Ordering on the field


Equivalence relation

An **equivalence relation** is a binary [https://arbital.com/p/-3nt](https://arbital.com/p/-3nt) $\sim$ on a [https://arbital.com/p/-3jz](https://arbital.com/p/-3jz) $S$ that can be used to say whether [elements](https://arbital.com/p/element_of_a_set) of $S$ are equivalent.

An equivalence relation satisfies the following properties:

1. For any $x \in S$, $x \sim x$ (the [reflexive](https://arbital.com/p/reflexive_relation) property).
2. For any $x,y \in S$, if $x \sim y$ then $y \sim x$ (the [symmetric](https://arbital.com/p/symmetric_relation) property).
3. For any $x,y,z \in S$, if $x \sim y$ and $y \sim z$ then $x \sim z$ (the [transitive](https://arbital.com/p/573) property).

Intuitively, any element is equivalent to itself, equivalence isn't directional, and if two elements are equivalent to the same third element then they're equivalent.

## Equivalence classes

Whenever we have a set $S$ with an equivalence relation $\sim$, we can divide $S$ into *equivalence classes*, i.e. sets of mutually equivalent elements. The equivalence class of some $x \in S$ is the set of elements of $S$ equivalent to $x$, written $[https://arbital.com/p/x](https://arbital.com/p/x)=\{y \in S \mid x \sim y\}$, and we say that $x$ is a "representative" of $[https://arbital.com/p/x](https://arbital.com/p/x)$. We call the set of equivalence classes $S/\sim = \{[https://arbital.com/p/x](https://arbital.com/p/x) \mid x \in S\}$.

From the definition of an equivalence relation, it's easy to show that $x \in [https://arbital.com/p/x](https://arbital.com/p/x)$ and $[https://arbital.com/p/x](https://arbital.com/p/x)=[https://arbital.com/p/y](https://arbital.com/p/y)$ if and only if $x \sim y$.

If you have a set already [partitioned](https://arbital.com/p/set_partition) into subsets ($S$ is the [https://arbital.com/p/-disjoint_union](https://arbital.com/p/-disjoint_union) of the elements of a collection $A$), you can go the other way and define a relation with two elements related whenever they're in the same subset ($x \sim y$ when there is some $U \in A$ with $x,y \in U$). Then this is an equivalence relation, and the partition of the set is the set of equivalence classes under this relation (that is, $[https://arbital.com/p/x](https://arbital.com/p/x) \in A$ and $A=S/\sim$).

##Defining functions on equivalence classes

Suppose you have a [https://arbital.com/p/-3jy](https://arbital.com/p/-3jy) $f: S \to U$ and want to define a corresponding function $f^*: S/\sim \to U$, where $U$ can be any set. You define $f^*([https://arbital.com/p/x](https://arbital.com/p/x))$ to be $f(x)$. This could be a problem; what if $x \sim y$ but $f(x) \neq f(y)$? Then $f^*([https://arbital.com/p/x](https://arbital.com/p/x))=f^*([https://arbital.com/p/y](https://arbital.com/p/y))$ wouldn't be [well-defined](https://arbital.com/p/-well_defined). Whenever you define a function on equivalence classes in terms of representatives, you have to make sure the definition doesn't depend on which representative you happen to pick. In fact, one way you might arrive at an equivalence relation is to say that $x \sim y$ whenever $f(x)=f(y)$.

If you have a function $f: S \to S$ and want to define $f^*: S/\sim \to S/\sim$ by $f^*([https://arbital.com/p/x](https://arbital.com/p/x))=[https://arbital.com/p/f](https://arbital.com/p/f)$, you have to verify that whenever $x \sim y$, $[https://arbital.com/p/f](https://arbital.com/p/f)=[https://arbital.com/p/f](https://arbital.com/p/f)$, equivalently $f(x) \sim f(y)$.

#Examples

Consider the [integers](https://arbital.com/p/48l) with the relation $x \sim y$ if $n|x-y$, for some $n \in \mathbb N$. This is the integers [mod](https://arbital.com/p/modular_arithmetic) $n$. The [https://arbital.com/p/-addition](https://arbital.com/p/-addition) and [https://arbital.com/p/-multiplication](https://arbital.com/p/-multiplication) operations can be inherited from the integers, so it makes sense to talk about addition and multiplication mod $n$.

The [real numbers](https://arbital.com/p/4bc) can be defined as equivalence classes of [Cauchy sequences](https://arbital.com/p/50d).

[https://arbital.com/p/4f4](https://arbital.com/p/4f4) is an equivalence relation (unless the objects form a [https://arbital.com/p/-proper_class](https://arbital.com/p/-proper_class)).

Dylan Hendrickson
Eric Bruylant
Joe Zeng

Summary: An **equivalence relation** is a binary [https://arbital.com/p/-3nt](https://arbital.com/p/-3nt) that is [reflexive](https://arbital.com/p/reflexive_relation), [symmetric](https://arbital.com/p/symmetric_relation), and [transitive](https://arbital.com/p/573). You can think of it as a way to say when two elements of a [https://arbital.com/p/-3jz](https://arbital.com/p/-3jz) are "the same" or "equivalent," despite not being literally the same element. It can be used to [partition](https://arbital.com/p/set_partition) a set into equivalence classes.


Totally ordered set

A **totally ordered set** is a pair $(S, \le)$ of a set $S$ and a *total order* $\le$ on $S$, which is a [https://arbital.com/p/-binary_relation](https://arbital.com/p/-binary_relation) that satisfies the following properties:

1. For all $a, b \in S$, if $a \le b$ and $b \le a$, then $a = b$. (the [antisymmetric](https://arbital.com/p/antisymmetric_relation) property)
2. For all $a, b, c \in S$, if $a \le b$ and $b \le c$, then $a \le c$. (the [transitive](https://arbital.com/p/573) property)
3. For all $a, b \in S$, either $a \le b$ or $b \le a$, or both. (the [totality](https://arbital.com/p/total_relation) property)

A totally ordered set is a special type of [partially ordered set](https://arbital.com/p/3rb) that satisfies the total property — in general, posets only satisfy the [reflexive](https://arbital.com/p/5dy) property, which is that $a \le a$ for all $a \in S$.

## Examples of totally ordered sets

The [real numbers](https://arbital.com/p/4bc) are a totally ordered set. So are any of the subsets of the real numbers, such as the [rational numbers](https://arbital.com/p/4zq) or the [integers](https://arbital.com/p/48l).

## Examples of not totally ordered sets

The [complex numbers](https://arbital.com/p/4zw) do not have a canonical total ordering, and especially not a total ordering that preserves all the properties of the ordering of the real numbers, although one can define a total ordering on them quite easily.

Eric Rogstad
Eric Bruylant
Kevin Clancy
Dylan Hendrickson
Joe Zeng

Summary:
A totally ordered set is a pair $(S, \le)$ of a set $S$ and a *total order* $\le$ on $S$, which is a [binary relation](https://arbital.com/p/3nt) that satisfies the following properties:

1. For all $a, b \in S$, if $a \le b$ and $b \le a$, then $a = b$. (the [antisymmetric](https://arbital.com/p/antisymmetric_relation) property)
2. For all $a, b, c \in S$, if $a \le b$ and $b \le c$, then $a \le c$. (the [transitive](https://arbital.com/p/573) property)
3. For all $a, b \in S$, either $a \le b$ or $b \le a$, or both. (the [totality](https://arbital.com/p/total_relation) property)


Intro to Number Sets

There are several common [sets](https://arbital.com/p/3jz) of [numbers](https://arbital.com/p/54y) that mathematicians use in their studies. In order from simple to complex, they are:

1. The [natural numbers](https://arbital.com/p/506) $\mathbb{N}$

2. The [integers](https://arbital.com/p/53r) $\mathbb{Z}$

3. The [rational numbers](https://arbital.com/p/rational_number_math0) $\mathbb{Q}$

4. The [real numbers](https://arbital.com/p/real_number_math0) $\mathbb{R}$

5. The [complex numbers](https://arbital.com/p/complex_number_math0) $\mathbb{C}$

Each set is constructed in some way from the previous one, and this path will show you how they are constructed from the most basic numbers. You may have come across these terms in a math class that you attended, and may have had other definitions given to you. In this path, you will obtain a firm, complete understanding of these sets, how they are constructed, and what they mean in mathematics.

## Why are number sets important?

Before we go any further though, it would be nice to know the motivation behind defining the number sets first.

A [set](https://arbital.com/p/3jz) is a fancy name for a collection of objects. Some collections of objects have special properties — such as the set of all blue things, which are special in that they're all blue. In math, if a set of objects all have a certain property, we can make **inferences** about them — that is, there are certain things we can say about them that you can deduce logically. For example:

> In a [field](https://arbital.com/p/481), every nonzero number has a multiplicative inverse.

You don't need to know what a field is yet (it's a special type of set), but now you can make inferences about them without restricting yourself to a specific example when talking about them. For example, you know that if a set _is_ a field, then every number in that set that isn't zero can divide into another number in that set (by multiplying by its "multiplicative inverse") and produce yet another number in that set.

Conversely, you can also tell when a set is or isn't a field based on whether it satisfies the properties a field has. For example, since you can't divide $3$ by $2$ (because the result is $1.5$ which is not a natural number), you now know that the natural numbers are not a field.

Now let's turn to our first set: the natural numbers.


The square root of 2 is irrational

$\sqrt 2$, the unique [https://arbital.com/p/-positive](https://arbital.com/p/-positive) [https://arbital.com/p/-4bc](https://arbital.com/p/-4bc) whose square is 2, is not a [https://arbital.com/p/-4zq](https://arbital.com/p/-4zq).

#Proof

Suppose $\sqrt 2$ is rational. Then $\sqrt 2=\frac{a}{b}$ for some integers $a$ and $b$; [https://arbital.com/p/-without_loss_of_generality](https://arbital.com/p/-without_loss_of_generality) let $\frac{a}{b}$ be in [https://arbital.com/p/-lowest_terms](https://arbital.com/p/-lowest_terms), i.e. $\gcd(a,b)=1$. We have

$$\sqrt 2=\frac{a}{b}$$

From the definition of $\sqrt 2$,

$$2=\frac{a^2}{b^2}$$
$$2b^2=a^2$$

So $a^2$ is a multiple of $2$. Since $2$ is [prime](https://arbital.com/p/4mf), $a$ must be a multiple of 2; let $a=2k$. Then

$$2b^2=(2k)^2=4k^2$$
$$b^2=2k^2$$

So $b^2$ is a multiple of $2$, and so is $b$. But then $2|\gcd(a,b)$, which contradicts the assumption that $\frac{a}{b}$ is in lowest terms! So there isn't any way to express $\sqrt 2$ as a fraction in lowest terms, and thus there isn't a way to express $\sqrt 2$ as a ratio of integers at all. That is, $\sqrt 2$ is irrational.

Eric Bruylant
Nate Soares
Dylan Hendrickson


Order relation

An **order relation** (also called an **order** or **ordering**) is a [binary relation](https://arbital.com/p/3nt) $\le$ on a [set](https://arbital.com/p/3jz) $S$ that can be used to order the elements in that set.

An order relation satisfies the following properties:

1. For all $a \in S$, $a \le a$. (the [reflexive](https://arbital.com/p/reflexive_relation) property)
2. For all $a, b \in S$, if $a \le b$ and $b \le a$, then $a = b$. (the [antisymmetric](https://arbital.com/p/antisymmetric_relation) property)
3. For all $a, b, c \in S$, if $a \le b$ and $b \le c$, then $a \le c$. (the [transitive](https://arbital.com/p/transitive_relation) property)

A set that has an order relation is called a [partially ordered set](https://arbital.com/p/3rb) (or "poset"), and $\le$ is its *partial order*.

## Totality of an order

There is also a fourth property that distinguishes between two different types of orders:

4. For all $a, b \in S$, either $a \le b$ or $b \le a$ or both. (the [total](https://arbital.com/p/total_relation) property)

The total property implies the reflexive property, by setting $a = b$.

If the order relation satisfies the total property, then $S$ is called a [https://arbital.com/p/-540](https://arbital.com/p/-540), and $\le$ is its *total order*.

## Well-ordering

A fifth property that extends the idea of a "total order" is that of the [well-ordering](https://arbital.com/p/55r):

5. For every subset $X$ of $S$, $X$ has a least element: an element $x$ such that for all $y \in X$, we have $x \leq y$.

Well-orderings are very useful: they are the orderings we can perform [induction](https://arbital.com/p/mathematical_induction) over. (For more on this viewpoint, see the page on [https://arbital.com/p/structural_induction](https://arbital.com/p/structural_induction).)

# Derived relations

The order relation immediately affords several other relations.

## Reverse order

We can define a *reverse order* $\ge$ as follows: $a \ge b$ when $b \le a$.

## Strict order

From any poset $(S, \le)$, we can derive a *strict order* $<$, which disallows equality. For $a, b \in S$, $a < b$ when $a \le b$ and $a \neq b$. This strict order is still antisymmetric and transitive, but it is no longer reflexive.

We can then also define a reverse strict order $>$ as follows: $a > b$ when $b \le a$ and $a \neq b$.

## Incomparability

In a poset that is not totally ordered, there exist elements $a$ and $b$ where the order relation is undefined. If neither $a \leq b$ nor $b \leq a$ then we say that $a$ and $b$ are *incomparable*, and write $a \parallel b$.

## Cover relation

From any poset $(S, \leq)$, we can derive an underlying *cover relation* $\prec$, defined such that for $a, b \in S$, $a \prec b$ whenever the following two conditions are satisfied:

1. $a < b$.
2. For all $s \in S$, $a \leq s < b$ implies that $a = s$.

Simply put, $a \prec b$ means that $b$ is the smallest element of $S$ which is strictly greater than $a$.
$a \prec b$ is pronounced "$a$ is covered by $b$", or "$b$ covers $a$", and $b$ is said to be a *cover* of $a$.


Identity element

An identity [element](https://arbital.com/p/5xy) in a set $S$ with a [binary operation](https://arbital.com/p/-3kb) $*$ is an element $i$ that leaves any element $a \in S$ unchanged when combined with it in that operation.

Formally, we can define an element $i$ to be an identity element if the following two statements are true:

1. For all $a \in S$, $i * a = a$. If only this statement is true then $i$ is said to be a *left identity*.
2. For all $a \in S$, $a * i = a$. If only this statement is true then $i$ is said to be a *right identity*.

The existence of an identity element is a property of many algebraic structures, such as [groups](https://arbital.com/p/3gd), [rings](https://arbital.com/p/3gq), and [fields](https://arbital.com/p/481).


Proof that there are infinitely many primes

The proof that there are infinitely many [prime numbers](https://arbital.com/p/4mf) is a [https://arbital.com/p/-46z](https://arbital.com/p/-46z).

First, we note that there is indeed a prime: namely $2$.
We will also state a lemma: that every number greater than $1$ has a prime which divides it.
(This is the easier half of the [https://arbital.com/p/5rh](https://arbital.com/p/5rh), and the slightly stronger statement that "every number may be written as a product of primes" is proved there.)

Now we can proceed to the meat of the proof.
Suppose that there were finitely many prime numbers $p_1, p_2, \ldots, p_n$.
Since we know $2$ is prime, we know $2$ appears in that list.

Then consider the number $P = p_1p_2\ldots p_n + 1$ — that is, the product of all primes plus 1.
Since $2$ appeared in the list, we know $P \geq 2+1 = 3$, and in particular $P > 1$.

The number $P$ can't be divided by any of the primes in our list, because it's 1 more than a multiple of them.
But there is a prime which divides $P$, because $P>1$; we stated this as a lemma.
This is immediately a contradiction: $P$ cannot be divided by any prime, even though all integers greater than $1$ can be divided by a prime.

# Example

There is a common misconception that $p_1 p_2 \dots p_n+1$ must be prime if $p_1, \dots, p_n$ are all primes.
This isn't actually the case: if we let $p_1, \dots, p_6$ be the first six primes $2,3,5,7,11,13$, then you can check by hand that $p_1 \dots p_6 + 1 = 30031$; but $30031 = 59 \times 509$.
(These are all somewhat ad-hoc; there is no particular reason I knew that taking the first six primes would give me a composite number at the end.)
However, we *have* discovered a new prime this way (in fact, two new primes!): namely $59$ and $509$.

In general, this is a terrible way to discover new primes.
The proof tells us that there must be some new prime dividing $30031$, without telling us anything about what those primes are, or even if there is more than one of them (that is, it doesn't tell us whether $30031$ is prime or composite).
Without knowing in advance that $30031$ is equal to $59 \times 509$, it is in general very difficult to *discover* those two prime factors.
In fact, it's an open problem whether or not prime factorisation is "easy" in the specific technical sense of there being a polynomial-time algorithm to do it, though most people believe that prime factorisation is "hard" in this sense.


Order of operations

The **order of operations** is a notational convention employed in arithmetical expressions to disambiguate the order in which operations should be performed.

It is also referred to PEMDAS, BEDMAS, BODMAS, or other such acronyms depending on where you live. The acronym is always 6 letters, and refers to the following things in order:

1. [https://arbital.com/p/parentheses](https://arbital.com/p/parentheses) (or Brackets), in order of inside-most parentheses first
2. [Exponents](https://arbital.com/p/exponent) (or Orders or Indices), in order of inside-most (or rightmost) exponents first
3. [https://arbital.com/p/multiplication](https://arbital.com/p/multiplication) and [https://arbital.com/p/division](https://arbital.com/p/division), in order from left to right
4. [https://arbital.com/p/addition](https://arbital.com/p/addition) and [https://arbital.com/p/subtraction](https://arbital.com/p/subtraction), in order from left to right

## Motivation

The infix notation we use to write expressions of mathematical operators is inherently ambiguous. Only in some very special examples where the expression consists of only a single [associative](https://arbital.com/p/3h4) operation do all possible orders of evaluation evaluate to the same thing. When considering the expression $2 - 4 + 3$, do we do the $2 - 4$ first or the $4 + 3$ first? The result is either $1$ or $-5$ depending on which you choose. When considering the expression $7 + 8 \times 9 - 6$, which operation do we do first? The result could be anywhere from $31$ to $129$ depending on the order you do them in.

Therefore, to relieve mathematicians of placing brackets around every expression, there are some standard, intuitive conventions put in place.

## Example expressions

Consider the expression $3 + 7 \times 2^{(6 + 8)}$. We do parentheses first: $$3 + 7 \times 2^{14}$$ Then exponents: $$3 + 7 \times 16384$$ Then multiplication and division: $$3 + 114688$$ And finally addition and subtraction: $$114691$$

## Notable ambiguous cases

The expression $48 \div 2 (9 + 3)$ is a controversial ambiguity in the order of operations that results from an ambiguity in multiplication by juxtaposition — which is, the convention that numbers next to each other in brackets should be multiplied together. For example, $2(3+5)$ is equal to $2 \times (3 + 5)$ or $16$.

If multiplication by juxtaposition is taken as a _parenthetical_ operation due to the parentheses in the operands, then the result is 2:

$$\begin{align*}
48 \div 2 (9 + 3) &= 48 \div 2 (12) \\
&= 48 \div 24 \\
&= 2
\end{align*}$$

However, if multiplication by juxtaposition is taken as simply a regular _multiplication_ operation, the result is 288:

$$\begin{align*}
48 \div 2 (9 + 3) &= 48 \div 2 \times 12 \\
&= 24 \times 12 \\
&= 288
\end{align*}$$

The second step is different because the 48 and 2 are operated on first, as the left most division or multiplication operation in the expression.


Whole number

A **whole number** is an intuitive concept of a number that is not [fractional](https://arbital.com/p/). There are three different definitions of the whole numbers, whose usage depends heavily on the author:

1. The [natural numbers](https://arbital.com/p/45h).

2. The natural numbers and [https://arbital.com/p/-zero](https://arbital.com/p/-zero) (in definitions of the [https://arbital.com/p/-number_sets](https://arbital.com/p/-number_sets) where the natural numbers do not contain zero).

3. The [integers](https://arbital.com/p/48l).

The set of whole numbers, when it is separate from the natural numbers and the integers, is usually notated as either $\mathbb{N}^0$ or $\mathbb{W}$.

This page is a disambiguation page for three different definitions.

Summary: An intuitive concept of a number that is not fractional. Depending on the author, the set of whole numbers is defined as either the [natural numbers](https://arbital.com/p/45h), the natural numbers and [https://arbital.com/p/-zero](https://arbital.com/p/-zero), or the [integers](https://arbital.com/p/48l).


Blue oysters

You're collecting exotic oysters in Nantucket, and there are two different bays you could harvest oysters from. In both bays, 11% of the oysters contain valuable pearls and 89% are empty. In the first bay, 4% of the pearl-containing oysters are blue, and 8% of the non-pearl-containing oysters are blue. In the second bay, 13% of the pearl-containing oysters are blue, and 26% of the non-pearl-containing oysters are blue. You created a special device that helps you find blue oysters. Would you rather harvest blue oysters from the first bay or the second bay?

You're encouraged to try to solve this problem yourself, and to refrain from looking at the answer. The answer can be found in [https://arbital.com/p/1zh](https://arbital.com/p/1zh).


Example problem

Tag for pages that provide an example problem referenced by a number of other pages.

The summary of the page should contain the entire text of the problem (so that the problem can be referenced by greenlink). The body of the page should either contain the answer (e.g., hidden behind an 'Answer' button), or should contain a link to the page that contains the answer. The body of the page should not explain the solution to the problem, but may link to the page that does.


Number

A **number** is an object used to represent quantity or value.

Examples of numbers include the [natural numbers](https://arbital.com/p/45h), the [integers](https://arbital.com/p/48l), the [rational numbers](https://arbital.com/p/4zq), and the [real numbers](https://arbital.com/p/4bc).

Eric Bruylant
Dylan Hendrickson
Joe Zeng


Irrational number

An irrational number is a [https://arbital.com/p/-4bc](https://arbital.com/p/-4bc) that is not a [https://arbital.com/p/-4zq](https://arbital.com/p/-4zq). This set is generally denoted using either $\mathbb{I}$ or $\overline{\mathbb{Q}}$, the latter of which represents it as the [complement](https://arbital.com/p/set_complement) of the rationals within the reals.

In the [Cauchy sequence definition](https://arbital.com/p/50d) of real numbers, the irrational numbers are the equivalence classes of Cauchy sequences of rational numbers that do not converge in the rationals. In the [Dedekind cut definition](https://arbital.com/p/50g), the irrational numbers are the one-sided Dedekind cuts where the set $\mathbb{Q}^\ge$ does not have a least element.

## Properties of irrational numbers

Irrational numbers have decimal expansions (and indeed, representations in any base $b$) that do not repeat or terminate.

The set of irrational numbers is [uncountable](https://arbital.com/p/2w0).


Shift towards the hypothesis of least surprise

The [log-odds form of Bayes' rule](https://arbital.com/p/1zh) says that strength of belief and strength of evidence can both be measured in [bits](https://arbital.com/p/3y2). These evidence-bits can also be used to measure a quantity called "Bayesian surprise", which yields [One final, if this is the last thing in the path](https://arbital.com/p/fixme:)yet another intuition for understanding Bayes' rule.

Roughly speaking, we can measure how surprised a hypothesis $H_i$ was by the evidence $e$ by measuring how much probability it put on $e.$ If $H_i$ put 100% of its probability mass on $e$, then $e$ is completely unsurprising (to $H_i$). If $H_i$ put 0% of its probability mass on $e$, then $e$ is _as surprising as possible._ Any measure of $\mathbb P(e \mid H_i),$ the probability $H_i$ assigned to $e$, that obeys this property, is worthy of the label "surprise." Bayesian surprise is $-\!\log(\mathbb P(e \mid H_i)),$ which is a quantity that obeys these intuitive constraints and has some other interesting features.

Consider again the [https://arbital.com/p/-54v](https://arbital.com/p/-54v) problem. Consider the hypotheses $H$ and $\lnot H$, which say "the oyster will contain a pearl" and "no it won't", respectively. To keep the numbers easy, let's say we draw an oyster from a third bay, where $\frac{1}{8}$ of pearl-carrying oysters are blue and $\frac{1}{4}$ of empty oysters are blue.

Imagine what happens when the oyster is blue. $H$ predicted blueness with $\frac{1}{8}$ of its probability mass, while $\lnot H$ predicted blueness with $\frac{1}{4}$ of its probability mass. Thus, $\lnot H$ did better than $H,$ and goes up in probability. Previously, we've been combining both $\mathbb P(e \mid H)$ and $\mathbb P(e \mid \lnot H)$ into unified likelihood ratios, like $\left(\frac{1}{8} : \frac{1}{4}\right)$ $=$ $(1 : 2),$ which says that the 'blue' observation carries 1 bit of evidence $H.$ However, we can also take the logs first, and combine second.

Because $H$ assigned only an eighth of its probability mass to the 'blue' observation, and because [Bayesian update works by eliminating incorrect probability mass](https://arbital.com/p/1y6), we have to adjust our belief in $H$ by $\log_2\left(\frac{1}{8}\right) = -3$ bits away from $H.$ (Each negative bit means "throw away half of $H$'s probability mass," and we have to do that 3 times in order to remove the probability that $H$ failed to assign to $e$.)

Similarly, because $\lnot H$ assigned only a quarter of its probability mass to the 'blue' observation, we have to adjust our belief in $H$ by $\log_2\left(\frac{1}{4}\right) = -2$ bits away from $\lnot H.$

Thus, when the 'blue' observation comes in, we move our belief (measured in bits) 3 notches away from $H$ and then two notches back towards $H.$ On net, our belief shifts 1 notch away from $H$.

![hypotheses emitting surprise](https://i.imgur.com/ZXGB8x0.png)

_$H$ assigned 1/8th of its probability mass to blueness, so it emits $-\!\log_2\left(\frac{1}{8}\right)=3$ bits of surprise pushing away from $H$. $\lnot H$ assigned 1/4th of its probability mass to blueness, so it emits $-\!\log_2\left(\frac{1}{4}\right)=2$ bits of surprise pushing away from $\lnot H$ (and towards $H$). Thus, belief in $H$ moves 1 bit towards $\lnot H$, on net._

If instead $H$ predicted blue with probability 4% (penalty $\log_2(0.04) \approx -4.64$) and $\lnot H$ predicted blue with probability 8% (penalty $\log_2(0.08) \approx -3.64$), then we would have shifted a bit over 4.6 notches towards $\lnot H$ and a bit over 3.6 notches back towards $H,$ but we would have shifted the same number of notches _on net._ This is why it's only the _relative_ difference between the number of bits docked from $H$ and the number of bits docked from $\lnot H$ that matters.

In general, given an observation $e$ and a hypothesis $H,$ the number of bits we need to dock from our belief in $H$ is $\log_2(\mathbb P(e \mid H)),$ that is, the log of the probability that $H$ assigned to $e.$ This quantity is never positive, because the logarithm of $x$ for $0 \le x \le 1$ is in the range $[0](https://arbital.com/p/-\infty,)$. If we negate it, we get a non-negative quantity that relates $H$ to $e$, which is 0 when $H$ was certain that $e$ was going to happen, and which is infinite when $H$ was certain that $e$ wasn't going to happen, and which is measured in the same units as evidence and belief. Thus, this quantity is often called "surprise," and intuitively, it measures how surprised the hypothesis $H$ was by $e$ (in bits).

There is some correlation between Bayesian surprise and the times when a human would feel surprised (at seeing something that they thought was unlikely), but, of course, the human emotion is quite different. (A human can feel surprised for other reasons than "my hypotheses failed to predict the data," and humans are also great at ignoring evidence instead of feeling surprised.)

Given this definition of Bayesian surprise, we can view Bayes' rule as saying that _surprise repels belief._ When you make an observation $e,$ each hypothesis emits repulsive "surprise" signals, which shift your hypothesis. Referring again to the image above, when $H$ predicts the observation you made with $\frac{1}{8}$ of its probability mass, and $\lnot H$ predicts it with $\frac{1}{4}$ of its probability mass, we can imagine $H$ emitting a surprise signal with a strength of 3 bits away from $H$ and $\lnot H$ emitting a surprise signal with a strength of 2 bits away from $\lnot H$. Both those signals push the belief in $H$ in different directions, and it ends up 1 bit closer to $\lnot H$ (which emitted the weaker surprise signal).

In other words, whenever you find yourself feeling surprised by something you saw, think of the _least surprising explanation_ for that evidence — and then award that hypothesis a few bits of belief.

Eric Bruylant
Nate Soares
Alexei Andreev
Dony Christie


Bayes' rule: Definition

Bayes' rule is the mathematics of [probability theory](https://arbital.com/p/1rf) governing how to update your beliefs in the light of new evidence.

[https://arbital.com/p/toc:](https://arbital.com/p/toc:)

## [Notation](https://arbital.com/p/1y9)

In much of what follows, we'll use the following [notation](https://arbital.com/p/1y9):

- Let the hypotheses being considered be $H_1$ and $H_2$.
- Let the evidence observed be $e_0.$
- Let $\mathbb P(H_i)$ denote the [prior probability](https://arbital.com/p/1rm) of $H_i$ before observing the evidence.
- Let the [conditional probability](https://arbital.com/p/1rj) $\mathbb P(e_0\mid H_i)$ denote the [likelihood](https://arbital.com/p/1rq) of observing evidence $e_0$ assuming $H_i$ to be true.
- Let the [conditional probability](https://arbital.com/p/1rj) $\mathbb P(H_i\mid e_0)$ denote the [posterior probability](https://arbital.com/p/1rp) of $H_i$ after observing $e_0.$

## [Odds](https://arbital.com/p/1x5)/[proportional](https://arbital.com/p/1zm) form

Bayes' rule in the [odds form](https://arbital.com/p/1x5) or [proportional form](https://arbital.com/p/1zm) states:

$$\dfrac{\mathbb P(H_1)}{\mathbb P(H_2)} \times \dfrac{\mathbb P(e_0\mid H_1)}{\mathbb P(e_0\mid H_2)} = \dfrac{\mathbb P(H_1\mid e_0)}{\mathbb P(H_2\mid e_0)}$$

In other words, the [prior](https://arbital.com/p/1rm) [odds](https://arbital.com/p/1rb) times the [likelihood ratio](https://arbital.com/p/1rq) yield the [posterior](https://arbital.com/p/1rp) odds.  [Normalizing](https://arbital.com/p/1rk) these odds will then yield the posterior probabilities.

In [other other words](https://arbital.com/p/1zm):  If you initially think $h_i$ is $\alpha$ times as probable as $h_k$, and then see evidence that you're $\beta$ times as likely to see if $h_i$ is true as if $h_k$ is true, you should update to thinking that $h_i$ is $\alpha \cdot \beta$ times as probable as $h_k.$

Suppose that Professor Plum and Miss Scarlet are two suspects in a murder, and that we start out thinking that Professor Plum is twice as likely to have committed the murder as Miss Scarlet ([prior](https://arbital.com/p/1rm) [odds](https://arbital.com/p/1rb) of 2 : 1).  We then discover that the victim was poisoned.  We think that Professor Plum is around one-fourth as likely to use poison as Miss Scarlet ([likelihood ratio](https://arbital.com/p/1rq) of 1 : 4).  Then after observing the victim was poisoned, we should think Plum is around half as likely to have committed the murder as Scarlet: $2 \times \dfrac{1}{4} = \dfrac{1}{2}.$  This reflects [posterior](https://arbital.com/p/1rp) odds of 1 : 2, or a posterior probability of 1/3, that Professor Plum did the deed.

## [Proof](https://arbital.com/p/1xr)

The [proof of Bayes' rule](https://arbital.com/p/1xr) is by the definition of [conditional probability](https://arbital.com/p/1rj) $\mathbb P(X\wedge Y) = \mathbb P(X\mid Y) \cdot \mathbb P(Y):$

$$
\dfrac{\mathbb P(H_i)}{\mathbb P(H_j)} \times  \dfrac{\mathbb P(e\mid H_i)}{\mathbb P(e\mid H_j)}
= \dfrac{\mathbb P(e \wedge H_i)}{\mathbb P(e \wedge H_j)}
= \dfrac{\mathbb P(e \wedge H_i) / \mathbb P(e)}{\mathbb P(e \wedge H_j) / \mathbb P(e)}
= \dfrac{\mathbb P(H_i\mid e)}{\mathbb P(H_j\mid e)}
$$

## [Log odds form](https://arbital.com/p/1zh)

The [log odds form of Bayes' rule](https://arbital.com/p/1zh) states:

$$\log \left ( \dfrac
   {\mathbb P(H_i)}
   {\mathbb P(H_j)}
\right )
+
\log \left ( \dfrac
   {\mathbb P(e\mid H_i)}
   {\mathbb P(e\mid H_j)}
\right )
 =
\log \left ( \dfrac
   {\mathbb P(H_i\mid e)}
   {\mathbb P(H_j\mid e)}
\right )
$$

E.g.:  "A study of Chinese blood donors found that roughly 1 in 100,000 of them had HIV (as determined by a very reliable gold-standard test). The non-gold-standard test used for initial screening had a sensitivity of 99.7% and a specificity of 99.8%, meaning that it was 500 times as likely to return positive for infected as non-infected patients."  Then our prior belief is -5 orders of magnitude against HIV, and if we then observe a positive test result, this is evidence of strength +2.7 orders of magnitude for HIV.  Our posterior belief is -2.3 orders of magnitude, or odds of less than 1 to a 100, against HIV.

In log odds form, the same [strength of evidence](https://arbital.com/p/22x) (log [likelihood ratio](https://arbital.com/p/1rq)) always [moves us the same additive distance](https://arbital.com/p/1zh) along a line representing strength of belief (also in log odds).  If we measured distance in probabilities, then the same 2 : 1 likelihood ratio might move us a different distance along the probability line depending on whether we started with prior 10% probability or 50% probability.

## Visualizations

Graphical of visualizing Bayes' rule include [frequency diagrams, the waterfall visualization](https://arbital.com/p/1wy), the [spotlight visualization](https://arbital.com/p/1zm), the [magnet visualization](https://arbital.com/p/1zh), and the [Venn diagram for the proof](https://arbital.com/p/1xr).

## Examples

Examples of Bayes' rule may be found [here](https://arbital.com/p/1wt).

## [Multiple hypotheses and updates](https://arbital.com/p/1zg)

The [odds form of Bayes' rule](https://arbital.com/p/1x5) works for odds ratios between more than two hypotheses, and applying multiple pieces of evidence.  Suppose there's a bathtub full of coins.  1/2 of the coins are "fair" and have a 50% probability of producing heads on each coinflip; 1/3 of the coins produce 25% heads; and 1/6 produce 75% heads.  You pull out a coin at random, flip it 3 times, and get the result HTH.  You may legitimately calculate:

$$\begin{array}{rll}
(1/2 : 1/3 : 1/6) \cong & (3 : 2 : 1) & \\
\times & (2 : 1 : 3) & \\
\times & (2 : 3 : 1) & \\
\times & (2 : 1 : 3) & \\
= & (24 : 6 : 9) & \cong (8 : 2 : 3)
\end{array}$$

Since multiple pieces of evidence may not be [conditionally independent](https://arbital.com/p/conditional_independence) from one another, it is important to be aware of the [Naive Bayes assumption](https://arbital.com/p/naive_bayes_assumption) and whether you are making it.

## [Probability form](https://arbital.com/p/554)

As a formula for a single probability $\mathbb P(H_i\mid e),$ Bayes' rule states:

$$\mathbb P(H_i\mid e) = \dfrac{\mathbb P(e\mid H_i) \cdot \mathbb P(H_i)}{\sum_k \mathbb P(e\mid H_k) \cdot \mathbb P(H_k)}$$

## [Functional form](https://arbital.com/p/1zj)

In [functional form](https://arbital.com/p/1zj), Bayes' rule states:

$$\mathbb P(\mathbf{H}\mid e) \propto \mathbb P(e\mid \mathbf{H}) \cdot \mathbb P(\mathbf{H}).$$

The posterior probability function over hypotheses given the evidence, is *proportional* to the likelihood function from the evidence to those hypotheses, times the prior probability function over those hypotheses.

Since posterior probabilities over [mutually exclusive and exhaustive](https://arbital.com/p/1rd) possibilities must sum to $1,$ [normalizing](https://arbital.com/p/1rk) the product of the likelihood function and prior probability function will yield the exact posterior probability function.

Eric Bruylant
Eliezer Yudkowsky
Nate Soares
Alexei Andreev


Bayes' rule: Probability form

The formulation of [https://arbital.com/p/1lz](https://arbital.com/p/1lz) you are most likely to see in textbooks runs as follows:

$$\mathbb P(H_i\mid e) = \dfrac{\mathbb P(e\mid H_i) \cdot \mathbb P(H_i)}{\sum_k \mathbb P(e\mid H_k) \cdot \mathbb P(H_k)}$$

Where:

- $H_i$ is the hypothesis we're interested in.
- $e$ is the piece of evidence we observed.
- $\sum_k (\text {expression containing } k)$ [means](https://arbital.com/p/summation_notation) "Add up, for every $k$, the sum of all the (expressions containing $k$)."
- $\mathbf H$ is a set of [mutually exclusive and exhaustive](https://arbital.com/p/1rd) hypotheses that include $H_i$ as one of the possibilities, and the expression $H_k$ inside the sum ranges over all the possible hypotheses in $\mathbf H$.

As a quick example, let's say there's a bathtub full of potentially biased coins.

- Coin type 1 is fair, 50% heads / 50% tails.  40% of the coins in the bathtub are type 1.
- Coin type 2 produces 70% heads.  35% of the coins are type 2.
- Coin type 3 produces 20% heads.  25% of the coins are type 3.

We want to know the [posterior](https://arbital.com/p/1rp) probability that a randomly drawn coin is of type 2, after flipping the coin once and seeing it produce heads once.

Let $H_1, H_2, H_3$ stand for the hypotheses that the coin is of types 1, 2, and 3 respectively.  Then using [conditional probability notation](https://arbital.com/p/1rj), we want to know the probability $\mathbb P(H_2 \mid heads).$

The probability form of Bayes' theorem says:

$$\mathbb P(H_2 \mid heads) = \frac{\mathbb P(heads \mid H_2) \cdot \mathbb P(H_2)}{\sum_k \mathbb P(heads \mid H_k) \cdot \mathbb P(H_k)}$$

Expanding the sum:

$$\mathbb P(H_2 \mid heads) = \frac{\mathbb P(heads \mid H_2) \cdot \mathbb P(H_2)}{[P](https://arbital.com/p/\mathbb) + [P](https://arbital.com/p/\mathbb) + [P](https://arbital.com/p/\mathbb)}$$

Computing the actual quantities:

$$\mathbb P(H_2 \mid heads) = \frac{0.70 \cdot 0.35 }{[\cdot 0.40](https://arbital.com/p/0.50) + [\cdot 0.35](https://arbital.com/p/0.70) + [\cdot 0.25](https://arbital.com/p/0.20)} = \frac{0.245}{0.20 + 0.245 + 0.05} = 0.\overline{49}$$

This calculation was big and messy.  Which is fine, because the probability form of Bayes' theorem is okay for directly grinding through the numbers, but not so good for doing things in your head.

# Meaning

We can think of the advice of Bayes' theorem as saying:

"Think of how much each hypothesis in $H$ contributed to our expectation of seeing the evidence $e$, including both the [likelihood](https://arbital.com/p/56v) of seeing $e$ if $H_k$ is true, and the [prior](https://arbital.com/p/1rm) probability of $H_k$.  The [posterior](https://arbital.com/p/1rp) of $H_i$ after seeing $e,$ is the amount $H_i$ contributed to our expectation of seeing $e,$ within the total expectation of seeing $e$ contributed by every hypothesis in $H.$"

Or to say it at somewhat greater length:

Imagine each hypothesis $H_1,H_2,H_3\ldots$ as an expert who has to distribute the probability of their predictions among all possible pieces of evidence.  We can imagine this more concretely by visualizing "probability" as a lump of clay.

The total amount of clay is one kilogram (probability $1$).  Each expert $H_k$ has been allocated a fraction $\mathbb P(H_k)$ of that kilogram.  For example, if $\mathbb P(H_4)=\frac{1}{5}$ then expert 4 has been allocated 200 grams of clay.

We're playing a game with the experts to determine which one is the best predictor.

Each time we're about to make an observation $E,$ each expert has to divide up all their clay among the possible outcomes $e_1, e_2, \ldots.$

After we observe that $E = e_j,$ we take away all the clay that wasn't put onto $e_j.$  And then our new belief in all the experts is the relative amount of clay that each expert has left.

So to know how much we now believe in expert $H_4$ after observing $e_3,$ say, we need to know two things:  First, the amount of clay that $H_4$ put onto $e_3,$ and second, the total amount of clay that all experts (including $H_4$) put onto $e_3.$

In turn, to know *that,* we need to know how much clay $H_4$ started with, and what fraction of its clay $H_4$ put onto $e_3.$  And similarly, to compute the total clay on $e_3,$ we need to know how much clay each expert $H_k$ started with, and what fraction of their clay $H_k$ put onto $e_3.$

So Bayes' theorem here would say:

$$\mathbb P(H_4 \mid e_3) = \frac{\mathbb P(e_3 \mid H_4) \cdot \mathbb P(H_4)}{\sum_k \mathbb P(e_3 \mid H_k) \cdot \mathbb P(H_k)}$$

What are the incentives of this game of clay?

On each round, the experts who gain the most are the experts who put the most clay on the observed $e_j,$ so if you know for certain that $e_3$ is about to be observed, your incentive is to put all your clay on $e_3.$

But putting *literally all* your clay on $e_3$ is risky; if $e_5$ is observed instead, you lose all your clay and are out of the game. Once an expert's amount of clay goes all the way to zero, there's no way for them to recover over any number of future rounds. That hypothesis is done, dead, and removed from the game.  ("Falsification," some people call that.)  If you're not certain that $e_5$ is literally impossible, you'd be wiser to put at least a *little* clay on $e_5$ instead.  That is to say: if your mind puts some probability on $e_5,$ you'd better put some clay there too!

([As it happens](https://arbital.com/p/bayes_score), if at the end of the game we score each expert by the logarithm of the amount of clay they have left, then each expert is incentivized to place clay exactly proportionally to their honest probability on each successive round.)

It's an important part of the game that we make the experts put down their clay in advance.  If we let the experts put down their clay afterwards, they might be tempted to cheat by putting down all their clay on whichever $e_j$ had actually been observed.  But since we make the experts put down their clay in advance, they have to *divide up* their clay among the possible outcomes: to give more clay to $e_3,$ that clay has to be taken away from some other outcome, like $e_5.$  To put a very high probability on $e_3$ and gain a lot of relative credibility if $e_3$ is observed, an expert has to stick their neck out and risk losing a lot of credibility if some other outcome like $e_5$ happens instead.  *If* we force the experts to make advance predictions, that is!

We can also derive from this game that the question "does evidence $e_3$ support hypothesis $H_4$?" depends on how well $H_4$ predicted $e_3$ _compared to the competition._ It's not enough for $H_4$ to predict $e_3$ well if every other hypothesis also predicted $e_3$ well--your amazing new theory of physics gets no points for predicting that the sky is blue.  $H_k$ only goes up in probability when it predicts $e_j$ better than the alternatives.  And that means we have to ask what the alternative hypotheses predicted, even if we think those hypotheses are false.

If you get in a car accident, and don't want to relinquish the hypothesis that you're a great driver, then you can find all sorts of reasons ("the road was slippery! my car freaked out!") why $\mathbb P(e \mid GoodDriver)$ is not too low. But $\mathbb P(e \mid BadDriver)$ is also part of the update equation, and the "bad driver" hypothesis *better* predicts the evidence. Thus, your first impulse, when deciding how to update your beliefs in the face of a car accident, should not be "But my preferred hypothesis allows for this evidence!" It should instead be "Points to the 'bad driver' hypothesis for predicting this evidence better than the alternatives!"  (And remember, you're allowed to [increase $\mathbb P](https://arbital.com/p/update_beliefs_incrementally), while still thinking that it's less than 50% probable.)

# Proof

The proof of Bayes' theorem follows from the definition of [https://arbital.com/p/-1rj](https://arbital.com/p/-1rj):

$$\mathbb P(X \mid Y) = \frac{\mathbb P(X \wedge Y)}{\mathbb P (Y)}$$

And from the [law of marginal probability](https://arbital.com/p/law_marginal_probability):

$$\mathbb P(Y) = \sum_k \mathbb P(Y \wedge X_k)$$

Therefore:

$$
\mathbb P(H_i \mid e) = \frac{\mathbb P(H_i \wedge e)}{\mathbb P (e)}  \tag{defn. conditional prob.}
$$

$$
\mathbb P(H_i \mid e) = \frac{\mathbb P(e \wedge H_i)}{\sum_k \mathbb P (e \wedge H_k)} \tag {law of marginal prob.}
$$

$$
\mathbb P(H_i \mid e) = \frac{\mathbb P(e \mid H_i) \cdot \mathbb P(H_i)}{\sum_k \mathbb P (e \mid H_k) \cdot \mathbb P(H_k)} \tag {defn. conditional prob.}
$$

QED.

Eliezer Yudkowsky
Nadeem Mohsin
Alexei Andreev
Eric Rogstad
Eric Bruylant
Nate Soares
Adom Hartell

Summary:
The formulation of [https://arbital.com/p/1lz](https://arbital.com/p/1lz) you are most likely to see in textbooks says:

$$\mathbb P(H_i\mid e) = \dfrac{\mathbb P(e\mid H_i) \cdot \mathbb P(H_i)}{\sum_k \mathbb P(e\mid H_k) \cdot \mathbb P(H_k)}$$

This follows from the definition of [https://arbital.com/p/-1rj](https://arbital.com/p/-1rj) which states that $\mathbb P(X \mid Y) = \frac{\mathbb P(X \wedge Y)}{\mathbb P (Y)}$, and the [law of marginal probability](https://arbital.com/p/law_marginal_probability) which says that $\mathbb P(Y) = \sum_k \mathbb P(Y \wedge X_k)$.

We can think of the corresponding advice as saying, "Think of how much each hypothesis in $H$ contributed to our expectation of seeing the evidence $e$, including both the [likelihood](https://arbital.com/p/56v) of seeing $e$ if $H_k$ is true, and the [prior](https://arbital.com/p/1rm) probability of $H_k$.  The [posterior](https://arbital.com/p/1rp) of $H_i$ after seeing $e,$ is the amount $H_i$ contributed to our expectation of seeing $e,$ within the total expectation of seeing $e$ contributed by every hypothesis in $H.$