---
title: The real numbers and completeness
heading: The property that makes limits exist
eyebrow: A14 · Lesson 1 · The real numbers and completeness
xp: 40
---

::: hook
Every algorithm in A13 that closes in on an answer, bisection, Newton's method, relaxation, assumed there was an answer to close in on. On the rational numbers there might not be: bisection for $x^2 = 2$ produces rational brackets that shrink forever around a gap where $\sqrt2$ should be. The real numbers are the rationals with every such gap filled, and the precise statement of "no gaps" is the **completeness axiom**: every set that's bounded above has a least upper bound. Almost every theorem in analysis, from the intermediate value theorem to the existence of solutions of differential equations, rests on it.
:::

::: play
- Bisection for $x^2 = 2$ starting from [1, 2]. After k halvings the bracket is $[\ell_k, \ell_k + 2^{-k}]$, where $\ell_k$ is the largest multiple of $2^{-k}$ whose square is below 2.
- Every bracket end is a rational number, and the brackets shrink toward one point. That point, the least upper bound of $\{x : x^2 < 2\}$, isn't rational.
- Completeness is exactly the guarantee that the point exists in $\mathbb R$.
:::
:::

```sim plot
view: graph
x: x = 1.3..1.55
y: y = -0.4..0.4
slider: k = 1..40 step 1 = 5
plot: x^2 - 2 | label: x² − 2
marker: x = floor(sqrt(2)*2^k)/2^k | label: lower end
marker: x = floor(sqrt(2)*2^k)/2^k + 2^(-k) | label: upper end
readout: lower end = floor(sqrt(2)*2^k)/2^k
readout: width of the bracket = 2^(-k)
```

::: predict
## Let $S = \{1 - \frac1n : n = 1, 2, 3, \ldots\}$. Which statement is true?

- [ ] S has a largest element
- [x] $\sup S = 1$, and 1 isn't in S
- [ ] $\sup S = \frac12$
- [ ] S has no upper bound

::: reveal
$\sup S = 1$. Every element is below 1, so 1 is an upper bound; and no smaller number is, because for any $1 - \varepsilon$ there's an n with $1 - \frac1n > 1 - \varepsilon$ (take $n > 1/\varepsilon$). The supremum is the least upper bound, and it needn't belong to the set.
:::
:::

::: nameit
## Bounds

For a set $S \subseteq \mathbb R$:

- M is an **upper bound** if $x \le M$ for every $x \in S$.
- s is the **supremum**, $\sup S$, if it's an upper bound and no smaller number is: for every $\varepsilon > 0$ some $x \in S$ has $x > s - \varepsilon$.
- The **infimum**, $\inf S$, is the greatest lower bound, defined the same way from below.
- If the supremum belongs to S, it's the **maximum**.

## The completeness axiom

Every nonempty subset of $\mathbb R$ that's bounded above has a supremum in $\mathbb R$.

The rationals fail it: $\{x \in \mathbb Q : x^2 < 2\}$ is bounded above but has no least rational upper bound.

## Consequences

- **The Archimedean property:** for any $a > 0$ and any b, some whole number n has $na > b$. (If not, $\{na\}$ would be bounded above, and its supremum s would make $s - a$ an upper bound too, a contradiction.)
- **Density:** between any two real numbers there's a rational number, and an irrational one.
- **Nested intervals:** a sequence of closed intervals, each inside the last, with widths shrinking to 0, contains exactly one point in common. That's why bisection converges.

## Why √2 is irrational

If $\sqrt2 = p/q$ in lowest terms, then $p^2 = 2q^2$, so $p^2$ is even, so p is even, say $p = 2r$. Then $4r^2 = 2q^2$, so $q^2 = 2r^2$ is even, so q is even. Both even contradicts lowest terms.
:::

::: example
## Find sup and inf of $S = \left\{\frac{n}{n + 1} : n \ge 1\right\}$.

