When calculus goes wrong
Here is a famous series:
Now add up exactly the same numbers in a different order — two positive terms, then one negative:
Same terms, different sum. Riemann proved in 1854 that a series like this one, which converges but not absolutely, can be rearranged to add up to any real number you like. Addition of infinitely many numbers is not addition.
The history of calculus is full of such surprises. In his Cours d'analyse of 1821, Augustin-Louis Cauchy "proved" that a convergent series of continuous functions has a continuous sum. Five years later Niels Henrik Abel pointed out that the Fourier series
converges for every to a function that jumps at . In 1872 Karl Weierstrass presented a continuous function that has a tangent line nowhere — at a time when many mathematicians believed a continuous function must be differentiable at most points.
Real analysis is the response: precise definitions of limit, continuity, convergence and integral, and proofs of everything calculus uses. All of it rests on one property of the real numbers, completeness: the real line has no holes. In this lesson you will prove, from that single axiom, the intermediate value theorem, the extreme value theorem, the Bolzano–Weierstrass theorem and the fundamental theorem of calculus, and you will learn exactly when two limiting processes can be swapped.
No holes, and one N for everyone
The rational numbers are full of holes. The decimal approximations to get closer and closer to each other, but in there is nothing for them to converge to. The set is bounded above but has no least upper bound in . Completeness says that in this never happens: every sequence that "ought to converge" does, and every bounded set has a sharpest bound. Each of the great theorems of this lesson fails over . The function on changes sign without ever being .
The second big idea is about the order of quantifiers. A sequence of functions converges to pointwise on if for each the numbers converge to . It converges uniformly if one threshold works for all at once: once , the whole graph of lies inside a tube of width around the graph of .
The difference matters because limits are delicate. The continuous functions on converge pointwise to a function that is on and jumps to at . The threshold that makes gets larger and larger as approaches , and no single works. Uniform convergence is precisely the hypothesis that rescues continuity, integrals and (with care) derivatives.
Definitions
Throughout, is the distance between real numbers. We take to be an ordered field (the familiar rules of arithmetic and inequalities) with one extra axiom.
Definition— supremum and the completeness axiom
An upper bound of is a number with for all . A supremum (least upper bound) of is an upper bound such that for every upper bound ; we write . The completeness axiom: every non-empty subset of that is bounded above has a supremum.
The supremum is characterised by an approximation property: an upper bound of is if and only if for every there is with . (Otherwise would be a smaller upper bound.) Completeness implies the Archimedean property: is not bounded above in . Indeed, if existed, some would give . Hence .
Definition— convergence and Cauchy sequences
A sequence converges to , written , if for every there is such that for all . It is a Cauchy sequence if for every there is such that for all . A subsequence of is a sequence with strictly increasing.
Definition— continuity and uniform continuity
Let with . is continuous at if for every there is such that for all with ; it is continuous if it is continuous at every point of . It is uniformly continuous if for every there is a that works at every point: whenever and .
Definition— pointwise and uniform convergence
Let . The sequence converges to pointwise on if for each : . It converges uniformly on if , equivalently if .
The only difference is where "" stands. In the uniform definition is chosen before , so it cannot depend on .
Definition— Riemann integral (Darboux's formulation)
Let be bounded. A partition of is a finite list . With and , the upper and lower sums are
is Riemann integrable if ; this common value is .
Adding points to a partition (a refinement) can only lower upper sums and raise lower sums. Comparing any two partitions with their common refinement shows that every lower sum is at most every upper sum. Consequently is integrable if and only if for every there is a partition with (Riemann's criterion).
Examples, non-examples and warnings
Example— Limits, and how to prove them
- : as soon as , which happens for large by the Archimedean property.
- does not converge: any limit would satisfy and , so . But it has convergent subsequences (, ), as Bolzano–Weierstrass promises for a bounded sequence.
- is increasing and bounded above by , so it converges by the monotone convergence theorem below. Its limit is called .
Example— A Cauchy sequence of rationals with no rational limit
Define and (Newton's method for ). Every is rational, in , and so is Cauchy. In it has no limit: if in then , so , which has no rational solution. Being Cauchy is about the sequence; converging is about the space it lives in.
Example— Pointwise but not uniform
- on : the pointwise limit is for , . Convergence is uniform on for each (the supremum of there is ) but not on , where the supremum is for every .
- converges pointwise to on , and every and the limit are continuous. Yet , so the convergence is not uniform. Continuity of the limit does not imply uniform convergence.
- converges to at every , but . The mass concentrates into a spike near , and limit and integral cannot be swapped.
Example— Functions that are and are not Riemann integrable
- Dirichlet's function ( on rationals, on irrationals) is not integrable on : every interval of positive length contains rationals and irrationals, so on every partition and .
- Thomae's function ( in lowest terms, at irrationals) is discontinuous at every rational and continuous at every irrational, yet it is integrable with integral : for only finitely many points have , and they can be enclosed in subintervals of tiny total length.
- Every monotone function on is integrable. With equal pieces the sum telescopes to .
Completeness: three theorems about sequences
Theorem— Theorem 1 (monotone convergence)
An increasing sequence that is bounded above converges, to . (Likewise a decreasing sequence bounded below converges to its infimum.)
Proof
Let , which exists by completeness. Given , the approximation property gives with . For , monotonicity gives , so .
∎
Theorem— Lemma 2 (every sequence has a monotone subsequence)
Every real sequence has a subsequence that is increasing or decreasing.
Proof
Call an index a peak if for every — from you can see to the horizon. If there are infinitely many peaks , then is a decreasing subsequence. Otherwise let be larger than every peak. As is not a peak, some has ; as is not a peak, some has ; and so on. This gives an increasing subsequence.
∎
Theorem— Theorem 3 (Bolzano–Weierstrass)
Every bounded sequence of real numbers has a convergent subsequence.
Proof
By Lemma 2 it has a monotone subsequence, which is bounded and hence converges by Theorem 1.
∎
Theorem— Theorem 4 (Cauchy criterion)
A sequence of real numbers converges if and only if it is a Cauchy sequence.
Proof
() If , choose with for . Then for : .
() Let be Cauchy. It is bounded: with there is such that for , so for all . By Bolzano–Weierstrass some subsequence . The whole sequence converges to : given , choose with for , and with for . For take . Since ,
∎
Note
For an ordered field, the following are equivalent: the supremum property; the monotone convergence theorem; the Bolzano–Weierstrass theorem; "Cauchy sequences converge" together with the Archimedean property; the nested interval property together with the Archimedean property. Each fails in . Up to a unique isomorphism, is the only ordered field with these properties — see constructing ℤ, ℚ and ℝ for its construction by Dedekind cuts or Cauchy sequences.
Continuous functions on a closed interval
We first record the link between ε–δ continuity and sequences. If is continuous at and (with in the domain), then . Given , take the of continuity, then with for ; then for . Also, limits of sequences in stay in : if and , then eventually , forcing .
Theorem— Theorem 5 (intermediate value theorem)
If is continuous and , then for some . Consequently a continuous function on takes every value between and .
Proof
Let . It contains and is bounded above by , so exists, and . We show that is neither positive nor negative.
Suppose . By continuity (with ) there is with for all with . By the approximation property some satisfies . Then , so , contradicting .
Suppose . Then (as ), so . By continuity there is with whenever and . The point lies in , satisfies and , so and . But , a contradiction.
Hence . For the general statement apply this to or .
∎
Theorem— Theorem 6 (extreme value theorem)
A continuous function is bounded and attains its maximum and its minimum.
Proof
Bounded: otherwise for each there is with . By Bolzano–Weierstrass a subsequence converges to some , and by continuity . A convergent sequence is bounded, but . Contradiction.
Attains its maximum: let , finite by the first part. For each choose with . A subsequence converges to some , and . Since , this limit is . Apply the same to for the minimum.
∎
Both hypotheses matter. On the continuous function is unbounded, on the function is unbounded, and on the function is bounded but has no maximum. On the closed interval , the discontinuous function equal to for and to at is bounded, with supremum , but never reaches it. What the proofs used about is that every sequence in it has a subsequence converging in it — sequential compactness. In the language of point-set topology, the intermediate value theorem is about connectedness and the extreme value theorem about compactness.
Theorem— Theorem 7 (Heine–Cantor: uniform continuity)
A continuous function is uniformly continuous.
Proof
If not, there is such that for each some satisfy but . By Bolzano–Weierstrass a subsequence converges to some ; then too, since . By continuity at , , contradicting .
∎
On the function is continuous but not uniformly continuous: and are very close, yet .
Uniform convergence and swapping limits
Theorem— Theorem 8 (uniform limit theorem)
If uniformly on and every is continuous at , then is continuous at . In particular, a uniform limit of continuous functions is continuous.
Proof
Let . Choose with for all — here uniformity is used. Since is continuous at , there is with for , . For such ,
∎
Where does the argument break for pointwise convergence? The first step would choose depending on , and then (chosen for ) depends on , which is circular. The example shows the theorem genuinely fails, and Theorem 8 gives a quick proof that is not uniform on : the limit is discontinuous.
Theorem— Theorem 9 (integrals of uniform limits)
If uniformly on and each is Riemann integrable, then is Riemann integrable and .
Proof
Let . On every subinterval, , so for every partition
Given , fix with , then with : Riemann's criterion shows is integrable. Finally .
∎
For series this becomes the most useful test in analysis.
Theorem— Theorem 10 (Weierstrass M-test)
If for all and , then converges uniformly on . If moreover every is continuous, so is the sum.
Proof
Let . For , , which is small for large independently of . So each is Cauchy and converges (Theorem 4) to some . Letting gives for all , which tends to : the convergence is uniform. Continuity follows from Theorem 8.
∎
Derivatives are the most delicate. The functions converge uniformly to (the supremum is ), but their derivatives do not converge at all — at they alternate between . Uniform convergence of the derivatives is what is needed.
Theorem— Theorem 11 (derivatives of limits)
Let be continuously differentiable, suppose uniformly on and converges for some . Then converges uniformly to a differentiable function with .
Proof
By Theorem 8, is continuous. By the fundamental theorem of calculus (Theorem 15 below), . By Theorem 9 the right-hand side converges, uniformly in (the error is at most ), to , where . By Theorem 14 below, .
∎
Without some such hypothesis, anything can happen.
Theorem— Theorem 12 (Weierstrass's function is not differentiable at 0)
Let with and . Then is continuous on but not differentiable at .
Proof
Continuity: the M-test with . Now put . For , is an odd integer, so . Since ,
Using , the first term has absolute value at most . Hence
If existed, these difference quotients would converge to it.
∎
The same function has no derivative at any point. Theorem (Weierstrass, 1872; stated, not proved here). If , is an odd integer and , then is continuous and nowhere differentiable. G. H. Hardy (1916) showed that suffices. A proof of a closely related example is in Stein and Shakarchi, Fourier Analysis (2003), chapter 4. Every partial sum of is infinitely differentiable; the limit is differentiable nowhere. The derivatives of the partial sums, of size about , are as far from converging uniformly as possible.
The Riemann integral and the fundamental theorem
Theorem— Theorem 13 (continuous functions are integrable)
Every continuous is Riemann integrable. The indicator function of the rationals is not.
Proof
Let . By Heine–Cantor there is with whenever . Take a partition with all . On each piece, the extreme value theorem gives and with , so , and
For : every piece of positive length contains a rational and an irrational, so and ; every upper sum is and every lower sum is .
∎
We use three elementary properties of the integral, all proved directly from the definition: it is linear; it is additive over adjacent intervals, (with the convention ); and .
Theorem— Theorem 14 (fundamental theorem of calculus, part 1)
Let be Riemann integrable on and . If is continuous at , then is differentiable at and .
Proof
Let and choose such that whenever . For (with ),
whose absolute value is at most . Dividing by : .
∎
Theorem— Theorem 15 (fundamental theorem of calculus, part 2)
If is differentiable on (one-sided at the ends) and is Riemann integrable, then .
Proof
Let be any partition. By the mean value theorem, on each piece for some , and . Summing, the sum telescopes:
So lies between every lower sum and every upper sum. Since is integrable, the only such number is .
∎
The hypothesis that is integrable cannot be dropped: Vito Volterra (1881) constructed a differentiable function whose derivative is bounded but not Riemann integrable. The Lebesgue integral repairs this partly (a bounded derivative is always Lebesgue integrable, and part 2 then holds), which is one of many reasons to continue to measure theory.
Real analysis in Lean and Mathlib
Mathlib states limits with filters: Tendsto a atTop (𝓝 L) says that eventually lands in every neighbourhood of . That one notion covers limits of sequences, of functions at a point, from the left, at infinity, and much more. To connect it with the lesson, we define the ε–N notions directly and prove that they agree with Mathlib's.
/-- `ConvergesTo a L`: the sequence `a` converges to `L` — for every `ε > 0` there is an index `N`
such that `|aₙ - L| < ε` for every `n ≥ N`. -/
def ConvergesTo (a : ℕ → ℝ) (L : ℝ) : Prop :=
∀ ε > 0, ∃ N : ℕ, ∀ n ≥ N, |a n - L| < ε/-- `IsCauchy a`: the terms of `a` eventually stay close *to each other* — for every `ε > 0` there
is `N` with `|aₘ - aₙ| < ε` for all `m, n ≥ N`. No limit is mentioned. -/
def IsCauchy (a : ℕ → ℝ) : Prop :=
∀ ε > 0, ∃ N : ℕ, ∀ m ≥ N, ∀ n ≥ N, |a m - a n| < ε/-- The lesson's ε–N definition agrees with Mathlib's filter definition of a limit. This applies
Mathlib's `Metric.tendsto_atTop` (and `Real.dist_eq : dist x y = |x - y|`). -/
theorem convergesTo_iff_tendsto (a : ℕ → ℝ) (L : ℝ) :
ConvergesTo a L ↔ Tendsto a atTop (𝓝 L) := by
rw [Metric.tendsto_atTop]
simp only [ConvergesTo, Real.dist_eq]The ε-arguments of the completeness section, written as calc chains that follow the human proofs line by line:
/-- **Limits are unique.** If `aₙ → L` and `aₙ → M`, then `L = M`. Otherwise take
`ε = |L - M| / 2`: far enough along, `aₙ` is within `ε` of both, and the triangle inequality gives
`|L - M| ≤ |L - aₙ| + |aₙ - M| < 2ε = |L - M|`. -/
theorem limit_unique {a : ℕ → ℝ} {L M : ℝ} (hL : ConvergesTo a L) (hM : ConvergesTo a M) :
L = M := by
by_contra hne
have hpos : 0 < |L - M| / 2 := by
have : 0 < |L - M| := abs_pos.mpr (sub_ne_zero.mpr hne)
linarith
obtain ⟨N₁, hN₁⟩ := hL _ hpos
obtain ⟨N₂, hN₂⟩ := hM _ hpos
have h1 := hN₁ (max N₁ N₂) (le_max_left _ _)
have h2 := hN₂ (max N₁ N₂) (le_max_right _ _)
have htri : |L - M| ≤ |a (max N₁ N₂) - L| + |a (max N₁ N₂) - M| := by
calc |L - M| = |(a (max N₁ N₂) - M) - (a (max N₁ N₂) - L)| := by ring_nf
_ ≤ |a (max N₁ N₂) - M| + |a (max N₁ N₂) - L| := abs_sub _ _
_ = |a (max N₁ N₂) - L| + |a (max N₁ N₂) - M| := add_comm _ _
linarith/-- **Every convergent sequence is Cauchy.** Given `ε`, choose `N` so that every term from `N` on
is within `ε/2` of the limit `L`; then `|aₘ - aₙ| ≤ |aₘ - L| + |L - aₙ| < ε/2 + ε/2 = ε`. -/
theorem cauchy_of_convergesTo {a : ℕ → ℝ} {L : ℝ} (h : ConvergesTo a L) : IsCauchy a := by
intro ε hε
obtain ⟨N, hN⟩ := h (ε / 2) (by linarith)
refine ⟨N, fun m hm n hn => ?_⟩
have hm' := hN m hm
have hn' := hN n hn
calc |a m - a n| = |(a m - L) - (a n - L)| := by ring_nf
_ ≤ |a m - L| + |a n - L| := abs_sub _ _
_ < ε / 2 + ε / 2 := add_lt_add hm' hn'
_ = ε := by ring/-- **A Cauchy sequence with a convergent subsequence converges** (to the same limit). This is
the heart of "Cauchy ⇒ convergent": Bolzano–Weierstrass supplies the subsequence. Given `ε`, take
`N` from the Cauchy condition for `ε/2` and `K` so that `a (φ k)` is within `ε/2` of `L` for
`k ≥ K`. For `n ≥ N` pick `k = max K n`; since `φ` is strictly increasing, `φ k ≥ k ≥ n ≥ N`,
so `|aₙ - L| ≤ |aₙ - a (φ k)| + |a (φ k) - L| < ε`. -/
theorem convergesTo_of_cauchy_of_subseq {a : ℕ → ℝ} {L : ℝ} {φ : ℕ → ℕ} (ha : IsCauchy a)
(hφ : StrictMono φ) (hsub : ConvergesTo (a ∘ φ) L) : ConvergesTo a L := by
intro ε hε
obtain ⟨N, hN⟩ := ha (ε / 2) (by linarith)
obtain ⟨K, hK⟩ := hsub (ε / 2) (by linarith)
refine ⟨N, fun n hn => ?_⟩
have hk : n ≤ φ (max K n) := le_trans (le_max_right K n) (hφ.id_le _)
have h1 : |a n - a (φ (max K n))| < ε / 2 := hN n hn _ (le_trans hn hk)
have h2 : |a (φ (max K n)) - L| < ε / 2 := hK (max K n) (le_max_left _ _)
calc |a n - L| = |(a n - a (φ (max K n))) + (a (φ (max K n)) - L)| := by ring_nf
_ ≤ |a n - a (φ (max K n))| + |a (φ (max K n)) - L| := abs_add_le _ _
_ < ε / 2 + ε / 2 := add_lt_add h1 h2
_ = ε := by ring/-- **Monotone convergence theorem.** An increasing sequence that is bounded above converges, to
the supremum `s` of its terms. Given `ε`, the number `s - ε` is not an upper bound, so some
`a_N > s - ε`; for `n ≥ N`, monotonicity gives `s - ε < a_N ≤ aₙ ≤ s`. This is exactly where the
completeness axiom (existence of `sSup`) enters. -/
theorem monotone_converges {a : ℕ → ℝ} (hmono : Monotone a) (hbdd : BddAbove (range a)) :
ConvergesTo a (sSup (range a)) := by
intro ε hε
have hlt : sSup (range a) - ε < sSup (range a) := by linarith
obtain ⟨_, ⟨N, rfl⟩, hN⟩ := exists_lt_of_lt_csSup (range_nonempty a) hlt
refine ⟨N, fun n hn => ?_⟩
have hle : a n ≤ sSup (range a) := le_csSup hbdd (mem_range_self n)
have hge : a N ≤ a n := hmono hn
rw [abs_lt]
constructor <;> linarithBolzano–Weierstrass and the completeness of are cited from Mathlib, and combined with the lemmas above to give Theorem 4:
/-- **Bolzano–Weierstrass.** Every bounded sequence of real numbers has a convergent subsequence.
This applies Mathlib's `tendsto_subseq_of_bounded`, which holds in every proper metric space
(closed balls are compact), here the closed interval `[-M, M]`. -/
theorem bolzano_weierstrass (a : ℕ → ℝ) (M : ℝ) (hM : ∀ n, |a n| ≤ M) :
∃ L : ℝ, ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (a ∘ φ) atTop (𝓝 L) := by
obtain ⟨L, -, φ, hφ, hlim⟩ :=
tendsto_subseq_of_bounded (Metric.isBounded_Icc (-M) M) (fun n => abs_le.mp (hM n))
exact ⟨L, φ, hφ, hlim⟩/-- **In `ℝ`, a sequence is Cauchy if and only if it converges.** The forward direction is the
completeness of `ℝ` (Mathlib's `cauchySeq_tendsto_of_complete`); the backward direction is
`cauchy_of_convergesTo`. Mathlib's `CauchySeq` is unfolded to ε–N form by `Metric.cauchySeq_iff`. -/
theorem cauchy_iff_converges (a : ℕ → ℝ) : IsCauchy a ↔ ∃ L, ConvergesTo a L := by
constructor
· intro h
have hc : CauchySeq a := by
rw [Metric.cauchySeq_iff]
intro ε hε
obtain ⟨N, hN⟩ := h ε hε
exact ⟨N, fun m hm n hn => by rw [Real.dist_eq]; exact hN m hm n hn⟩
obtain ⟨L, hL⟩ := cauchySeq_tendsto_of_complete hc
exact ⟨L, (convergesTo_iff_tendsto a L).mpr hL⟩
· rintro ⟨L, hL⟩
exact cauchy_of_convergesTo hLThe intermediate value theorem, proved from the supremum exactly as in Theorem 5 (for a function continuous on all of ; a function continuous on can be extended continuously by constants, so nothing is lost), next to Mathlib's general version and the extreme value theorem:
/-- **Intermediate value theorem, proved from completeness.** If `f` is continuous, `a ≤ b`,
`f a ≤ 0 ≤ f b`, then `f c = 0` for some `c ∈ [a, b]`. Let `S = {x ∈ [a, b] | f x ≤ 0}` and
`c = sup S`. If `f c > 0`, continuity gives a whole interval `(c - δ, c + δ)` where `f > 0`, so
`c - δ` would be an upper bound of `S` — impossible. If `f c < 0`, then `c < b` and `f < 0` a
little to the right of `c`, producing points of `S` larger than `c` — impossible. -/
theorem ivt_from_completeness {f : ℝ → ℝ} (hf : Continuous f) {a b : ℝ} (hab : a ≤ b)
(ha : f a ≤ 0) (hb : 0 ≤ f b) : ∃ c ∈ Icc a b, f c = 0 := by
set S : Set ℝ := {x | a ≤ x ∧ x ≤ b ∧ f x ≤ 0} with hS
have hne : S.Nonempty := ⟨a, le_rfl, hab, ha⟩
have hbdd : BddAbove S := ⟨b, fun x hx => hx.2.1⟩
set c := sSup S with hc
have hac : a ≤ c := le_csSup hbdd ⟨le_rfl, hab, ha⟩
have hcb : c ≤ b := csSup_le hne fun x hx => hx.2.1
refine ⟨c, ⟨hac, hcb⟩, le_antisymm (not_lt.mp fun hpos => ?_) (not_lt.mp fun hneg => ?_)⟩
· -- `f c ≤ 0`: otherwise `f > 0` near `c`, and `c` would not be the least upper bound.
obtain ⟨δ, hδ, hfδ⟩ := Metric.continuous_iff.mp hf c (f c) hpos
obtain ⟨s, hsS, hs⟩ := exists_lt_of_lt_csSup hne (show c - δ < c by linarith)
have hsc : s ≤ c := le_csSup hbdd hsS
have hdist : dist s c < δ := by
rw [Real.dist_eq, abs_lt]; constructor <;> linarith
have := hfδ s hdist
rw [Real.dist_eq, abs_lt] at this
linarith [hsS.2.2]
· -- `0 ≤ f c`: otherwise `f < 0` just to the right of `c`, giving points of `S` beyond `c`.
have hcb' : c < b := lt_of_le_of_ne hcb (fun h => by rw [h] at hneg; linarith)
obtain ⟨δ, hδ, hfδ⟩ := Metric.continuous_iff.mp hf c (-f c) (by linarith)
set x := min (c + δ / 2) b with hx
have hcx : c < x := lt_min (by linarith) hcb'
have hdist : dist x c < δ := by
rw [Real.dist_eq, abs_lt]
constructor
· linarith
· have : x ≤ c + δ / 2 := min_le_left _ _
linarith
have hfx := hfδ x hdist
rw [Real.dist_eq, abs_lt] at hfx
have hxS : x ∈ S := ⟨by linarith, min_le_right _ _, by linarith⟩
have : x ≤ c := le_csSup hbdd hxS
linarith/-- The intermediate value theorem in Mathlib's general form: a function continuous on `[a, b]`
takes every value between `f a` and `f b`. This applies Mathlib's `intermediate_value_Icc`, which
holds for any connected interval in a densely ordered conditionally complete order. -/
theorem ivt_library {f : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b) (hf : ContinuousOn f (Icc a b)) :
Icc (f a) (f b) ⊆ f '' Icc a b :=
intermediate_value_Icc hab hf/-- **Extreme value theorem.** A function continuous on `[a, b]` (with `a ≤ b`) attains a maximum
there. This applies Mathlib's `IsCompact.exists_isMaxOn` to the compact interval `[a, b]`
(`isCompact_Icc`, Heine–Borel). -/
theorem extreme_value {f : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b) (hf : ContinuousOn f (Icc a b)) :
∃ c ∈ Icc a b, ∀ x ∈ Icc a b, f x ≤ f c := by
obtain ⟨c, hc, hmax⟩ := isCompact_Icc.exists_isMaxOn (nonempty_Icc.mpr hab) hf
exact ⟨c, hc, fun x hx => hmax hx⟩Uniform convergence, the ε/3 argument of Theorem 8, and Mathlib's version (which works over any topological space):
/-- `UniformlyConvergesOn f g S`: the functions `fₙ` converge to `g` *uniformly* on `S` — one `N`
works for every `x ∈ S` at once. Compare pointwise convergence, where `N` may depend on `x`. -/
def UniformlyConvergesOn (f : ℕ → ℝ → ℝ) (g : ℝ → ℝ) (S : Set ℝ) : Prop :=
∀ ε > 0, ∃ N : ℕ, ∀ n ≥ N, ∀ x ∈ S, |f n x - g x| < ε/-- **Uniform limits of continuous functions are continuous** (the ε/3 argument). Fix `x` and
`ε`. Choose `N` with `|f_N - g| < ε/3` everywhere, then `δ` with `|f_N y - f_N x| < ε/3` when
`|y - x| < δ`. Then
`|g y - g x| ≤ |g y - f_N y| + |f_N y - f_N x| + |f_N x - g x| < ε/3 + ε/3 + ε/3 = ε`. -/
theorem uniform_limit_continuous {f : ℕ → ℝ → ℝ} {g : ℝ → ℝ} (hf : ∀ n, Continuous (f n))
(hu : UniformlyConvergesOn f g univ) : Continuous g := by
rw [Metric.continuous_iff]
intro x ε hε
obtain ⟨N, hN⟩ := hu (ε / 3) (by linarith)
obtain ⟨δ, hδ, hfδ⟩ := Metric.continuous_iff.mp (hf N) x (ε / 3) (by linarith)
refine ⟨δ, hδ, fun y hy => ?_⟩
have h1 : |f N y - g y| < ε / 3 := hN N le_rfl y (mem_univ y)
have h2 : |f N y - f N x| < ε / 3 := by simpa [Real.dist_eq] using hfδ y hy
have h3 : |f N x - g x| < ε / 3 := hN N le_rfl x (mem_univ x)
rw [Real.dist_eq]
calc |g y - g x| = |(f N y - f N x) - (f N y - g y) + (f N x - g x)| := by ring_nf
_ ≤ |(f N y - f N x) - (f N y - g y)| + |f N x - g x| := abs_add_le _ _
_ ≤ |f N y - f N x| + |f N y - g y| + |f N x - g x| := by
gcongr; exact abs_sub _ _
_ < ε / 3 + ε / 3 + ε / 3 := by gcongr
_ = ε := by ring/-- Mathlib's uniform limit theorem: if `Fₙ → f` uniformly (along any filter, here `n → ∞`) and
the `Fₙ` are continuous, then `f` is continuous. This applies `TendstoUniformly.continuous`; its
proof passes through *locally* uniform convergence, which is all continuity needs. -/
theorem uniform_limit_continuous_library {X : Type*} [TopologicalSpace X] {F : ℕ → X → ℝ}
{f : X → ℝ} (h : TendstoUniformly F f atTop) (hc : ∀ n, Continuous (F n)) : Continuous f :=
h.continuous (Frequently.of_forall hc)The example : pointwise convergence to on , and a proof by Bernoulli's inequality that it is not uniform there:
/-- **Pointwise convergence of `xⁿ`.** For `0 ≤ x < 1`, `xⁿ → 0`. This applies Mathlib's
`tendsto_pow_atTop_nhds_zero_of_lt_one`. (At `x = 1` every term is `1`.) So on `[0, 1]` the
pointwise limit of the continuous functions `xⁿ` is `0` for `x < 1` and `1` at `x = 1`: it jumps. -/
theorem pow_pointwise {x : ℝ} (h0 : 0 ≤ x) (h1 : x < 1) :
ConvergesTo (fun n => x ^ n) 0 :=
(convergesTo_iff_tendsto _ 0).mpr (tendsto_pow_atTop_nhds_zero_of_lt_one h0 h1)/-- **`xⁿ → 0` is not uniform on `[0, 1)`.** Take `ε = 1/2`. Whatever `N` is proposed, let
`n = N + 1` and `x = 1 - 1/(2n)`. Bernoulli's inequality `(1 + t)ⁿ ≥ 1 + n t` (for `t ≥ -2`)
gives `xⁿ ≥ 1 - n/(2n) = 1/2`, so `|xⁿ - 0| < 1/2` fails. -/
theorem pow_not_uniform : ¬ UniformlyConvergesOn (fun n x => x ^ n) (fun _ => 0) (Ico 0 1) := by
intro h
obtain ⟨N, hN⟩ := h (1 / 2) (by norm_num)
set n : ℕ := N + 1 with hn
have hnpos : (0 : ℝ) < n := by positivity
set x : ℝ := 1 - 1 / (2 * n) with hx
have hx0 : 0 ≤ x := by
rw [hx, sub_nonneg, div_le_one (by positivity)]
have : (1 : ℝ) ≤ n := by rw [hn]; push_cast; linarith [N.cast_nonneg (α := ℝ)]
linarith
have hx1 : x < 1 := by
have : 0 < 1 / (2 * (n : ℝ)) := by positivity
rw [hx]; linarith
have hbern : 1 + (n : ℝ) * (-(1 / (2 * n))) ≤ (1 + -(1 / (2 * n))) ^ n := by
apply one_add_mul_le_pow
have : 1 / (2 * (n : ℝ)) ≤ 1 := by
rw [div_le_one (by positivity)]
have : (1 : ℝ) ≤ n := by rw [hn]; push_cast; linarith [N.cast_nonneg (α := ℝ)]
linarith
linarith
have hhalf : (1 : ℝ) / 2 ≤ x ^ n := by
have e1 : 1 + (n : ℝ) * (-(1 / (2 * n))) = 1 / 2 := by field_simp; ring
have e2 : (1 + -(1 / (2 * (n : ℝ)))) = x := by rw [hx]; ring
rw [e1, e2] at hbern
exact hbern
have := hN n (by omega) x ⟨hx0, hx1⟩
simp only [sub_zero] at this
rw [abs_of_nonneg (pow_nonneg hx0 n)] at this
linarithFinally integration. Mathlib's integral ∫ t in a..b, f t is the Lebesgue integral; for continuous it agrees with the Riemann integral. The first fundamental theorem is proved here by the estimate of Theorem 14, and the second is cited, together with the mean value theorem used in its proof:
/-- **Fundamental theorem of calculus, part 1.** If `f` is continuous, then `F(u) = ∫ₐᵘ f` is
differentiable with `F' = f`. Proof by an estimate, as in the lesson: given `c > 0`, continuity at
`x` gives `δ` with `|f t - f x| < c` for `|t - x| < δ`. For `|h| < δ`,
`F(x + h) - F(x) - h·f(x) = ∫ₓ^{x+h} (f t - f x) dt`, whose absolute value is at most `c·|h|`.
That is exactly the little-o condition defining the derivative. -/
theorem ftc_one {f : ℝ → ℝ} (hf : Continuous f) (a x : ℝ) :
HasDerivAt (fun u => ∫ t in a..u, f t) (f x) x := by
rw [hasDerivAt_iff_isLittleO_nhds_zero, Asymptotics.isLittleO_iff]
intro c hc
obtain ⟨δ, hδ, hfδ⟩ := Metric.continuous_iff.mp hf x c hc
rw [Metric.eventually_nhds_iff]
refine ⟨δ, hδ, fun h hh => ?_⟩
have hint : ∀ p q : ℝ, IntervalIntegrable f MeasureTheory.volume p q :=
fun p q => hf.intervalIntegrable p q
have key : (∫ t in a..x + h, f t) - (∫ t in a..x, f t) - h • f x
= ∫ t in x..x + h, (f t - f x) := by
rw [intervalIntegral.integral_interval_sub_left (hint _ _) (hint _ _),
intervalIntegral.integral_sub (hint _ _) intervalIntegrable_const,
intervalIntegral.integral_const, smul_eq_mul, smul_eq_mul]
ring
rw [key]
have hh' : |h| < δ := by simpa [Real.dist_eq] using hh
have hbound : ∀ t ∈ Set.uIoc x (x + h), ‖f t - f x‖ ≤ c := by
intro t ht
have htx : |t - x| ≤ |h| := by
rcases Set.mem_uIoc.mp ht with ⟨h1, h2⟩ | ⟨h1, h2⟩
· rw [abs_of_pos (by linarith), abs_of_pos (by linarith)]; linarith
· rw [abs_of_nonpos (by linarith), abs_of_neg (by linarith)]; linarith
have : dist t x < δ := by rw [Real.dist_eq]; linarith
have := hfδ t this
rw [Real.dist_eq] at this
rw [Real.norm_eq_abs]
exact this.le
calc ‖∫ t in x..x + h, (f t - f x)‖ ≤ c * |x + h - x| :=
intervalIntegral.norm_integral_le_of_norm_le_const hbound
_ = c * ‖h‖ := by rw [Real.norm_eq_abs]; ring_nf/-- The same statement as `ftc_one`, from Mathlib: `Continuous.integral_hasStrictDerivAt` gives
even *strict* differentiability of `u ↦ ∫ₐᵘ f`. -/
theorem ftc_one_library {f : ℝ → ℝ} (hf : Continuous f) (a x : ℝ) :
HasDerivAt (fun u => ∫ t in a..u, f t) (f x) x :=
(hf.integral_hasStrictDerivAt a x).hasDerivAt/-- **Mean value theorem.** If `f` is continuous on `[a, b]` and has derivative `f'` on `(a, b)`,
then `f' c = (f b - f a)/(b - a)` for some `c ∈ (a, b)`. This applies Mathlib's
`exists_hasDerivAt_eq_slope`, proved there from Rolle's theorem. -/
theorem mean_value {f f' : ℝ → ℝ} {a b : ℝ} (hab : a < b) (hfc : ContinuousOn f (Icc a b))
(hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) :
∃ c ∈ Ioo a b, f' c = (f b - f a) / (b - a) :=
exists_hasDerivAt_eq_slope f f' hab hfc hff'/-- **Fundamental theorem of calculus, part 2.** If `F` has derivative `f` at every point of
`[a, b]` and `f` is integrable there, then `∫ₐᵇ f = F b - F a`. This applies Mathlib's
`intervalIntegral.integral_eq_sub_of_hasDerivAt`. -/
theorem ftc_two {F f : ℝ → ℝ} {a b : ℝ} (hF : ∀ x ∈ uIcc a b, HasDerivAt F (f x) x)
(hint : IntervalIntegrable f MeasureTheory.volume a b) : ∫ x in a..b, f x = F b - F a :=
intervalIntegral.integral_eq_sub_of_hasDerivAt hF hint/-- **Every interval contains both rationals and irrationals.** This is why the indicator function
of `ℚ` (Dirichlet's function) is not Riemann integrable on `[0, 1]`: on every subinterval of every
partition its supremum is `1` and its infimum is `0`, so every upper sum is `1` and every lower sum
is `0`. Assembled from Mathlib's `exists_rat_btwn` (Archimedean property) and
`exists_irrational_btwn`. -/
theorem rationals_and_irrationals_dense {x y : ℝ} (h : x < y) :
(∃ q : ℚ, x < q ∧ (q : ℝ) < y) ∧ (∃ r : ℝ, Irrational r ∧ x < r ∧ r < y) :=
⟨exists_rat_btwn h, exists_irrational_btwn h⟩What is and is not formalised. Proved here from the definitions: uniqueness of limits, convergent ⇒ Cauchy, the subsequence step of the Cauchy criterion, monotone convergence (Theorem 1), the intermediate value theorem (Theorem 5), the uniform limit theorem (Theorem 8), the non-uniformity of , the first fundamental theorem (Theorem 14, for continuous ) and, in the solutions to the Lean exercises, the sum rule for limits. Cited from Mathlib: Bolzano–Weierstrass, completeness of , the extreme value theorem, the mean value theorem and the second fundamental theorem. Not formalised: Lemma 2, Heine–Cantor (in Mathlib as CompactSpace.uniformContinuous_of_continuous), Theorems 9–11, Weierstrass's function, and the non-integrability of . Mathlib has no separate theory of the Riemann integral on (its general BoxIntegral covers Riemann-type integrals on boxes), so for we formalise only the density facts the proof uses.
Measuring sup-distances, and a function with no tangent
Uniform convergence is a statement about one number per , the supremum . The program computes it for the examples of this lesson, exactly where calculus gives a closed form and on a fine grid as a cross-check. Watch three things: on , where the supremum never moves from ; the spikes , whose integrals tend to although at every point; and , which converges uniformly while its derivatives keep oscillating.
"""Pointwise versus uniform convergence: measuring sup-distances.
Uniform convergence of f_n to f on S means sup over S of |f_n - f| -> 0. We
measure that supremum for three classic sequences, using exact formulas where
calculus gives them and a fine grid as a cross-check:
1. x^n -> 0 pointwise on [0, 1), but the sup over [0, 1) is 1 for every n
(not uniform); on [0, 0.9] the sup is 0.9^n -> 0 (uniform).
2. h_n(x) = 2 n^2 x exp(-n^2 x^2) -> 0 pointwise on [0, 1], yet the integral
of h_n over [0, 1] is 1 - exp(-n^2) -> 1: limit and integral cannot be
swapped, and indeed sup h_n = sqrt(2) n exp(-1/2) blows up.
3. s_n(x) = sin(n x)/n -> 0 uniformly (sup = 1/n), but the derivatives
cos(n x) do not converge at x = pi: limit and derivative cannot be swapped.
Evidence: exact closed forms (derived in the docstrings) plus numerical grid
checks; the grid can only ever estimate a supremum from below.
"""
import math
def grid(a, b, points):
"""Equally spaced points from a to b inclusive (points >= 2)."""
if points < 2:
raise ValueError("need at least two points")
step = (b - a) / (points - 1)
return [a + i * step for i in range(points)]
def grid_sup(func, xs):
"""Largest |func(x)| over the sample points xs: a lower bound for the sup."""
return max(abs(func(x)) for x in xs)
def spike(n, x):
"""h_n(x) = 2 n^2 x exp(-n^2 x^2), a moving spike of area about 1."""
return 2 * n * n * x * math.exp(-(n * x) ** 2)
def spike_sup(n):
"""Exact sup of h_n on [0, 1]: at x = 1/(n sqrt 2), h_n = sqrt(2) n e^(-1/2)."""
return math.sqrt(2) * n * math.exp(-0.5)
def spike_integral(n):
"""Exact integral of h_n over [0, 1]: [-exp(-n^2 x^2)] from 0 to 1."""
return 1 - math.exp(-n * n)
def midpoint_integral(func, a, b, strips):
"""Composite midpoint rule, a numerical check of spike_integral."""
width = (b - a) / strips
return width * sum(func(a + (i + 0.5) * width) for i in range(strips))
def main():
xs = grid(0.0, 1.0, 20001)[:-1] # [0, 1) sampled
print("1. x^n -> 0 pointwise on [0, 1); is it uniform?")
print(" n sup on [0,0.9] grid sup on [0,1) exact sup on [0,1)")
for n in [1, 5, 20, 100, 1000]:
near = grid_sup(lambda x: x ** n, xs)
print(f"{n:5d} {0.9 ** n:14.3e} {near:17.6f} {1:18d}")
print(" On [0, 0.9]: uniform. On [0, 1): the sup stays 1, so not uniform.")
print()
print("2. Spikes h_n -> 0 pointwise on [0, 1], but their integrals do not")
print(" n h_n(1/2) sup h_n integral (exact) midpoint rule")
for n in [1, 2, 5, 10, 50]:
mid = midpoint_integral(lambda x: spike(n, x), 0.0, 1.0, 4000)
print(f"{n:5d} {spike(n, 0.5):9.2e} {spike_sup(n):7.2f}"
f" {spike_integral(n):16.6f} {mid:13.6f}")
print(" lim of integrals = 1, but integral of lim = 0.")
print()
print("3. sin(nx)/n -> 0 uniformly (sup = 1/n); derivatives cos(nx)")
for n in [1, 2, 3, 4, 10, 11]:
sup = grid_sup(lambda x: math.sin(n * x) / n, grid(0, math.pi, 2001))
print(f" n = {n:2d}: grid sup = {sup:.4f}, derivative at pi ="
f" {math.cos(n * math.pi):+.0f}")
print()
print("Epistemic status: the suprema and integrals in the 'exact' columns")
print("come from closed forms proved by calculus; the grid and midpoint")
print("columns are numerical cross-checks (a grid only bounds a sup from")
print("below). Finitely many n can illustrate, but not prove, what happens")
print("as n -> infinity; the proofs are in the lesson.")
if __name__ == "__main__":
main()Notice that the grid's estimate of is only about . A grid of points never gets close enough to . A grid can only bound a supremum from below, which is why the "exact" column comes from a proof. This is numerical illustration, not a proof of uniform or non-uniform convergence.
The second program evaluates Weierstrass's function at the points of Theorem 12. There the infinite tail can be summed exactly, so only cosines need floating point. The difference quotients at grow like , while those of the smooth partial sum shrink to .
"""Weierstrass's function: difference quotients at 0 that run away.
W(x) = sum over k >= 0 of a^k cos(b^k pi x), with a = 1/2 and b = 13, is a
uniform limit of smooth functions (Weierstrass M-test), hence continuous. At
the points h_m = 13^(-m) we can evaluate W exactly in closed form: for k >= m
the number b^k h_m = 13^(k-m) is an odd integer, so cos(b^k pi h_m) = -1 and
the infinite tail sums to -a^m/(1 - a). Only the first m terms need floating
point. The difference quotients D_m = (W(h_m) - W(0))/h_m then grow like
(ab)^m = 6.5^m, so W is not differentiable at 0. Every partial sum W_K is
smooth, and its quotients settle down to W_K'(0) = 0 instead.
Evidence: exact closed forms for the tail plus floating-point arithmetic for
finitely many terms; one point (x = 0) is examined, not every point.
"""
import math
A = 0.5
B = 13
def partial_sum(x, terms, a=A, b=B):
"""W_K(x): the first `terms` terms of the series (floating point)."""
return sum(a ** k * math.cos(b ** k * math.pi * x) for k in range(terms))
def w_at_zero(a=A):
"""W(0) = sum of a^k = 1/(1 - a), exactly."""
return 1 / (1 - a)
def w_at_power(m, a=A, b=B):
"""W(b^-m) for an odd integer b: m float terms plus the exact tail."""
if b % 2 == 0:
raise ValueError("b must be odd for the closed-form tail")
head = sum(a ** k * math.cos(math.pi / b ** (m - k)) for k in range(m))
tail = -(a ** m) / (1 - a) # cos(odd multiple of pi) = -1
return head + tail
def quotient(m, a=A, b=B):
"""D_m = (W(h) - W(0)) / h with h = b^-m."""
return (w_at_power(m, a, b) - w_at_zero(a)) * b ** m
def partial_quotient(m, terms, a=A, b=B):
"""Difference quotient of the smooth partial sum W_K at 0, h = b^-m."""
h = 1 / b ** m
return (partial_sum(h, terms, a, b) - partial_sum(0, terms, a, b)) / h
def main():
print("W(x) = sum (1/2)^k cos(13^k pi x); ab = 6.5 > 1 + 3pi/2")
print("Difference quotients at 0 with h = 13^-m:")
print(" m h D_m D_m / 6.5^m W_3 quotient")
for m in range(1, 9):
d = quotient(m)
p = partial_quotient(m, 3)
print(f"{m:3d} {B ** -m:10.3e} {d:12.4e} {d / 6.5 ** m:11.5f}"
f" {p:12.4e}")
print()
print("D_m / 6.5^m tends to a negative constant, so |D_m| -> infinity:")
print("W has no derivative at 0. The smooth partial sum W_3 behaves")
print("as calculus predicts: its quotients shrink to W_3'(0) = 0.")
print()
print("Epistemic status: the tail of the series is summed exactly, and")
print("only m cosines are computed in floating point, so these numbers are")
print("reliable; together with the lesson's estimate they prove that W is")
print("not differentiable at 0. They say nothing about other points:")
print("nowhere-differentiability needs Weierstrass's argument for every x.")
if __name__ == "__main__":
main()Here the computation and the proof of Theorem 12 tell the same story, and the computation's numbers are reliable to many digits. But it examines one point, . "Nowhere differentiable" is a statement about uncountably many points, and only Weierstrass's argument (or Hardy's) covers them all.
Explore: limits, tubes and spikes
ε and N. Shrink ε and see how far out you must go before every term of stays in the band around . The convergence is slow: the error is about .
(1 + 1/n)ⁿ → e: find N for each ε
Plot the terms aₙ and test a candidate limit with an ε-band: from some index on, every term must stay inside.
- term inside the band
- term outside the band
- band from L − ε to L + ε
a80 = 2.701485
From n = 27 on, all of the first 2,000 terms lie within ε = 0.05 of L = 2.71828.
Evidence, not proof: a computer can check only finitely many terms. A proof must show |aₙ − L| < ε for every n ≥ N.
Pointwise, not uniform. Increase . For any fixed the curve eventually drops below the line , but there are always points just left of where it is still above. No tube of width around the limit ever contains the whole graph.
xⁿ on [0, 1]: the threshold N depends on x
Move the sliders and trace along the curves to read off values.
- y = xⁿ
- y = 0.1
- y = xⁿ: y = 1
- y = 0.1: y = 0.1
Mass escaping into a spike. The shaded area under on stays close to , while the spike runs into the -axis and at every point.
Spikes: ∫hₙ → 1 but hₙ → 0 pointwise
Move the sliders and trace along the curves to read off values.
- hₙ(x)
- Signed area: above the axis counts as positive, below (hatched) as negative
- hₙ(x): y = 0.1465
- Signed area from 0 to 1 ≈ 0.9817 (numerical integration)
Upper and lower sums. For the continuous function on , compare the left and right sums (here, because is increasing, these are the lower and upper sums) as the number of strips grows. Their difference is exactly .
Riemann sums
Approximate the area under a curve with thin strips, and watch the error shrink as the strips get thinner.
- f(x) = x²
Left sum with 8 strips
L8 = 0.273438
Exact value of the integral
∫01 f(x) dx = 0.333333
Error (sum − integral)
−0.059896
All four rules with n = 8
| Rule | Sum | Error |
|---|---|---|
| Left (L8) | 0.273438 | −0.059896 |
| Right (R8) | 0.398438 | 0.065104 |
| Midpoint (M8) | 0.332031 | −0.001302 |
| Trapezoid (T8) | 0.335938 | 0.002604 |
Double n and watch the error: left and right sums roughly halve it, midpoint and trapezoid sums cut it to about a quarter.
Towards a curve with no tangent. These are partial sums of . Here , so by Hardy's theorem the full sum is nowhere differentiable. Each extra term adds smaller, faster wiggles. Zoom in on any part of the last curve and it still looks rough.
Partial sums of a Weierstrass function
Move the sliders and trace along the curves to read off values.
- 1 term
- 2 terms
- 3 terms
- 4 terms
- 1 term: y = 0
- 2 terms: y = 0
- 3 terms: y = 0
- 4 terms: y = 0
Exercises
1. Real analysis
Warm-upHumanWhich of these sequences converge (as )? Choose all that apply.
2. Real analysis
Warm-upHumanLet , which converges to . For , what is the smallest such that for every ?
3. Real analysis
CoreHumanEach sequence converges pointwise to on . Which converge uniformly on ? Choose all that apply.
4. Real analysis
CoreHumanThe extreme value theorem says: a continuous function on a closed bounded interval attains a maximum. Which example shows that the word closed cannot be dropped?
5. Real analysis
CoreHumanHere is a flawed proof that a pointwise limit of continuous functions is continuous at .
- Let .
- For each , choose with for .
- Let and choose with when .
- For : .
- Each of the three terms is less than , so .
Which step is wrong?
6. Real analysis
CoreFormalWhich Lean statement says that f n converges to g uniformly on the set S (and not merely pointwise)?
7. Real analysis
CoreHumanLet on and let split into equal pieces. What is the smallest for which ?
8. Real analysis
CoreComputationalThe proof of the intermediate value theorem can be turned into an algorithm by bisection (the nested-interval form of completeness). Write bisect(f, a, b, steps) which assumes f(a) <= 0 <= f(b) and returns the pair (lo, hi) after steps halvings: at each step let m = (lo + hi) / 2; if f(m) <= 0 replace lo by m, otherwise replace hi by m. The invariant f(lo) <= 0 <= f(hi) is kept, and hi - lo is halved each time.
9. Real analysis
StretchHumanWith the usual distance , in which of these sets does every Cauchy sequence converge to a point of the set? Choose all that apply.
10. Real analysis
StretchHumanLet on . Which statements are true? Choose all that apply.
Common misconceptions
Misconception
"A limit of continuous functions is continuous." Only if the convergence is uniform (or at least locally uniform). The functions are continuous on and their pointwise limit jumps at . Cauchy's 1821 "sum theorem" made exactly this mistake. More generally, never interchange two limits — versus , a limit and an integral, a limit and a derivative, two infinite sums — without a theorem that allows it. Theorems 8, 9 and 11 are such theorems. The examples , and show that each needs its hypothesis.
Misconception
"Every bounded function on is Riemann integrable." The indicator function of is bounded, but all its upper sums are and all its lower sums are . Lebesgue's criterion (below) says precisely which bounded functions are integrable: those whose points of discontinuity form a set of measure zero. is discontinuous everywhere.
Misconception
"If the terms get closer and closer together, the sequence converges." Consecutive terms getting close is not enough. The partial sums satisfy , yet . The Cauchy condition asks that all pairs of late terms be close, for all , and shows the harmonic series fails it.
Misconception
"Continuous functions are differentiable except at a few corners." Weierstrass's function is continuous and differentiable nowhere. Worse, by the Baire category theorem (Banach and Mazurkiewicz, 1931), in the space of continuous functions on with the sup-distance the nowhere-differentiable functions form a comeagre set — in the sense of category, "most" continuous functions are like Weierstrass's.
Misconception
"Convergence and uniform convergence differ only for weird functions." They differ already for , a smooth function with a smooth limit. And uniform convergence of says nothing about convergence of , as shows.
Many ways of seeing
Topology— Connectedness, compactness and completeness
The three big theorems on are topological theorems in disguise. The intermediate value theorem says that a continuous image of a connected space is connected (and the connected subsets of are the intervals). The extreme value theorem and Heine–Cantor say that is compact: every open cover has a finite subcover, equivalently (in metric spaces) every sequence has a convergent subsequence. Both are proved in point-set topology for general spaces.
Completeness, by contrast, is not a topological property. The interval is homeomorphic to (by ), yet is a Cauchy sequence in with no limit there. Completeness belongs to the metric, and in complete metric spaces it yields the Baire category theorem: a countable union of closed sets with empty interior has empty interior. Applied to the complete space , it shows that nowhere-differentiable functions are generic (Banach, 1931).
Analysis— Lebesgue: which functions are integrable, and when limits commute
Henri Lebesgue answered the question "which bounded functions are Riemann integrable?" exactly. Lebesgue's criterion: a bounded is Riemann integrable if and only if its set of discontinuities has measure zero (it can be covered by countably many intervals of total length less than any ). Thomae's function is discontinuous only on the countable set , so it is integrable; is discontinuous everywhere, so it is not.
Lebesgue's integral (1902) integrates (its integral is ) and, more importantly, comes with far better limit theorems. The dominated convergence theorem says: if pointwise and for one integrable , then — no uniformity needed. The spikes escape it, as they must: near , which is not integrable. See measure theory and, for the space with the sup norm as a complete normed space, functional analysis.
Probability— Rough paths and a probabilistic proof of approximation
Weierstrass's monster is the typical behaviour of randomness. The paths of Brownian motion are continuous and, with probability , nowhere differentiable (Paley, Wiener and Zygmund, 1933). Over a time step a Brownian path moves about , so its difference quotients are of size .
Probability also proves one of the best theorems about uniform approximation. Weierstrass approximation theorem: every continuous on is a uniform limit of polynomials. Sergei Bernstein's proof (1912) takes binomially distributed with parameters and , and sets
The law of large numbers (Chebyshev's inequality: ) and the uniform continuity of (Heine–Cantor) give .
Algebra— The only complete ordered field
To an algebraist, is characterised by a universal statement: every complete ordered field is isomorphic to , by a unique isomorphism. The proof sends , extends to , and uses suprema to extend to everything. Remove completeness and many other ordered fields appear. Examples are the real algebraic numbers, the field of rational functions ordered so that is larger than every real number (non-Archimedean: is a positive infinitesimal), and the hyperreal numbers of non-standard analysis. Every theorem of this lesson fails in some ordered field, because every proof used completeness. Completion also depends on the distance chosen: completing for the -adic absolute value gives the -adic numbers , where converges and a series converges as soon as its terms tend to .
Logic— How much does each theorem cost?
Logicians measure the strength of these theorems. In reverse mathematics, over the weak base theory RCA₀ ("computable mathematics"), the intermediate value theorem is provable outright. The Heine–Borel theorem for is equivalent to weak König's lemma (WKL₀). The Bolzano–Weierstrass theorem is equivalent to the much stronger arithmetical comprehension (ACA₀) — see Simpson's Subsystems of Second Order Arithmetic. In constructive analysis (Bishop, 1967), the exact intermediate value theorem cannot be proved, since there is no algorithm to decide on which side of the value at a midpoint lies. An approximate version holds: for every there is with . And Abraham Robinson's non-standard analysis (1961) makes Leibniz's infinitesimals rigorous using the compactness theorem of first-order logic.
History and global context
- Exhaustion. Archimedes (3rd century BCE) computed the area of a parabolic segment by squeezing it between inscribed and circumscribed polygons — the ancestor of upper and lower sums. Liu Hui (3rd century CE, China) bounded by the same kind of squeeze with polygons of sides.
- Infinite series in Kerala. Mādhava of Saṅgamagrāma (c. 1340 – c. 1425) and his school in Kerala found the power series of sine, cosine and arctangent, with estimates for the error of truncation. Their derivations are recorded in Jyeṣṭhadeva's Yuktibhāṣā (c. 1530).
- Calculus and its critics. Newton and Leibniz created the calculus in the 1660s–1680s. George Berkeley's The Analyst (1734) mocked infinitesimals as "ghosts of departed quantities", and no fully satisfactory answer came for a century.
- Rigour. Bernard Bolzano's 1817 paper proved the intermediate value theorem from a form of completeness, and his manuscripts (published only in the twentieth century) contain a continuous nowhere-differentiable function. Cauchy's Cours d'analyse (1821) and his later lectures founded analysis on limits; Abel (1826) found the counterexample to Cauchy's sum theorem. Christoph Gudermann (1838) used the phrase "uniform convergence", and Philipp Ludwig von Seidel and George Gabriel Stokes isolated the concept in 1847. Karl Weierstrass, Gudermann's student, made it central in his Berlin lectures of the 1860s, where the ε–δ style took its modern form.
- The integral. Bernhard Riemann defined his integral in his 1854 habilitation thesis on Fourier series (published 1868). Gaston Darboux (1875) gave the formulation by upper and lower sums used here, and Henri Lebesgue's 1902 thesis introduced the integral that superseded it.
- The real numbers. In 1872 Richard Dedekind (cuts), Georg Cantor (Cauchy sequences, following Charles Méray, 1869) and Eduard Heine published constructions of . In the same year Weierstrass presented his nowhere-differentiable function to the Berlin Academy; Paul du Bois-Reymond published it in 1875.
Further reading
- Stephen Abbott, Understanding Analysis (2nd edition, 2015) — the friendliest rigorous introduction; motivates every definition by an example like the ones above.
- Walter Rudin, Principles of Mathematical Analysis (3rd edition, 1976) — concise and complete; chapters 3, 4, 6 and 7 cover this lesson.
- Terence Tao, Analysis I and Analysis II (2006) — builds everything from the axioms, very close in spirit to a formal proof.
- David Bressoud, A Radical Approach to Real Analysis (1994; 2nd edition 2007) — the subject told through the historical crises (Fourier series, Cauchy's error) that created it.
- Michael Spivak, Calculus (1967) — calculus done rigorously, with outstanding exercises.