Skip to content
The Lumenary
Grades 9–12Ages 14–18 75 min

Real numbers and irrationality

Fractions crowd every stretch of the number line, yet they miss the diagonal of a unit square — a 2,500-year-old proof that 2\sqrt 2 is not a fraction, and the property of R\R that fills every gap.

Formally verified · 15 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review

Your guides: Chloe, Margaret, Gideon

MotivationH

A diagonal that is not a fraction

Draw a square whose sides are 1 unit long. By the Pythagorean theorem its diagonal dd satisfies d2=12+12=2d^2 = 1^2 + 1^2 = 2, so d=2d = \sqrt 2. How long is that, exactly?

People have asked this for a very long time. A clay tablet from Old Babylonian Mesopotamia (about 1800–1600 BCE, now in the Yale collection as YBC 7289) shows a square with its diagonals and the number 1;24,51,101;24,51,10 in base sixty — that is, 1+2460+51602+10603≈1.414212961 + \tfrac{24}{60} + \tfrac{51}{60^2} + \tfrac{10}{60^3} \approx 1.41421296, correct to about six decimal places. The Indian Śulba-sūtras, manuals for building fire altars, give 1+13+13⋅4−13⋅4⋅34=577408≈1.41421571 + \tfrac13 + \tfrac{1}{3 \cdot 4} - \tfrac{1}{3 \cdot 4 \cdot 34} = \tfrac{577}{408} \approx 1.4142157.

These are superb approximations. But is there a fraction that is exactly 2\sqrt 2? In this lesson we prove that there is not — and then ask what kind of number 2\sqrt 2 must be, if not a fraction.

012√2√2
A unit square standing on the number line. Swinging its diagonal down with a compass marks a point at distance $\sqrt 2$ from 0, between 1 and 2. That point is on the line — but, as we will prove, it is not at any fraction.
IntuitionH

Crowded, and still full of holes

The fractions (rational numbers) are packed tightly on the number line. Between any two of them, a<ba < b, lies their average a+b2\tfrac{a + b}{2}; between aa and that average lies another; and so on forever. There is no "next" fraction after 11, and every tiny interval, however short, contains infinitely many fractions. You met this density in Rational numbers.

So it is natural to guess that the fractions cover the whole line. They do not. The point at distance 2\sqrt 2 from 00 is surrounded by fractions — 75\tfrac75, 1712\tfrac{17}{12}, 4129\tfrac{41}{29}, 577408\tfrac{577}{408}, each closer than the last — but none of them lands on it. The fractions are like an infinitely fine sieve: dense, yet full of holes.

The real numbers R\R are what we get when we fill in all the holes. Every point of the line is a real number; the rational ones are special, and the others are called irrational.

DefinitionsH

Definitions

Informally, a real number is a point on the number line, or equivalently an infinite decimal such as 3.14159…3.14159\ldots or −0.5000…-0.5000\ldots. (A rigorous construction of R\R from Q\Q is the subject of Constructing ℤ, ℚ and ℝ; here we use the real numbers and their arithmetic and order as familiar, plus one extra property, completeness, stated below.)

Definition— rational and irrational numbers

A real number xx is rational if x=pqx = \tfrac{p}{q} for some integers p,qp, q with q≠0q \ne 0. The set of rational numbers is Q\Q. A real number that is not rational is irrational.

Definition— absolute value and distance

The absolute value of a real number xx is