::: solution
1. **Rewrite the terms.**
   $$\frac{n}{n + 1} = 1 - \frac{1}{n + 1}$$
   which increases with n.
2. **The infimum.** The smallest term is the first, so $\inf S = \frac12$, attained at n = 1 (so it's the minimum).
3. **An upper bound.** Every term is below 1, so 1 is an upper bound, and no term reaches it.
4. **1 is the least upper bound.** Given ε > 0, choose $n > \frac1\varepsilon$; then
   $$\frac{n}{n + 1} > 1 - \varepsilon$$
   so $\sup S = 1$ (not attained).

**Answer:** $\inf S = \frac12$, attained at n = 1, and $\sup S = 1$, not attained.
:::
:::

::: example
## A floating-point version of bisection stops shrinking. Why doesn't that contradict completeness?

::: solution
1. **What completeness covers.** Completeness is a property of $\mathbb R$, and doubles are a finite set.
2. **Why the floating-point version stalls.** After about 52 halvings of [1, 2] the two ends are neighboring doubles, and the midpoint rounds to one of them.
3. **The real bisection keeps going.** The real midpoints keep going, and their limit, $\sqrt2$, exists in $\mathbb R$; it just isn't a double.

**Answer:** there's no contradiction. The stall comes from the finite set of doubles, while completeness is about $\mathbb R$, where the midpoints converge to $\sqrt2$.
:::
:::

::: example
## Find the supremum and infimum of $S = \left\{(-1)^n\left(1 - \frac1n\right) : n \ge 1\right\}$. Are they attained?

::: solution
1. **List the terms.** They are 0, ½, −⅔, ¾, −⅘, …: even terms climb toward 1 and odd terms fall toward −1.
2. **1 is an upper bound.** Every term lies strictly between −1 and 1.
3. **No smaller number bounds S.** For any $\varepsilon > 0$, an even n with $\frac1n < \varepsilon$ gives a term above $1 - \varepsilon$. Hence
   $$\sup S = 1$$
4. **The infimum.** The same argument on the odd terms gives
   $$\inf S = -1$$
5. **Neither is attained.** No term equals ±1.
6. **Why that's typical.** Sup and inf always exist for bounded sets of reals, but they need not belong to the set, which is why the definition is "least upper bound" and not "largest element".

**Answer:** $\sup S = 1$ and $\inf S = -1$, and neither is attained.
:::
:::

::: check
given: a = 1 | 3 | 10; b = 1 | 2 | 5
answer: a - b
tolerance: 0

## What's $\inf\left\{\given{a} - \frac{\given{b}}{n} : n = 1, 2, 3, \ldots\right\}$?

::: right
Right. The set increases with n, so the infimum is the first element, $a - b$ = {answer}.
:::

::: misses
- [a] That's the supremum.
- [any] Not yet. The elements increase toward a, starting at n = 1.
:::
:::

::: check
given: e = 0.03 | 0.003 | 0.0007
answer: floor(1/e) + 1
tolerance: 0

## For $S = \{1 - \frac1n\}$, what's the smallest n with $1 - \frac1n > 1 - \given{e}$?

::: right
Right. Need $\frac1n < \varepsilon$: n = {answer}.
:::

::: misses
- [floor(1/e)] That n gives $\frac1n \ge \varepsilon$.
- [any] Not yet. Solve $\frac1n < \varepsilon$ for the smallest whole n.
:::
:::

::: check
given: k = 10 | 20 | 30
answer: 2^(-k)
tolerance: 0.5%

## Bisection for $\sqrt2$ starts with [1, 2]. How wide is the bracket after {k} halvings?

::: right
Right. $2^{-k}$ = {answer}.
:::

::: misses
- [2^(-k - 1)] That's how far the midpoint can be from the root, half the width.
- [any] Not yet. Each halving halves the width, starting from 1.
:::
:::

::: check
given: c = 3 | 5 | 10
answer: sqrt(c)
tolerance: 0.01%

## What's $\sup\{x \in \mathbb R : x^2 < \given{c}\}$?

::: right
Right. $\sqrt{c}$ = {answer}, not in the set and not rational.
:::

::: misses
- [c] The condition is on $x^2$.
- [any] Not yet. The set is the open interval $(-\sqrt c, \sqrt c)$.
:::
:::

::: check
given: a = 0.3 | 0.07 | 0.0023; b = 5 | 13
answer: floor(b/a) + 1
tolerance: 0

## By the Archimedean property some whole n has $n \cdot \given{a} > \given{b}$. What's the smallest?

::: right
Right. n = {answer}.
:::

::: misses
- [any] Not yet. The smallest n with $n > b/a$.
:::
:::

::: check
kind: order

## Put the steps of the proof that $\sqrt2$ is irrational in order.

1. Suppose $\sqrt2 = p/q$ with p and q whole numbers and no common factor.
2. Squaring, $p^2 = 2q^2$, so $p^2$ is even.
3. An odd number's square is odd, so p is even: $p = 2r$.
4. Then $4r^2 = 2q^2$, so $q^2 = 2r^2$ is even, and q is even.
5. p and q are both even, contradicting that they have no common factor.

::: right
Right. A proof by contradiction: assume the opposite, follow it, and reach something impossible.
:::
:::

::: check
kind: parts
given: a = 1 | 3; b = 2 | 4

## $S = \left\{\given{a} + (-1)^n\frac{\given{b}}{n} : n \ge 1\right\}$.

::: part
answer: a + b/2
tolerance: 0.5%

### What is sup S?

::: misses
- [a + b] The positive terms come from even n, the largest at n = 2.
- [a] The terms with even n exceed a, and the largest is attained.
- [any] Check n = 2: $a + \frac b2$.
:::
:::

::: part
answer: a - b
tolerance: 0.5%

### What is inf S?

::: misses
- [a] n = 1 gives $a - b$, below every other term.
- [any] Check n = 1.
:::
:::
:::

::: check
kind: derivation
vars: e = 0.001..0.3

## The Archimedean property, made quantitative.

::: step
answer: floor(1/e) + 1

### What is the smallest whole n with $\frac1n < \varepsilon$? (Write ε as e.)
:::

::: step
answer: floor(1/sqrt(e)) + 1

### And the smallest n with $\frac{1}{n^2} < \varepsilon$?
:::

::: right
Right. Both exist for every ε > 0, which is what "$\frac1n \to 0$" rests on.
:::
:::

::: explain
## Why does bisection on $\mathbb R$ always converge, when the same procedure on $\mathbb Q$ might not?

::: model
Bisection keeps a bracket with a sign change and halves it, so the brackets are nested closed intervals whose widths shrink to zero. The set of their left ends is bounded above by any right end, so by the completeness axiom it has a supremum, and that number lies in every bracket: it's the limit both ends converge to, and continuity makes it a root. On the rationals there's no such guarantee, because the left ends can close in on a gap like $\sqrt2$, where no rational number sits. Completeness is precisely the promise that every such shrinking process has something to shrink onto.
:::
:::

::: practice

::: check
given: a = 2 | 7; b = 3 | 4
answer: a - b
tolerance: 0

## $\inf\{\given{a} - \given{b}/n : n \ge 1\}$?

::: misses
- [any] The value at n = 1.
:::
:::

::: check
given: e = 0.045 | 0.03 | 0.017 | 0.007 | 0.0013 | 0.00023
answer: floor(1/e) + 1
tolerance: 0

## Smallest n with $1/n < \given{e}$?

::: misses
- [any] $\lfloor 1/\varepsilon\rfloor + 1$.
:::
:::

::: check
given: a = 0.7 | 0.013; b = 9 | 40
answer: floor(b/a) + 1
tolerance: 0

## Smallest n with $n\cdot\given{a} > \given{b}$?

::: misses
- [any] $\lfloor b/a\rfloor + 1$.
:::
:::
:::
