Real numbers

Level FundamentalDifficulty ★★★★★Concept⌖ Open in the map

What is it?

The number line ℝ\R: the rationals plus the limits of all their convergent sequences. Its defining property is completeness — every non-empty set bounded above has a least upper bound — and calculus depends on it.

Why does it exist?

The rationals have holes: x2=2x^2 = 2 has no rational solution, and the sequence 1,1.4,1.41,1.414,…1, 1.4, 1.41, 1.414, \dots gets ever closer to something that is not there. Limits, derivatives and integrals would all break on those holes. The reals are the smallest number system without them.

Formal definition

ℝ\R is a complete ordered field. Completeness (the supremum axiom): if A⊂ℝA \subset \R is non-empty and bounded above, there is a least upper bound sup⁡A∈ℝ\sup A \in \R.

Formulas

ℕ⊂ℤ⊂ℚ⊂ℝ⊂ℂ\N \subset \Z \subset \Q \subset \R \subset \C
the number systems
sup⁡A=s  ⟺  (∀a∈A: a≤s) ∧ (∀ε>0 ∃a∈A: a>s−ε)\sup A = s \iff \big(\forall a \in A:\ a \le s\big) \ \wedge\ \big(\forall \varepsilon > 0\ \exists a \in A:\ a > s - \varepsilon\big)
least upper bound

Why does it matter?

A computer cannot store ℝ\R: a 64-bit word has only 2642^{64} values, and almost every real number needs infinitely many digits. Everything numerical software does is a careful approximation of this ideal object, and most numerical bugs live in the gap between the two.

Where it shows up in computing

  • Floating point (IEEE 754)★★★★★fundamentalScientific computing and algorithms

    IEEE 754 doubles are a finite, unevenly spaced subset of ℝ\R; every operation rounds back into it.

  • Symbolic computation (CAS)★★★★★frequentScientific computing and algorithms

    Computer algebra systems keep 2\sqrt 2 or π\pi exact as symbols instead of approximating them.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

Exercises

1Proof

Prove that 2\sqrt 2 is irrational.

Hint

Assume 2=p/q\sqrt 2 = p/q in lowest terms and look at parity.

Solution

If p2=2q2p^2 = 2q^2 then p2p^2 is even, so pp is even: p=2kp = 2k. Then 4k2=2q24k^2 = 2q^2, so q2=2k2q^2 = 2k^2 and qq is even too, contradicting that p/qp/q was in lowest terms.

2Computing

In most languages 0.1 + 0.2 == 0.3 is false. Explain why in terms of real numbers.

Solution

0.10.1, 0.20.2 and 0.30.3 have infinite binary expansions, so each is rounded to the nearest double. The rounded 0.10.1 plus the rounded 0.20.2, rounded again, lands on a different double than the rounded 0.30.3. Compare with a tolerance: ∣a−b∣≤εmax⁡(∣a∣,∣b∣)|a - b| \le \varepsilon \max(|a|, |b|).

↑ ↓ to navigate · ↵ · Esc