Metric spaces
Almost every definition in this course used only the distance \(|x - y|\). Strip away everything else, and keep just the rules distance obeys:
Definition
A metric on a set \(X\) is a function \(d(x, y) \ge 0\) with
- \(d(x, y) = 0\) exactly when \(x = y\);
- \(d(x, y) = d(y, x)\);
- \(d(x, z) \le d(x, y) + d(y, z)\) (the triangle inequality).
Now "\(x_n \to x\)" means \(d(x_n, x) \to 0\), and the definitions of continuity, Cauchy sequences and completeness carry over word for word. But the spaces can be wildly different from \(\mathbb R\).
The real payoff comes from spaces whose points are functions. On the continuous functions on \([a, b]\), set \(d(f, g) = \sup|f(x) - g(x)|\). Convergence in this metric is exactly the uniform convergence of Unit 11, and the Weierstrass approximation theorem says that polynomials are dense in this space, just as rationals are dense in \(\mathbb R\).
Open sets and compactness
A set \(U\) is open if around each of its points there is a small ball inside \(U\). It turns out that continuity can be described with open sets alone: \(f\) is continuous exactly when the preimage of every open set is open. Distances disappear entirely. Taking open sets as the basic notion gives topology, the study of shape up to stretching.
The hidden hero of this course is compactness. In \(\mathbb R\), the Heine–Borel theorem says these are equivalent for a set \(K\):
- \(K\) is closed and bounded;
- every sequence in \(K\) has a subsequence converging in \(K\) (Bolzano–Weierstrass, Unit 3);
- every cover of \(K\) by open sets has a finite subcover.
The extreme value theorem, the Heine–Cantor theorem and the integrability of continuous functions all came from compactness of \([a, b]\). In general metric spaces, the last two conditions remain equivalent and become the definition, but "closed and bounded" is no longer enough.
Going deeper: a closed, bounded set that isn't compact
In the space of continuous functions on \([0, 1]\) with the sup metric, consider the closed ball of radius 1 around 0. It's closed and bounded. But the sequence \(x^n\) from Unit 11 lies in it and has no uniformly convergent subsequence (any limit would have to be the discontinuous pointwise limit). So the ball isn't compact. Infinite-dimensional spaces are always like this: compactness becomes rare and precious. The Arzelà–Ascoli theorem says exactly which sets of functions are compact.
Completeness as a tool
Completeness (Unit 3) says Cauchy sequences converge. In a complete metric space it gives one of the most used theorems in mathematics:
Banach fixed point theorem
If \(X\) is complete and \(T: X \to X\) shrinks distances by a fixed factor, \(d(Tx, Ty) \le k\,d(x, y)\) with \(k < 1\), then \(T\) has exactly one fixed point, and iterating \(T\) from any starting point converges to it.
The iterates form a Cauchy sequence, because each step is at most \(k\) times the last: a geometric series. This is the cobweb picture of Unit 3, promoted to any complete space. Applied to a space of functions, it proves that differential equations like \(y' = F(x, y)\) have unique solutions (the Picard–Lindelöf theorem): the solution is the fixed point of the map \(y \mapsto y_0 + \int F(t, y(t))\,dt\).
Measuring sets
How long is a set of real numbers? For an interval, the length. For a countable set, 0 (Unit 9: cover the points by intervals of total length \(\varepsilon\)). Lebesgue extended "length" to a vast family of sets, the measurable sets, so that the measure of a countable disjoint union is the sum of the measures. The surprises start immediately.
Yet the Cantor set is uncountable: its points are exactly the numbers whose base 3 expansion uses only the digits 0 and 2, and Cantor's diagonal argument from Unit 1 applies. So "measure zero" and "countable" are different ideas: a set can be as large as \(\mathbb R\) in cardinality and have no length at all.
Going deeper: sets that can't be measured
Can every subset of \(\mathbb R\) be given a length that behaves well? No. Vitali showed in 1905, using the axiom of choice, that there is a subset of \([0, 1]\) with no sensible length: countably many shifted copies of it fill an interval, so its length would have to be both 0 and positive. In three dimensions things get stranger still: the Banach–Tarski paradox cuts a ball into five pieces that can be reassembled into two balls of the same size. The pieces are non-measurable, which is why volume isn't conserved.
The Lebesgue integral
Riemann chops the \(x\)-axis into strips. Lebesgue chops the \(y\)-axis: for each height range, measure the set of \(x\) where \(f\) takes values in that range, and add up height times measure. Lebesgue compared it to counting money: Riemann adds up the coins in the order they come out of your pocket; Lebesgue sorts them by value first.
The Lebesgue integral agrees with Riemann's whenever both exist, but handles far more functions (Dirichlet's function now has integral 0, since the rationals have measure 0). Above all, it has excellent limit theorems:
Dominated convergence theorem
If \(f_n \to f\) pointwise (or even just outside a set of measure zero), and \(|f_n| \le g\) for a single integrable \(g\), then \(\int f_n \to \int f\).
No uniformity required. The spikes of Unit 11 escape only because no integrable \(g\) sits above them all. This theorem is why the Lebesgue integral underpins probability theory, quantum mechanics and modern analysis.
Fourier series
In 1807 Fourier claimed that any function on \([0, 2\pi]\), even one with jumps, can be written as a sum of sines and cosines:
\[ f(x) = \frac{a_0}2 + \sum_{n=1}^\infty \big(a_n\cos nx + b_n\sin nx\big), \qquad a_n = \frac1\pi\int_0^{2\pi} f(x)\cos nx\,dx, \;\; b_n = \frac1\pi\int_0^{2\pi} f(x)\sin nx\,dx. \]Making sense of Fourier's claim drove much of this course into existence: Dirichlet's precise notion of a function, Riemann's integral, uniform convergence, Cantor's set theory (born from studying where Fourier series can fail) and Lebesgue's integral. The cleanest answer uses Lebesgue's theory: for every square-integrable \(f\), the Fourier series converges to \(f\) in the sense of average squared error, and
\[ \frac1\pi\int_0^{2\pi} f^2 = \frac{a_0^2}{2} + \sum_{n=1}^\infty (a_n^2 + b_n^2) \quad\text{(Parseval)}. \]Applied to \(f(x) = x\) on \((-\pi, \pi)\), Parseval gives \(\sum \frac1{n^2} = \frac{\pi^2}6\), the Basel problem that Euler solved in 1734.
What to study next
The directions from here:
- Complex analysis. Differentiate with complex numbers and the theory becomes astonishingly rigid and beautiful: one derivative implies infinitely many, every such function equals its Taylor series, and integrals around closed loops compute real integrals. The companion course tells the story in the same style.
- Measure theory and integration. Lebesgue's theory in full, and probability built on it.
- Functional analysis. Linear algebra in infinite-dimensional spaces of functions: Banach and Hilbert spaces. It joins this course with linear algebra.
- Topology. Open sets, compactness and connectedness, freed from distance.
- Differential equations and harmonic analysis. Where the fixed point theorem and Fourier series do their work.
Further reading
Stephen Abbott, Understanding Analysis: the friendliest rigorous introduction. Walter Rudin, Principles of Mathematical Analysis: terse and classic. David Bressoud, A Radical Approach to Real Analysis: the subject told through its history, starting from Fourier. Tristan Needham, Visual Complex Analysis: the natural next step in the visual style of this course.
Practice set
Mixed questions covering the whole unit. Try each one before opening the answer.
1. On any set, let \(d(x, y) = 1\) if \(x \neq y\) and 0 if \(x = y\). Is this a metric? Which sequences converge?
Show answer
Yes: the triangle inequality holds since the right side is at least 1 whenever the left side is 1. A sequence converges only if it is eventually constant, because \(d < \frac12\) forces equality.
2. Is \((0, 1)\) compact? Give a sequence with no subsequence converging in the set.
Show answer
No. \(\frac1n\) lies in \((0, 1)\), and every subsequence converges to 0, which isn't in the set.
3. Show \(T(x) = \frac x2 + 1\) is a contraction on \(\mathbb R\) and find its fixed point.
Show answer
\(|Tx - Ty| = \frac12|x - y|\), so \(k = \frac12\). Solving \(x = \frac x2 + 1\) gives \(x = 2\). Iterating from 0: 1, 1.5, 1.75, … \(\to 2\).
4. Is \(\frac14\) in the Cantor set?
Show answer
Yes. In base 3, \(\frac14 = 0.020202\ldots\), using only 0s and 2s. It's never in a removed middle third, yet it's not an endpoint of any remaining interval.
5. What is the Lebesgue measure of the set of irrational numbers in \([0, 1]\)?
Show answer
1. The rationals are countable, so they have measure 0, and the measure of \([0, 1]\) is 1.
6. At \(x = \frac\pi2\), the square wave series gives \(1 = \frac4\pi\left(1 - \frac13 + \frac15 - \cdots\right)\). Which famous series is this?
Show answer
\(\sin\frac{(2k + 1)\pi}{2} = (-1)^k\), so it says \(1 - \frac13 + \frac15 - \cdots = \frac\pi4\): the Madhava–Leibniz series from Unit 11.
Summary and glossary
- Metric spaces carry the ideas of this course to any set with a distance, including spaces of functions.
- Compactness was the engine behind the EVT and Heine–Cantor; in infinite dimensions it becomes rare.
- Completeness gives the Banach fixed point theorem, and with it existence for differential equations.
- Lebesgue measure assigns length to sets; the Cantor set is uncountable yet has measure 0.
- The Lebesgue integral has powerful limit theorems; Fourier series motivated nearly all of this.
- Metric
- A distance function obeying symmetry and the triangle inequality.
- Open set
- A set containing a small ball around each of its points.
- Compact
- Every sequence has a subsequence converging inside the set.
- Contraction
- A map that shrinks all distances by a fixed factor \(k < 1\).
- Lebesgue measure
- The extension of length to a wide family of subsets of \(\mathbb R\).
- Fourier series
- An expansion of a function into sines and cosines.