18. Adv: the real numbers — completeness and the least upper bound
Every theorem quietly leaned on throughout this course — the Extreme Value Theorem (§1.8), the Intermediate Value Theorem (§1.8), the Monotone Convergence Theorem (§7.1) — ultimately rests on a single fact about the real numbers that was never stated outright: the reals have no gaps. This closing module steps back from fifteen modules of computation to examine that fact directly, and the tools built to prove it rigorously. This opening lesson names the property itself: completeness.
Upper bounds and the supremum
A set S\subseteq\mathbb R is bounded above if some number M satisfies x\le M for every x\in S — M is an upper bound. A set can have many upper bounds (if M works, so does M+1); the supremum (or least upper bound), written \sup S, is the smallest one:
L=\sup S\iff\begin{cases}x\le L\text{ for every }x\in S&\text{($L$ is an upper bound)}\\\text{for every }\varepsilon>0,\text{ some }x\in S\text{ has }x>L-\varepsilon&\text{(no smaller upper bound works)}\end{cases}
The second condition is the substantive one — it rules out any upper bound smaller than L, by demanding that S always has elements arbitrarily close to L from below. This mirrors the \varepsilon-based "arbitrarily close" language from §1.9's limit definition precisely, because it's built from the same idea: a threshold that can be approached but never beaten.
The infimum, \inf S, is defined symmetrically as the greatest lower bound.
Crucially, \sup S need not belong to S itself. For S=\{1-\frac1n:n=1,2,3,\ldots\}=\{0,\frac12,\frac23,\frac34,\ldots\}, every element is strictly less than 1, yet \sup S=1 — no element of S equals 1, but elements get arbitrarily close to it, which is all the definition requires.
The completeness axiom
Every nonempty set of real numbers that is bounded above has a supremum in \mathbb R.
This sounds almost too obvious to need stating — until it's checked against the rational numbers instead. Let S=\{x\in\mathbb Q:x^2<2\} — a perfectly good, nonempty, bounded-above (by, say, 2) set of rational numbers. Its supremum, \sqrt2, is not rational (a fact provable by contradiction: if \sqrt2=\frac pq in lowest terms, then p^2=2q^2 forces p even, then q even too, contradicting "lowest terms"). So within \mathbb Q alone, S is bounded above but has no supremum — there's a genuine "gap" at \sqrt2 that no rational number fills.
This is exactly what "completeness" means, and exactly what distinguishes \mathbb R from \mathbb Q: the real numbers were constructed (via Dedekind cuts or Cauchy sequences, §15.1's subject) specifically to fill in every such gap, guaranteeing every bounded-above set has a genuine real supremum. Every theorem in this course that concludes "a certain number exists" — the Extreme Value Theorem's maximum, the Intermediate Value Theorem's root, the Monotone Convergence Theorem's limit — is, underneath, an application of this single axiom.
Doing it in Python
Confirming \sup\{1-\frac1n\}=1 numerically: no term ever reaches 1, but terms get arbitrarily close, and for any \varepsilon a term eventually exceeds 1-\varepsilon:
def term(n):
return 1 - 1/n
for n in (1, 2, 5, 10, 100, 1000):
print(f"n={n:>5}: term = {term(n)}")
epsilon = 0.01
n = 1
while term(n) <= 1 - epsilon:
n += 1
print(f"\nsmallest n with term > 1-{epsilon}: n={n}, term={term(n)}")
print("no term ever equals or exceeds 1 -- but this shows 1 is the LEAST upper bound")
Demonstrating \mathbb Q's incompleteness directly: rational approximations to \sqrt2 get arbitrarily close, with no rational number ever being the exact supremum:
from fractions import Fraction
approximations = [Fraction(14, 10), Fraction(141, 100), Fraction(1414, 1000),
Fraction(14142, 10000), Fraction(141421, 100000)]
for a in approximations:
print(f"{a} : {float(a)}, squared = {float(a*a):.8f}")
print(f"\ntrue value: sqrt(2) = {2**0.5:.8f}")
print("every rational approximation has a square either < 2 or > 2 -- never exactly 2")
Confirming \sqrt2 is irrational via the classical proof by contradiction, checked computationally for small denominators (a sanity check, not a full proof):
from fractions import Fraction
# search small p/q for any exact match to sqrt(2)
found_exact_match = False
for q in range(1, 1000):
p = round(q * 2**0.5)
if Fraction(p, q)**2 == 2:
found_exact_match = True
print(f"found an exact rational square root of 2 among small fractions: {found_exact_match}")
print("(the classical proof shows this fails for EVERY p/q, not just small ones)")
Worked example
Find \sup S and \inf S for S=\left\{1-\dfrac1n:n=1,2,3,\ldots\right\}, and determine whether each is attained by an element of S.
Infimum: the smallest element occurs at n=1: 1-\frac11=0. Since 1-\frac1n is increasing in n (larger n subtracts a smaller fraction), every other term is \ge0.
\boxed{\inf S=0,\text{ attained at }n=1}
Supremum: as n\to\infty, 1-\frac1n\to1 (§7.0's limit), and every term satisfies 1-\frac1n<1 strictly. Check the two defining conditions: 1 is an upper bound (every term is below it), and for any \varepsilon>0, choosing n>\frac1\varepsilon gives 1-\frac1n>1-\varepsilon — so no smaller number can be an upper bound.
\boxed{\sup S=1,\text{ not attained by any element of }S}
Sanity check. This example demonstrates both possible behaviors at once: the infimum genuinely belongs to the set (a minimum), while the supremum is only ever approached (no maximum exists). This is precisely the subtlety the Extreme Value Theorem (§1.8) has to work around — it only guarantees a max/min for continuous functions on closed, bounded intervals, and S here corresponds to values of f(n)=1-\frac1n sampled only at integers, not a continuous interval, which is exactly why it's allowed to have a supremum with no maximum. ✓
Your turn
1. Find \sup S and \inf S for S=\left\{\dfrac1n:n=1,2,3,\ldots\right\}, and state whether each is attained.
2. Find \sup S for S=\{x\in\mathbb R:x^2<9\}.
3. True or false: every nonempty set of rational numbers that is bounded above has a supremum within the rational numbers.
Solutions
1. The largest term is at n=1: \frac11=1 — attained, so \sup S=1 is a genuine maximum. As n\to\infty, \frac1n\to0, and every term is strictly positive, so \inf S=0 but it is not attained (no n makes \frac1n exactly 0).
\boxed{\sup S=1\text{ (attained)},\qquad\inf S=0\text{ (not attained)}}
— the mirror image of the worked example, with the roles of max and min swapped.
2. x^2<9\iff-3<x<3, so S=(-3,3).
\boxed{\sup S=3}
(not attained — every x\in S satisfies x<3 strictly, but values arbitrarily close to 3, like 2.9999, belong to S.)
3. False. This is exactly the concept section's central counterexample: S=\{x\in\mathbb Q:x^2<2\} is a nonempty, bounded-above set of rational numbers, yet no rational number is its supremum — the true supremum, \sqrt2, is irrational. The completeness axiom holds for \mathbb R specifically; \mathbb Q fails it, which is precisely why real analysis is built on \mathbb R and not \mathbb Q.
Check yourself in code
For S=\left\{1-\dfrac1n:n=1,\ldots,1000\right\}, find the smallest n for which the term exceeds 1-0.01.
Print exactly this:
n=101, term=0.9900990099009901
def term(n):
return 1 - 1/n
epsilon = 0.01
n = 1
while term(n) <= 1 - epsilon:
n += 1
print(f"n={n}, term=...")
def term(n):
return 1 - 1/n
epsilon = 0.01
n = 1
while term(n) <= 1 - epsilon:
n += 1
print(f"n={n}, term={term(n)}")
The completeness axiom — every nonempty, bounded-above set of real numbers has a real supremum — is the single structural fact that distinguishes \mathbb R from \mathbb Q, demonstrated concretely by \{x\in\mathbb Q:x^2<2\} having no rational supremum at all, only the irrational \sqrt2. A supremum need not belong to its set (an approached-but-never-attained maximum), and this single axiom is the quiet foundation underneath every existence theorem this course has used since Module 1.
Next: sequences that "ought to" converge without yet knowing what they converge to — the Cauchy criterion, and the Bolzano-Weierstrass theorem that makes it work.