Real Analysis · ch.1 · the real line
📈 Chapter 1 · Building the number line

What makes a number line complete?

The real line has no pinholes — the rationals do. This chapter is about the one promise ℝ keeps that ℚ can't: no matter how you close in on a spot, there's always a number sitting exactly there.

Real analysis is the rulebook underneath calculus — it's where limits, derivatives, and integrals stop being hand-wavy and become airtight. And nearly all of it rests on a single structural fact about the number line: it is complete. No gaps, no missing points, nowhere for a limit to fall through.

You already have a working number line in your head — and if you've ever used a Double, you also have one that's secretly full of holes. This chapter pins down the difference. Two things to hold onto:

  • The rationals — every fraction p/q. Dense, tidy, and riddled with pinholes.
  • The reals — ℚ with every hole filled in. The idealization that makes analysis work.

The whole plot is one promise: any set of reals that's hemmed in from above has a tightest ceiling that's actually a real number. That promise is completeness, and ℚ can't make it. Let's earn every word of that.

1The rationals have holes

Start with a number you can point at but never write as a fraction: √2, the length of a unit square's diagonal. Walk toward it with fractions and you get achingly close —

1,  1.4,  1.41,  1.414,  1.4142,  1.41421,  …  → √2

Every term in that list is a rational (a terminating decimal is just a fraction). The sequence is climbing steadily toward a target — but the target itself is not in the list's world. There is no fraction whose square is exactly 2. So on the rational number line, the spot marked √2 is a pinhole: the sequence marches right up to it and finds nothing there.

That's the defect. ℚ looks continuous — between any two fractions sits another — yet it's shot through with these invisible punctures, one at every irrational. The reals are what you get when you plug every last one.

💡
Why √2 isn't a fraction: suppose √2 = p/q in lowest terms. Then p² = 2q², so p is even, say p = 2k. Then 4k² = 2q², so q is even too — but then p/q wasn't in lowest terms. Contradiction. No such fraction exists.

2Least upper bound — the tightest ceiling

Before we can say what "no holes" means precisely, we need one idea: the tightest ceiling a set can't poke through.

Take a set of numbers. An upper bound is any value that sits at or above every element — a ceiling the set never rises past. Most sets have loads of them: if 10 is a ceiling, so is 11, and 100. The interesting one is the lowest ceiling — the least upper bound, written sup S (its "supremum"). It's the ceiling you can't lower even a hair without the set punching through it.

Here's the subtle part, and the whole reason sup matters: the tightest ceiling need not belong to the set. Drag the marker below across the number line. The dots are the set {1 − 1/n} = 0, ½, ⅔, ¾, ⅘, … — creeping toward 1 but never reaching it. Find the lowest spot that's still a ceiling.

Interactive · drag the ceiling Slide the marker · find the lowest valid ceiling
drag me →
candidate ceiling 0.60 not a ceiling

The lowest ceiling is exactly 1 — even though 1 is never one of the dots. That's sup{1 − 1/n} = 1. Lower your marker to 0.99 and some dot pokes above it; raise it to 1 and nothing does, but you can't go any lower. A set can approach its supremum forever without ever containing it.

3The completeness axiom

Now the payoff. The reals are defined by one promise:

Every non-empty set of reals that is bounded above
has a least upper bound — and that sup is itself a real number.

That last clause is the entire game. It's not that a tightest ceiling exists in the abstract — it's that the ceiling is guaranteed to be a genuine point on the line, ready to be a limit, a boundary, a value.

And here's why ℚ is not complete: take S = {x ∈ ℚ : x² < 2}. It's non-empty (1 is in it) and bounded above (2 is a ceiling). Its least upper bound wants to be √2 — but √2 isn't rational, so inside ℚ this set has no sup at all. Every rational ceiling can be nudged lower and still be a ceiling; there's no tightest one. ℚ makes the promise and breaks it. ℝ is precisely the number system where it always holds.