∣x∣={xif x≥0,−xif x<0.|x| = \begin{cases} x & \text{if } x \ge 0, \\ -x & \text{if } x < 0. \end{cases}

It is the distance from xx to 00, and ∣x−y∣|x - y| is the distance between xx and yy. Always ∣x∣≥0|x| \ge 0, ∣−x∣=∣x∣|-x| = |x|, ∣xy∣=∣x∣ ∣y∣|xy| = |x|\,|y| and −∣x∣≤x≤∣x∣-|x| \le x \le |x|.

Definition— intervals

For real numbers a<ba < b:

NotationMeaningEndpoints included?
(a,b)(a, b)all xx with a<x<ba < x < bneither (open interval)
[a,b][a, b]all xx with a≤x≤ba \le x \le bboth (closed interval)
[a,b)[a, b)all xx with a≤x<ba \le x < bonly aa
(a,∞)(a, \infty)all xx with x>ax > a— (∞\infty is not a number)

An inequality about distance is a statement about an interval: ∣x−c∣<r|x - c| < r means c−r<x<c+rc - r < x < c + r, i.e. x∈(c−r,c+r)x \in (c - r, c + r).

Definition— upper bound and least upper bound

Let SS be a set of real numbers. A number bb is an upper bound of SS if s≤bs \le b for every s∈Ss \in S; then SS is bounded above. A least upper bound (or supremum, sup⁡S\sup S) is an upper bound bb such that no smaller number is an upper bound: if c<bc < b, some element of SS is bigger than cc.

The supremum need not belong to the set: sup⁡ [0,1)=1\sup\,[0, 1) = 1, although 1∉[0,1)1 \notin [0, 1). A set has at most one least upper bound (if bb and b′b' were both least, then b≤b′b \le b' and b′≤bb' \le b).

Theorem— completeness of ℝ (informal statement)

Every non-empty set of real numbers that is bounded above has a least upper bound in R\R.

In this lesson completeness is taken as a basic property of R\R — the property that says "there are no holes". (It can be proved, once R\R has been built from Q\Q, for example by Dedekind cuts or Cauchy sequences; Lean's library does exactly that.) The rational numbers satisfy all the usual rules of arithmetic and order, but not completeness — we will prove this below.

Worked examplesH

Worked examples

Example— Decimals and ordering

To compare two decimals, compare digit by digit from the left: 0.3289…<0.330.3289\ldots < 0.33, and 2=1.41421…<1.4143\sqrt 2 = 1.41421\ldots < 1.4143. One subtlety: some numbers have two decimal expansions. 0.4999…0.4999\ldots and 0.5000…0.5000\ldots are the same real number, just as 0.999…=10.999\ldots = 1; this happens exactly for decimals that end in an infinite string of 99s. (Why 0.999…=10.999\ldots = 1 is proved in Sequences and series: a decimal means a sum of an infinite series.)

Example— A repeating decimal is a fraction

Let x=0.272727…x = 0.272727\ldots. Then 100x=27.272727…100x = 27.272727\ldots, and subtracting,

99x=27,x=2799=311.99x = 27, \qquad x = \frac{27}{99} = \frac{3}{11}.

The same trick (multiply by 10k10^k, where kk is the length of the repeating block, and subtract) turns every eventually repeating decimal into a fraction. Conversely, long division of pp by qq can only produce the remainders 0,1,…,q−10, 1, \dots, q - 1; as soon as a remainder recurs, the digits repeat. So a decimal is rational exactly when it terminates or eventually repeats, and the repeating block of pq\tfrac{p}{q} has at most q−1q - 1 digits. For instance 17=0.142857‾\tfrac17 = 0.\overline{142857} uses all 66 possible non-zero remainders.

Example— Absolute value inequalities

∣x−3∣≤2|x - 3| \le 2 means "the distance from xx to 33 is at most 22", i.e. 1≤x≤51 \le x \le 5, the interval [1,5][1, 5]. And ∣2x+1∣>5|2x + 1| > 5 means 2x+1>52x + 1 > 5 or 2x+1<−52x + 1 < -5, so x>2x > 2 or x<−3x < -3: the union (−∞,−3)∪(2,∞)(-\infty, -3) \cup (2, \infty).

Example— Suprema, attained and not

  • S={1−1n:n=1,2,3,… }={0,12,23,34,… }S = \{1 - \tfrac1n : n = 1, 2, 3, \dots\} = \{0, \tfrac12, \tfrac23, \tfrac34, \dots\}. Every element is less than 11, so 11 is an upper bound. If c<1c < 1, choose nn with 1n<1−c\tfrac1n < 1 - c; then 1−1n>c1 - \tfrac1n > c, so cc is not an upper bound. Hence sup⁡S=1\sup S = 1, and 1∉S1 \notin S.
  • T=[0,1]T = [0, 1] has sup⁡T=1∈T\sup T = 1 \in T: here the supremum is the maximum.
  • N={0,1,2,… }\N = \{0, 1, 2, \dots\} is not bounded above, so it has no supremum in R\R at all. Completeness only promises suprema for sets that are bounded above.

Example— Rational or irrational?

  • 49=7\sqrt{49} = 7 and 94=32\sqrt{\tfrac{9}{4}} = \tfrac32 are rational.
  • 2\sqrt 2, 3\sqrt 3, 12=23\sqrt{12} = 2\sqrt 3 are irrational (proved below).
  • 3+23 + \sqrt 2 is irrational: a rational plus an irrational is irrational.
  • 2⋅8=16=4\sqrt 2 \cdot \sqrt 8 = \sqrt{16} = 4 is rational, although both factors are irrational.
  • π\pi is irrational (Lambert, 1761) — so 227=3.142857…\tfrac{22}{7} = 3.142857\ldots and 3.143.14 are approximations, not values.
ProofH

Proofs

We start with a fact about parity.

Theorem— Lemma 1 (squares and parity)

For an integer pp: if p2p^2 is even, then pp is even.

Proof

We prove the contrapositive: if pp is odd, then p2p^2 is odd. Write p=2k+1p = 2k + 1. Then p2=4k2+4k+1=2(2k2+2k)+1p^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1, which is odd.

∎

Theorem— Theorem 1 (√2 is irrational)

There are no natural numbers p,qp, q with q≠0q \ne 0 and p2=2q2p^2 = 2q^2. Consequently 2\sqrt 2 is irrational.

Proof

Suppose, for a contradiction, that there were such pairs. By the well-ordering principle, choose one, (p,q)(p, q), in which q≥1q \ge 1 is as small as possible.

Since p2=2q2p^2 = 2q^2 is even, pp is even by Lemma 1; write p=2kp = 2k. Then 4k2=2q24k^2 = 2q^2, so q2=2k2q^2 = 2k^2. Thus (q,k)(q, k) is another solution of the same equation. Moreover k≥1k \ge 1 (otherwise q2=0q^2 = 0), and k<qk < q, because k2<2k2=q2k^2 < 2k^2 = q^2. So (q,k)(q, k) is a solution with a smaller second number than qq — contradicting the choice of (p,q)(p, q). Hence no solution exists.

Finally, if 2=ab\sqrt 2 = \tfrac{a}{b} with integers a,ba, b, b≠0b \ne 0, then a2=2b2a^2 = 2b^2, and (∣a∣,∣b∣)(|a|, |b|) would be a solution in natural numbers with ∣b∣≠0|b| \ne 0. So 2\sqrt 2 is not rational.

∎

This is an argument by infinite descent: any solution would produce a smaller one, and the natural numbers cannot go down forever. (The version you may have seen — "write 2=pq\sqrt 2 = \tfrac pq in lowest terms; then both pp and qq are even, a contradiction" — is the same argument: "lowest terms" is where the well-ordering hides.)

What about other square roots? The same descent works for every non-square, with a neat trick that needs no factorisation into primes.

Theorem— Theorem 2 (√n for non-squares)

Let nn be a positive integer that is not a perfect square. Then n\sqrt n is irrational.

Proof

Since nn is not a square, there is an integer mm with m<n<m+1m < \sqrt n < m + 1 (take mm the largest integer with m2<nm^2 < n). Suppose n=pq\sqrt n = \tfrac pq with p,qp, q positive integers, and choose such a representation with qq as small as possible. Put

q′=p−mq,p′=nq−mp.q' = p - mq, \qquad p' = nq - mp.

These are integers. Since p=qnp = q\sqrt n, we have q′=q(n−m)q' = q(\sqrt n - m), and 0<n−m<10 < \sqrt n - m < 1 gives 0<q′<q0 < q' < q. And

p′q′=nq−mpp−mq=qn (n−m)q(n−m)=n,\frac{p'}{q'} = \frac{nq - mp}{p - mq} = \frac{q\sqrt n\,(\sqrt n - m)}{q(\sqrt n - m)} = \sqrt n,

using nq=n⋅n q=n pn q = \sqrt n \cdot \sqrt n \, q = \sqrt n \, p and mp=mqnmp = m q \sqrt n. Since p′=q′n>0p' = q'\sqrt n > 0, this writes n\sqrt n as a fraction of positive integers with the smaller denominator q′<qq' < q — a contradiction.

∎

Where does the proof use that nn is not a square? In the strict inequalities m<n<m+1m < \sqrt n < m + 1, which give 0<q′<q0 < q' < q. If n=k2n = k^2 is a square, then n=k\sqrt n = k is a whole number, no integer mm satisfies them, and indeed n=k1\sqrt n = \tfrac k1 already has the smallest possible denominator.

Theorem— Theorem 3 (rational + irrational)

If qq is rational and xx is irrational, then q+xq + x is irrational.

Proof

Suppose q+x=rq + x = r were rational. Then x=r−qx = r - q is a difference of two rationals, which is rational. That contradicts the irrationality of xx.

∎

No such rule holds for two irrationals: 2+(−2)=0\sqrt 2 + (-\sqrt 2) = 0 and 2⋅2=2\sqrt 2 \cdot \sqrt 2 = 2 are rational. (Sometimes the answer is irrational, e.g. 2+3\sqrt 2 + \sqrt 3 — try squaring it — but it has to be checked case by case.)

Theorem— Theorem 4 (triangle inequality)

For all real numbers x,yx, y:   ∣x+y∣≤∣x∣+∣y∣\;|x + y| \le |x| + |y|.

Proof

From −∣x∣≤x≤∣x∣-|x| \le x \le |x| and −∣y∣≤y≤∣y∣-|y| \le y \le |y|, adding gives

−(∣x∣+∣y∣)≤x+y≤∣x∣+∣y∣.-\big(|x| + |y|\big) \le x + y \le |x| + |y|.

A number tt with −c≤t≤c-c \le t \le c satisfies ∣t∣≤c|t| \le c (whichever of tt and −t-t is ∣t∣|t|, it is at most cc). With t=x+yt = x + y and c=∣x∣+∣y∣c = |x| + |y| this is the claim.

∎

In terms of distance, the inequality reads ∣a−c∣≤∣a−b∣+∣b−c∣|a - c| \le |a - b| + |b - c| (put x=a−bx = a - b, y=b−cy = b - c): going from aa to cc via bb is never shorter than going directly. That is where the name comes from.

Now the question Chloe asked. Let

S={q∈Q:q2<2}.S = \{q \in \Q : q^2 < 2\}.

SS is non-empty (0∈S0 \in S) and bounded above by 22 (if q>2q > 2 then q2>4q^2 > 4). The heart of the matter is one clever fraction.

Theorem— Lemma 2 (pushing towards √2)

For a rational p>0p > 0 put p′=2p+2p+2p' = \dfrac{2p + 2}{p + 2}. Then

p′−p=2−p2p+2andp′2−2=2(p2−2)(p+2)2.p' - p = \frac{2 - p^2}{p + 2} \qquad\text{and}\qquad p'^2 - 2 = \frac{2(p^2 - 2)}{(p + 2)^2}.

So if p2<2p^2 < 2, then p′>pp' > p and still p′2<2p'^2 < 2; if p2>2p^2 > 2, then p′<pp' < p and still p′2>2p'^2 > 2.

Proof

Both identities are algebra: p′−p=2p+2−p2−2pp+2=2−p2p+2p' - p = \tfrac{2p + 2 - p^2 - 2p}{p + 2} = \tfrac{2 - p^2}{p + 2}, and

p′2−2=(2p+2)2−2(p+2)2(p+2)2=4p2+8p+4−2p2−8p−8(p+2)2=2p2−4(p+2)2.p'^2 - 2 = \frac{(2p + 2)^2 - 2(p + 2)^2}{(p + 2)^2} = \frac{4p^2 + 8p + 4 - 2p^2 - 8p - 8}{(p + 2)^2} = \frac{2p^2 - 4}{(p + 2)^2}.

Since p+2>0p + 2 > 0, the signs of p′−pp' - p and p′2−2p'^2 - 2 are those of 2−p22 - p^2 and p2−2p^2 - 2.

∎

Theorem— Theorem 5 (ℚ is not complete)

The set S={q∈Q:q2<2}S = \{q \in \Q : q^2 < 2\} has no least upper bound in Q\Q.

Proof

Suppose b∈Qb \in \Q were a least upper bound of SS. Since 1∈S1 \in S, b≥1>0b \ge 1 > 0. By Theorem 1, b2≠2b^2 \ne 2. Let b′=2b+2b+2b' = \tfrac{2b + 2}{b + 2}, a rational number.

  • If b2<2b^2 < 2: by Lemma 2, b′>bb' > b and b′2<2b'^2 < 2, so b′∈Sb' \in S is bigger than the upper bound bb. Impossible.
  • If b2>2b^2 > 2: by Lemma 2, b′<bb' < b and b′2>2b'^2 > 2. Then b′b' is an upper bound of SS: if some s∈Ss \in S had s>b′s > b', then (as b′>0b' > 0) s2>b′2>2s^2 > b'^2 > 2, contradicting s2<2s^2 < 2. So b′b' is an upper bound smaller than the least upper bound bb. Impossible.

Both cases fail, so no rational least upper bound exists.

∎

In R\R, by completeness, SS does have a least upper bound ss, and s2=2s^2 = 2: the argument of Theorem 5 still rules out s2>2s^2 > 2, and it rules out s2<2s^2 < 2 once we add that between ss and s′=2s+2s+2s' = \tfrac{2s + 2}{s + 2} there is a rational number, which would then lie in SS above ss. This is how completeness creates 2\sqrt 2: the hole in Q\Q is filled by a real number. Lean confirms below that the supremum is exactly 2\sqrt 2.

Formal mathematicsF

The proofs, checked by Lean

The Lean module for this lesson uses Mathlib, Lean's library of mathematics. In Mathlib, Irrational x is defined to mean "xx is not in the image of the map Q→R\Q \to \R", and √2 is Real.sqrt 2.

First the descent of Theorem 1, as a strong induction on qq, and the deduction that 2\sqrt 2 is irrational. The second proof writes a rational number rr as r.num / r.den (Mathlib keeps rationals in lowest terms with a positive denominator) and passes to absolute values:

no_nat_sq_eq_two_mul_sqLean 4Proved here from basic factsFormally verified
/-- **Infinite descent.** If `p² = 2q²` for natural numbers `p, q`, then `q = 0`.
Proof by strong induction on `q`: `p²` is even, so `p = 2k`; then `4k² = 2q²`, i.e.
`q² = 2k²`, a *new* solution `(q, k)` with `k < q` (if `q > 0`). The induction hypothesis
gives `k = 0`, so `q² = 0` and `q = 0` after all. -/
theorem no_nat_sq_eq_two_mul_sq : ∀ q p : ℕ, p ^ 2 = 2 * q ^ 2 → q = 0 := by
  intro q
  induction q using Nat.strong_induction_on with
  | _ q ih =>
    intro p h
    -- `p²` is even, hence `p` is even: `p = k + k`.
    have hp : Even p := (Nat.even_pow.mp (h ▸ even_two_mul (q ^ 2))).1
    obtain ⟨k, rfl⟩ := hp
    -- Dividing by 2: `q² = 2k²`.
    have h2 : q ^ 2 = 2 * k ^ 2 := by nlinarith
    by_contra hq
    -- The new solution is smaller: `k < q`, because `k² < 2k² = q²`.
    have hk : k < q := by
      have hq0 : 0 < q := Nat.pos_of_ne_zero hq
      have hk0 : 0 < k := by
        rcases Nat.eq_zero_or_pos k with h0 | h0
        · subst h0; simp at h2; omega
        · exact h0
      have : k ^ 2 < q ^ 2 := by nlinarith
      exact lt_of_pow_lt_pow_left₀ 2 (Nat.zero_le q) this
    have hk0 : k = 0 := ih k hk q h2
    subst hk0
    simp at h2
    exact hq h2
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
sqrt_two_irrationalLean 4Proved here from basic factsFormally verified
/-- **√2 is irrational**, proved from `no_nat_sq_eq_two_mul_sq`.
Suppose `√2 = r` with `r` rational, and write `r = a/b` in lowest terms (`a = r.num`,
`b = r.den > 0`). Squaring, `a² = 2b²`; taking absolute values gives a solution in natural
numbers with `b ≠ 0`, which infinite descent forbids. -/
theorem sqrt_two_irrational : Irrational (√2) := by
  rintro ⟨r, hr⟩
  -- `r² = 2` in `ℚ`.
  have hr2 : r ^ 2 = 2 := by
    have : ((r ^ 2 : ℚ) : ℝ) = 2 := by
      push_cast
      rw [hr]
      exact Real.sq_sqrt (by norm_num)
    exact_mod_cast this
  -- `a² = 2 b²` in `ℤ`, where `r = a / b`.
  have hint : r.num ^ 2 = 2 * (r.den : ℤ) ^ 2 := by
    have h := Rat.mul_den_eq_num r
    have : ((r.num : ℚ)) ^ 2 = 2 * ((r.den : ℚ)) ^ 2 := by
      rw [← h, mul_pow, hr2]
    exact_mod_cast this
  -- Pass to natural numbers with absolute values.
  have hnat : r.num.natAbs ^ 2 = 2 * r.den ^ 2 := by
    have := congrArg Int.natAbs hint
    simpa [Int.natAbs_pow, Int.natAbs_mul] using this
  exact r.den_nz (no_nat_sq_eq_two_mul_sq r.den r.num.natAbs hnat)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor

Mathlib already knows this theorem, and the general criterion of Theorem 2 (stated there with Mathlib's IsSquare). We apply them here rather than re-prove them, and use the criterion for 3\sqrt 3:

sqrt_two_irrational_libraryLean 4Applies a library theoremFormally verified
/-- The same theorem from Mathlib: `irrational_sqrt_two`. (Mathlib's proof goes through the
general criterion `irrational_sqrt_natCast_iff` below.) -/
theorem sqrt_two_irrational_library : Irrational (√2) := irrational_sqrt_two
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
sqrt_irrational_iff_not_squareLean 4Applies a library theoremFormally verified
/-- **√n for every non-square n.** For a natural number `n`, `√n` is irrational if and only if
`n` is not a perfect square. This applies Mathlib's `irrational_sqrt_natCast_iff`. -/
theorem sqrt_irrational_iff_not_square (n : ℕ) : Irrational (√(n : ℝ)) ↔ ¬ IsSquare n :=
  irrational_sqrt_natCast_iff
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
sqrt_three_irrationalLean 4Applies a library theoremFormally verified
/-- An instance of the criterion: `√3` is irrational, since `3` is not a perfect square
(if `3 = r · r` then `r ≤ 2`, and checking `r = 0, 1, 2` finds no square root). -/
theorem sqrt_three_irrational : Irrational (√(3 : ℝ)) := by
  have h : ¬ IsSquare 3 := by
    rintro ⟨r, hr⟩
    have : r ≤ 2 := by nlinarith
    interval_cases r <;> omega
  exact_mod_cast (sqrt_irrational_iff_not_square 3).mpr h
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor

Theorem 3, the example 2⋅2=2\sqrt 2 \cdot \sqrt 2 = 2, and the triangle inequality (by hand, and from the library, where it holds in any ordered abelian group with a lattice structure):

rat_add_irrationalLean 4Proved here from basic factsFormally verified
/-- **Rational + irrational = irrational.** If `q + x` were a rational number `r`, then
`x = r - q` would be rational too. (Mathlib: `Irrational.ratCast_add`.) -/
theorem rat_add_irrational (q : ℚ) {x : ℝ} (hx : Irrational x) : Irrational (q + x) := by
  rintro ⟨r, hr⟩
  apply hx
  refine ⟨r - q, ?_⟩
  push_cast
  rw [hr]
  ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
irrational_mul_irrational_can_be_rationalLean 4Proved here from basic factsFormally verified
/-- **Irrational × irrational can be rational:** `√2` is irrational, yet `√2 · √2 = 2`. -/
theorem irrational_mul_irrational_can_be_rational :
    ∃ x y : ℝ, Irrational x ∧ Irrational y ∧ ¬ Irrational (x * y) := by
  refine ⟨√2, √2, sqrt_two_irrational, sqrt_two_irrational, ?_⟩
  rw [Real.mul_self_sqrt (by norm_num : (0 : ℝ) ≤ 2)]
  intro h
  exact h ⟨2, by norm_num⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
triangle_inequalityLean 4Proved here from basic factsFormally verified
/-- **Triangle inequality** `|x + y| ≤ |x| + |y|`. Since `-|x| ≤ x ≤ |x|` and
`-|y| ≤ y ≤ |y|`, adding gives `-(|x| + |y|) ≤ x + y ≤ |x| + |y|`, which says exactly that
`|x + y| ≤ |x| + |y|`. (Mathlib: `abs_add_le`.) -/
theorem triangle_inequality (x y : ℝ) : |x + y| ≤ |x| + |y| := by
  have hx1 := neg_abs_le x
  have hx2 := le_abs_self x
  have hy1 := neg_abs_le y
  have hy2 := le_abs_self y
  rw [abs_le]
  constructor <;> linarith
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
triangle_inequality_libraryLean 4Applies a library theoremFormally verified
/-- The triangle inequality from Mathlib, `abs_add_le`, which holds in every lattice-ordered
additive commutative group, not only in `ℝ`. -/
theorem triangle_inequality_library (x y : ℝ) : |x + y| ≤ |x| + |y| := abs_add_le x y
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor

Completeness of R\R and the density of Q\Q in R\R are theorems of Mathlib about its construction of the real numbers:

exists_lubLean 4Applies a library theoremFormally verified
/-- **Completeness of ℝ.** Every non-empty set of real numbers that is bounded above has a least
upper bound. In Mathlib this is a *theorem* about its construction of `ℝ` (`Real.exists_isLUB`);
in many textbooks it is taken as an axiom. -/
theorem exists_lub (S : Set ℝ) (hne : S.Nonempty) (hbdd : BddAbove S) : ∃ b, IsLUB S b :=
  Real.exists_isLUB hne hbdd
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
rat_btwnLean 4Applies a library theoremFormally verified
/-- **ℚ is dense in ℝ.** Between any two different real numbers there is a rational number.
This applies Mathlib's `exists_rat_btwn` (it holds in every Archimedean ordered field). -/
theorem rat_btwn {x y : ℝ} (h : x < y) : ∃ q : ℚ, x < q ∧ (q : ℝ) < y :=
  exists_rat_btwn h
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor

And Theorem 5 with its lemma, in full. IsLUB S b is Mathlib's "b is a least upper bound of S", and {q : ℚ | q ^ 2 < 2} is our set SS inside Q\Q:

rat_sq_ne_twoLean 4Proved here from basic factsFormally verified
/-- No rational number squares to `2`: if `q² = 2` then `√2 = |q|` would be rational. -/
theorem rat_sq_ne_two (q : ℚ) : q ^ 2 ≠ 2 := by
  intro hq
  apply sqrt_two_irrational
  refine ⟨|q|, ?_⟩
  have hq' : ((q : ℝ)) ^ 2 = 2 := by exact_mod_cast hq
  rw [← hq', Real.sqrt_sq_eq_abs]
  push_cast
  rfl
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
push_toward_sqrt_twoLean 4Proved here from basic factsFormally verified
/-- The key identity behind the next theorem. For `p > 0` put `p' = (2p + 2)/(p + 2)`. Then
`p' - p = (2 - p²)/(p + 2)` and `p'² - 2 = 2(p² - 2)/(p + 2)²`. So if `p² < 2` then `p'` is
*bigger* than `p` but still has `p'² < 2`; if `p² > 2` then `p'` is *smaller* than `p` but still
has `p'² > 2`. -/
theorem push_toward_sqrt_two (p : ℚ) (hp : 0 < p) :
    (2 * p + 2) / (p + 2) - p = (2 - p ^ 2) / (p + 2) ∧
      ((2 * p + 2) / (p + 2)) ^ 2 - 2 = 2 * (p ^ 2 - 2) / (p + 2) ^ 2 := by
  have h : p + 2 ≠ 0 := by positivity
  constructor
  · field_simp
    ring
  · field_simp
    ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor
no_rat_lubLean 4Proved here from basic factsFormally verified
/-- **ℚ is not complete.** The set `S = {q ∈ ℚ | q² < 2}` is non-empty (`0 ∈ S`) and bounded
above (by `2`), but it has **no least upper bound in ℚ**.
Suppose `b` were one. Then `b ≥ 1 > 0` because `1 ∈ S`, and `b² ≠ 2` (`rat_sq_ne_two`).
Let `b' = (2b + 2)/(b + 2)`.
* If `b² < 2`, then `b' > b` and `b'² < 2`, so `b' ∈ S` is bigger than the upper bound `b`.
* If `b² > 2`, then `b' < b` and `b'² > 2`, so `b'` is a smaller upper bound than `b`. -/
theorem no_rat_lub : ¬ ∃ b : ℚ, IsLUB {q : ℚ | q ^ 2 < 2} b := by
  rintro ⟨b, hub, hleast⟩
  have hb1 : 1 ≤ b := hub (show (1 : ℚ) ^ 2 < 2 by norm_num)
  have hb : 0 < b := by linarith
  obtain ⟨h1, h2⟩ := push_toward_sqrt_two b hb
  have hden : 0 < b + 2 := by linarith
  set b' := (2 * b + 2) / (b + 2) with hb'
  rcases lt_trichotomy (b ^ 2) 2 with hlt | heq | hgt
  · -- `b' ∈ S` and `b' > b`: `b` is not an upper bound.
    have hbig : b < b' := by
      have : 0 < (2 - b ^ 2) / (b + 2) := div_pos (by linarith) hden
      linarith
    have hin : b' ^ 2 < 2 := by
      have : 2 * (b ^ 2 - 2) / (b + 2) ^ 2 < 0 :=
        div_neg_of_neg_of_pos (by linarith) (by positivity)
      linarith
    exact absurd (hub hin) (not_le.mpr hbig)
  · exact rat_sq_ne_two b heq
  · -- `b'` is a smaller upper bound: `b` is not the least one.
    have hsmall : b' < b := by
      have : (2 - b ^ 2) / (b + 2) < 0 := div_neg_of_neg_of_pos (by linarith) hden
      linarith
    have hpos : 0 < b' := by rw [hb']; positivity
    have hsq : 2 < b' ^ 2 := by
      have : 0 < 2 * (b ^ 2 - 2) / (b + 2) ^ 2 := div_pos (by linarith) (by positivity)
      linarith
    have hupper : b' ∈ upperBounds {q : ℚ | q ^ 2 < 2} := by
      intro s hs
      -- If `s > b' > 0` then `s² > b'² > 2`, so `s ∉ S`.
      by_contra hcon
      have hlt : b' < s := lt_of_not_ge hcon
      have : b' ^ 2 < s ^ 2 := by nlinarith
      have hs' : s ^ 2 < 2 := hs
      linarith
    exact absurd (hleast hupper) (not_le.mpr hsmall)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor

Finally, viewed inside R\R, the same set of rationals has least upper bound exactly 2\sqrt 2. The proof uses density: below any c<2c < \sqrt 2 there is room for a rational between cc and 2\sqrt 2.

sqrt_two_is_lub_in_realsLean 4Proved here from basic factsFormally verified
/-- In `ℝ` the same set does have a least upper bound, namely `√2`: the gap in `ℚ` is filled.
Every `q ∈ S` has `q ≤ |q| = √(q²) < √2`; and if `c < √2` is any real number, density gives a
rational `q` with `max c 0 < q < √2`, so `q² < 2` and `q > c`: `c` is not an upper bound. -/
theorem sqrt_two_is_lub_in_reals :
    IsLUB {x : ℝ | ∃ q : ℚ, (q : ℝ) = x ∧ q ^ 2 < 2} (√2) := by
  constructor
  · rintro x ⟨q, rfl, hq⟩
    have hq' : ((q : ℝ)) ^ 2 < 2 := by exact_mod_cast hq
    calc (q : ℝ) ≤ |(q : ℝ)| := le_abs_self _
      _ = √((q : ℝ) ^ 2) := (Real.sqrt_sq_eq_abs _).symm
      _ ≤ √2 := Real.sqrt_le_sqrt hq'.le
  · intro c hc
    by_contra hlt
    push Not at hlt
    have h0 : max c 0 < √2 := max_lt hlt (by positivity)
    obtain ⟨q, hq1, hq2⟩ := exists_rat_btwn h0
    have hqpos : (0 : ℝ) < q := lt_of_le_of_lt (le_max_right c 0) hq1
    have hsq : ((q : ℝ)) ^ 2 < 2 := by
      have := pow_lt_pow_left₀ hq2 hqpos.le (two_ne_zero)
      rwa [Real.sq_sqrt (by norm_num)] at this
    have hmem : (q : ℝ) ∈ {x : ℝ | ∃ q : ℚ, (q : ℝ) = x ∧ q ^ 2 < 2} :=
      ⟨q, rfl, by exact_mod_cast hsq⟩
    have := hc hmem
    linarith [le_max_left c 0]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealNumbers.leanTry it in the Lean web editor

What is not formalised here: decimal expansions (Mathlib has the tools, but we did not state the "terminates or repeats" theorem), and our own proof of Theorem 2. For that we cite Mathlib's theorem, which takes a different route: a whole number that is the square of a fraction is the square of a whole number (Rat.isSquare_natCast_iff).

ComputationC

Squeezing, searching and long division

Squeezing the square root of 2 between fractionsPythonExact computationExhaustive finite checkComputationally tested
"""Squeezing sqrt(2) between rationals, and searching for p^2 = 2 q^2.

The rational map p -> (2p + 2)/(p + 2) sends every positive rational with
p^2 < 2 to a *larger* one with the same property, and every rational with
p^2 > 2 to a *smaller* one with the same property. Iterating it in exact
rational arithmetic shows, case by case, why the set {q in Q : q^2 < 2} has
no largest element and no least rational upper bound. A brute-force search
then finds no solution of p^2 = 2 q^2 with 1 <= q <= 100000 (evidence only;
the lesson's descent argument is the proof), while the near misses
p^2 - 2 q^2 = +-1 show how close fractions can get to sqrt(2).
"""

import math
from fractions import Fraction

def push(p):
    """The map p -> (2p + 2)/(p + 2), in exact arithmetic for Fractions."""
    return (2 * p + 2) / (p + 2)

def orbit(p0, steps):
    """Return [p0, push(p0), push(push(p0)), ...] with ``steps`` applications."""
    if steps < 0:
        raise ValueError("steps must be non-negative")
    values = [Fraction(p0)]
    for _ in range(steps):
        values.append(push(values[-1]))
    return values

def square_minus_two(p):
    """p^2 - 2 (exact for Fractions): negative below sqrt(2), positive above."""
    return p * p - 2

def solutions_sq_eq_two_sq(limit):
    """All (p, q) with 1 <= q <= limit and p^2 = 2 q^2 (there are none)."""
    found = []
    for q in range(1, limit + 1):
        p = math.isqrt(2 * q * q)
        if p * p == 2 * q * q:
            found.append((p, q))
    return found

def near_misses(limit):
    """Pairs (p, q), q <= limit, with p^2 - 2 q^2 = +1 or -1."""
    pairs = []
    for q in range(1, limit + 1):
        for p in (math.isqrt(2 * q * q), math.isqrt(2 * q * q) + 1):
            if abs(p * p - 2 * q * q) == 1:
                pairs.append((p, q))
    return pairs

def main():
    root = math.sqrt(2)
    for start, side in ((1, "below"), (2, "above")):
        print(f"Starting {side} sqrt(2) at p = {start}:")
        for p in orbit(start, 5):
            sign = "<" if square_minus_two(p) < 0 else ">"
            gap = abs(float(p) - root)
            print(f"  p = {str(p):>9}   p^2 {sign} 2   |p - sqrt 2| = {gap:.2e}")
    print("Each step stays on its side of sqrt(2) and gets closer: no rational")
    print("is the largest below sqrt(2) or the smallest above it.")
    print()
    limit = 100000
    sols = solutions_sq_eq_two_sq(limit)
    print(f"Solutions of p^2 = 2q^2 with 1 <= q <= {limit}: {len(sols)}")
    misses = near_misses(1000)
    print("Near misses p^2 - 2q^2 = +-1 with q <= 1000 (fractions p/q):")
    print("  " + ", ".join(f"{p}/{q}" for p, q in misses))
    print()
    print("Epistemic status: the orbits are exact rational computations, but")
    print("only finitely many steps; the lesson's algebra proves the pattern")
    print("for every p. The search is exhaustive only up to q = 100000; that")
    print("no solution exists at all is proved by infinite descent, not here.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The orbits climb towards 2\sqrt 2 from below and descend from above, each step staying on its own side — the two cases of Theorem 5, live. The fractions pq\tfrac{p}{q} with p2−2q2=±1p^2 - 2q^2 = \pm 1 are exceptionally good approximations: each is closer to 2\sqrt 2 than every fraction with a smaller denominator. The Śulba-sūtras' 577408\tfrac{577}{408} is one of them. The search finds no exact solution up to q=100 000q = 100\,000, which is evidence, not proof — Theorem 1 covers every qq at once.

Repeating and non-repeating decimalsPythonExact computationNumerical approximationComputationally tested
"""Decimal expansions: fractions repeat, sqrt(2) and pi need not.

Long division of p by q can only meet q different remainders, so the digits
of a fraction must eventually repeat, with a period of at most q - 1 digits.
The experiment computes exact expansions (pre-period and period) of a few
fractions, then the first 40 digits of sqrt(2) (exactly, with integer square
roots) and of pi (exactly, with Machin's formula in integer arithmetic), and
compares pi with the famous approximations 22/7 and 355/113.
"""

import math

def decimal_expansion(p, q):
    """Return (whole part, pre-period digits, period digits) of p/q >= 0.

    Long division: a remainder that comes back starts the repeating block.
    A terminating decimal has period "0".
    """
    if q <= 0 or p < 0:
        raise ValueError("need p >= 0 and q > 0")
    whole, r = divmod(p, q)
    digits, seen = [], {}
    while r not in seen:
        seen[r] = len(digits)
        d, r = divmod(10 * r, q)
        digits.append(str(d))
    start = seen[r]
    return whole, "".join(digits[:start]), "".join(digits[start:])

def sqrt_digits(n, k):
    """The first k decimal digits of sqrt(n) after the point (truncated)."""
    root = math.isqrt(n * 10 ** (2 * k))
    return str(root)[-k:] if k else ""

def arctan_inv(x, scale):
    """scale * arctan(1/x) for an integer x > 1, by the alternating series."""
    total, term, k, sign = 0, scale // x, 1, 1
    while term:
        total += sign * (term // k)
        term //= x * x
        k += 2
        sign = -sign
    return total

def pi_digits(k):
    """The first k decimal digits of pi after the point (truncated).

    Machin (1706): pi = 16 arctan(1/5) - 4 arctan(1/239); 10 guard digits.
    """
    scale = 10 ** (k + 10)
    pi_scaled = 16 * arctan_inv(5, scale) - 4 * arctan_inv(239, scale)
    return str(pi_scaled // 10 ** 10)[1:k + 1]

def fraction_digits(p, q, k):
    """The first k digits of p/q after the point."""
    return str((p % q) * 10 ** k // q).zfill(k)

def agreement(a, b):
    """Number of leading digits two digit strings share."""
    n = 0
    while n < min(len(a), len(b)) and a[n] == b[n]:
        n += 1
    return n

def main():
    print("Fractions: long division must repeat (period at most q - 1).")
    for p, q in [(3, 8), (1, 7), (5, 12), (22, 7), (1, 97)]:
        whole, pre, per = decimal_expansion(p, q)
        shown = per if len(per) <= 24 else per[:24] + "..."
        print(f"  {p}/{q} = {whole}.{pre}({shown})  period {len(per)}")
    print()
    root2 = sqrt_digits(2, 40)
    pi = pi_digits(40)
    print(f"sqrt(2) = 1.{root2}...")
    print(f"pi      = 3.{pi}...")
    for p, q in [(22, 7), (355, 113)]:
        digits = fraction_digits(p, q, 40)
        same = agreement(pi, digits)
        print(f"{p}/{q} = 3.{digits[:12]}...  agrees with pi to {same} decimals")
    print("These digits show no repeating block, but finitely many digits")
    print("decide nothing: 1/97 needs 96 digits before its block repeats.")
    print()
    print("Epistemic status: all digits are exact integer computations (the")
    print("pi digits rely on Machin's formula with 10 guard digits). Finding no")
    print("repetition in finitely many digits proves nothing; sqrt(2) is")
    print("irrational by the lesson's proof, and pi by Lambert's (1761).")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The long-division experiment shows the remainder argument at work: 197\tfrac{1}{97} needs all 9696 possible remainders before it repeats. Forty digits of 2\sqrt 2 or π\pi with no repeating block prove nothing on their own — the next million digits might start repeating, as far as any finite check can tell. Irrationality is decided by proof.

Explore

Explore: a staircase to √2

The cobweb below iterates the map of Lemma 2, x↦2x+2x+2x \mapsto \tfrac{2x + 2}{x + 2}. A fixed point satisfies x=2x+2x+2x = \tfrac{2x + 2}{x + 2}, i.e. x2=2x^2 = 2: the staircase heads for 2≈1.41421\sqrt 2 \approx 1.41421.

Iterating x ↦ (2x + 2)/(x + 2)

Start below √2 (try x₀ = 1) and above it (try x₀ = 2.4). Does an orbit ever cross √2?

f(x) =
x₀

Iterates xₖ against k

  • y = f(x)
  • y = x
  • cobweb path

Last iterates: x10 = 1.41421, x11 = 1.41421, x12 = 1.41421

The orbit appears to settle at a fixed point x* ≈ 1.41421.

Fixed points in view (numerical): x* = 1.4142 (attracting: |f′(x*)| < 1)

Based on 3,000 iterations in floating-point arithmetic: numerical evidence, not proof.

Try several starting values. Every positive start converges to 2\sqrt 2, and an orbit that starts below stays below. If every iterate is a fraction, why is the limit not a fraction? Because a limit of rationals need not be rational — which is exactly what it means for Q\Q to have holes.

Exercises

Exercises

1. Real numbers and irrationality

Warm-upHuman

Which of these numbers are irrational? (Choose all that apply.)

Choose all that apply

2. Real numbers and irrationality

Warm-upHuman

Write 0.363636…0.363636\ldots (the block 3636 repeating forever) as a fraction pq\tfrac pq in lowest terms. What is the denominator qq?

3. Real numbers and irrationality

Warm-upHuman

How many integers xx satisfy ∣x−3∣≤2|x - 3| \le 2?

4. Real numbers and irrationality

CoreHuman

In the proof that p2=2q2p^2 = 2q^2 has no solution with q≠0q \ne 0, we write: "Since p2p^2 is even, pp is even." Which fact justifies this step?

Choose one

5. Real numbers and irrationality

CoreHuman

A student copies the proof for 2\sqrt 2 to "prove" that 4\sqrt 4 is irrational: "Suppose p2=4q2p^2 = 4q^2 with q≥1q \ge 1 as small as possible. Then p2p^2 is divisible by 44, so pp is divisible by 44; write p=4kp = 4k. Then 16k2=4q216k^2 = 4q^2, so q2=4k2q^2 = 4k^2 — a smaller solution." Since 4=2\sqrt 4 = 2, something is wrong. Which step fails?

Choose one

6. Real numbers and irrationality

CoreHuman

Let S={1−1n:n=1,2,3,… }S = \{1 - \tfrac1n : n = 1, 2, 3, \dots\}. Which statement is true?

Choose one

7. Real numbers and irrationality

CoreHuman

Which pair (x,y)(x, y) is a counterexample to the claim "if xx and yy are irrational, then x+yx + y is irrational"?

Choose one

8. Real numbers and irrationality

StretchFormal

Which Lean statement says that Q\Q is not complete, using the set S={q∈Q:q2<2}S = \{q \in \Q : q^2 < 2\}? (IsLUB S b means "bb is a least upper bound of SS".)

Choose one

9. Real numbers and irrationality

StretchComputational

Write repetend_length(p, q) for integers 0≤p0 \le p and q≥1q \ge 1: the length of the repeating block of the decimal expansion of pq\tfrac pq, or 0 if the decimal terminates. Use long division and remember the position at which each remainder first appeared. For example 17=0.142857‾\tfrac17 = 0.\overline{142857} gives 6, 512=0.416‾\tfrac{5}{12} = 0.41\overline{6} gives 1, and 38=0.375\tfrac38 = 0.375 gives 0.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

"π=227\pi = \tfrac{22}{7}" or "π=3.14\pi = 3.14". These are approximations. 227=3.142857…\tfrac{22}{7} = 3.142857\ldots agrees with π=3.141592…\pi = 3.141592\ldots only to two decimal places, and Zu Chongzhi's 355113\tfrac{355}{113} to six. Since π\pi is irrational, no fraction and no terminating decimal equals it.

Misconception

"A long decimal that never seems to repeat could still be a fraction." If you know the decimal never repeats, it is not a fraction: every fraction's decimal terminates or repeats with period at most q−1q - 1. What a finite list of digits cannot tell you is whether it never repeats — that needs a proof about the number.

Misconception

"The product (or sum) of two irrational numbers is irrational." 2⋅2=2\sqrt 2 \cdot \sqrt 2 = 2, 3⋅12=6\sqrt 3 \cdot \sqrt{12} = 6, and 2+(2−2)=2\sqrt 2 + (2 - \sqrt 2) = 2. Only "rational ++ irrational" and "non-zero rational ×\times irrational" are guaranteed irrational.

Misconception

"0.999…0.999\ldots is just below 11." The decimal 0.999…0.999\ldots is the limit of 0.9,0.99,0.999,…0.9, 0.99, 0.999, \dots, whose distances from 11 are 110,1100,…\tfrac{1}{10}, \tfrac{1}{100}, \dots — eventually below any positive number. A limit is a single number, and here it is exactly 11.

Misconception

"Irrational numbers are rare exceptions." It is the other way round. The rationals can be listed in one infinite sequence, but the reals cannot (Cantor's diagonal argument, on the How many infinities? trail). In that precise sense almost every real number is irrational.

ViewpointsH

Other ways of seeing

Geometry— Incommensurable lengths

For Greek geometers the discovery was about lengths, not numbers. Two segments are commensurable if both are whole-number multiples of a common unit. Theorem 1 says the side and diagonal of a square are incommensurable: no unit, however small, measures both exactly. Euclid's Elements (Book X) builds a whole classification of incommensurable lengths, and Eudoxus' theory of ratios (Book V) compares them by asking which fractions lie below and which above — an idea that Dedekind turned into a construction of R\R in 1872.

Number theory— The best fractions for √2

The near misses p2−2q2=±1p^2 - 2q^2 = \pm 1 in the experiment — 11,32,75,1712,4129,…\tfrac11, \tfrac32, \tfrac75, \tfrac{17}{12}, \tfrac{41}{29}, \dots — are solutions of a Pell equation. Each comes from the previous one by (p,q)↦(p+2q,p+q)(p, q) \mapsto (p + 2q, p + q), and they are the convergents of the continued fraction 2=1+12+12+⋯\sqrt 2 = 1 + \cfrac{1}{2 + \cfrac{1}{2 + \cdots}}. Dividing p2−2q2=±1p^2 - 2q^2 = \pm 1 by q2q^2 shows ∣pq−2∣=1q2 (p/q+2)<12q2\big|\tfrac pq - \sqrt 2\big| = \tfrac{1}{q^2\,(p/q + \sqrt 2)} < \tfrac{1}{2q^2}: irrational numbers can be approximated remarkably well, and how well is a deep question of number theory (Diophantine approximation).

Analysis— Why calculus needs completeness

Over Q\Q, the function f(x)=x2−2f(x) = x^2 - 2 is negative at 11 and positive at 22, yet it is never 00 at a rational point: the intermediate value theorem fails in Q\Q. Completeness is exactly what repairs it, and with it the existence of limits of increasing bounded sequences, of maxima of continuous functions on [a,b][a, b], and of integrals. Every theorem of real analysis leans on it.

Set theory— Countably many fractions, uncountably many reals

The rationals can be listed as a sequence (go through pq\tfrac pq by increasing ∣p∣+q|p| + q), so Q\Q is countable. Cantor proved in 1874 that R\R is not: any list of reals misses one. So irrational numbers are not the exception but the rule. See Countability and Cantor's diagonal argument.

Wonder Trails

Wonder Trails

History & global context

History and global context

  • Mesopotamia and India. The Old Babylonian tablet YBC 7289 (about 1800–1600 BCE) records 2≈1;24,51,10\sqrt 2 \approx 1;24,51,10 in base sixty. The Baudhāyana Śulba-sūtra (first millennium BCE) gives the approximation 577408\tfrac{577}{408}, used for constructing altars of prescribed areas. Neither source asks whether an exact fraction exists.
  • Greece. The discovery that side and diagonal are incommensurable was made among the Pythagoreans, probably in the 5th century BCE; the story that Hippasus was drowned for revealing it is a later legend. Plato's Theaetetus reports that Theodorus of Cyrene proved the irrationality of 3,5,…,17\sqrt 3, \sqrt 5, \dots, \sqrt{17}. Aristotle alludes to the classical parity proof for 2\sqrt 2, and Euclid's Elements (about 300 BCE) sets out Eudoxus' theory of proportion and, in Book X, a theory of incommensurable magnitudes.
  • China, India and the Islamic world. Zu Chongzhi (5th century CE) showed that π\pi lies between 3.14159263.1415926 and 3.14159273.1415927 and proposed the approximation 355113\tfrac{355}{113}; his bounds were not improved for nearly a thousand years. Āryabhaṭa (499 CE) gave π≈6283220000=3.1416\pi \approx \tfrac{62832}{20000} = 3.1416 and called it "approximate". In the 11th century Omar Khayyam, commenting on Euclid, argued that ratios of incommensurable magnitudes could be treated as numbers.
  • Europe. Simon Stevin popularised decimal fractions (De Thiende, 1585). Johann Heinrich Lambert proved π\pi irrational in 1761. In 1872 Richard Dedekind (cuts) and Georg Cantor (Cauchy sequences), building on ideas of Charles Méray and Karl Weierstrass, published rigorous constructions of R\R from Q\Q, and in 1874 Cantor proved that R\R is uncountable.
Further reading

Further reading

  • Ivan Niven, Numbers: Rational and Irrational (1961) — a short, readable book on exactly this lesson's themes.
  • Richard Courant and Herbert Robbins, What Is Mathematics? (1941), chapter II on the number system.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers (1938), chapter IV (irrational numbers) and the chapters on continued fractions.
  • Richard Dedekind, Continuity and Irrational Numbers (1872; English translation in Essays on the Theory of Numbers, 1901).
  • Walter Rudin, Principles of Mathematical Analysis (3rd edition, 1976), chapter 1, which opens with the map p↦p−p2−2p+2p \mapsto p - \tfrac{p^2 - 2}{p + 2} — the same map as Lemma 2.
  • Michael Spivak, Calculus (1967), chapters 1–2 and 8 on the properties of numbers and least upper bounds.