📜
A 19th-century repair job. For two centuries calculus worked without anyone defining what a real number was. The completeness axiom — and the constructions that justify it — came from Dedekind, Cauchy, and Weierstrass in the 1800s, retrofitting rigor under a machine that had been running on intuition since Newton.

4Dedekind cuts — building a real from scratch

Fine — but if √2 isn't a fraction, what is it? Dedekind's answer is disarmingly simple: a real number is a place you can cut the rational line.

Slide a knife down onto ℚ. It splits every rational into two heaps: a left piece (everything below the cut) and a right piece (everything above). That split — the pair of heaps — is the number. If the knife comes down on a rational, fine, you've just re-labelled a number ℚ already had. But if it comes down in a gap — a spot like √2 where no rational lives — the split still cleanly divides ℚ, and that split defines a brand-new real number. No mysticism, no limits: the cut itself is the object.

Drag the knife below. Land it on a rational dot, or drop it into the √2 gap and watch a new real get born.

Interactive · slice the rational line Drag the knife · rational dot vs. √2 gap
cut at 0.70
Drag the knife onto a dot (a rational) or into the √2 gap.
📜
Dedekind, 1872. In Stetigkeit und irrationale Zahlen ("Continuity and Irrational Numbers"), Richard Dedekind defined every real number as exactly this: a cut partitioning ℚ into a lower and upper class. Completeness becomes a theorem — every cut names a real — rather than a wish.

5Cauchy sequences — the other route in

There's a second way to build the reals, and it's the one a programmer feels in their bones: the terms eventually huddle together.

Look again at 1, 1.4, 1.41, 1.414, …. Past some point, every pair of terms is closer than any tolerance you name — squeeze to within 0.001, they're all within 0.001 of each other; squeeze to 0.000001, same story. A sequence that huddles like that is called Cauchy. It's clearly trying to converge.

In ℚ, a Cauchy sequence can huddle around a spot that isn't there (our √2 sequence does exactly that — it converges to a hole). Completeness says: in ℝ, every Cauchy sequence actually lands on a real number. Same completeness, dressed as "no sequence huddles around a missing point." A real number, in this telling, just is what a huddling sequence of rationals is aiming at. We'll make "huddle" precise — the ε and N of it — in Chapter 2.

6Why engineers care

This isn't purely a philosopher's worry. A Double is a rational — a fraction with a fixed-size denominator — so floating point is ℚ, holes and all. It literally cannot represent √2; it stores a nearby fraction and moves on. The reals are the clean idealization that makes limits, derivatives, and integrals well-defined in the first place, so the numerical approximation has something exact to approximate.

Root-finding lives right here. Bisection constructs √2 the Cauchy way: keep an interval you know brackets the answer, halve it, keep the half that still brackets. The endpoints are rationals huddling toward a real — a Cauchy sequence you can run. Flip between the two languages; the shape of the argument is identical.

⚠️
The tell: the loop never reaches √2 — it reaches within eps of it. That's not a bug, it's the whole point. √2 is the limit the rational endpoints huddle toward; the reals are what guarantee that limit is a real thing to reach.

7The Archimedean property & density

Two loose ends about how ℝ and ℚ actually sit together.

No infinite numbers are hiding. The Archimedean property says: for any real, however huge, some plain whole number n is bigger; and for any positive real, however tiny, some 1/n is smaller. There's no "infinitely large" real lurking past all the integers, and no "infinitely small" one wedged just above zero. You can always step past anything with ordinary counting.

ℚ is dense in ℝ. Even though ℚ has holes, the fractions are sprinkled everywhere: between any two reals — no matter how close — sits a rational. That's exactly why bisection works, and why a Double can get arbitrarily close to any real it can't hit exactly. The rationals miss the irrationals but crowd right up against every one of them.

Put it together: ℝ is ℚ with the pinholes filled (completeness), stretching no further than counting reaches (Archimedean), with ℚ packed densely through it. That's the real line — and it's the ground every later chapter stands on.