Book I · Principles of Mathematical Analysis
Part 1 of 10The Real Numbers and the Shape of Space
What is a real number, and what must a set be like for every infinite process inside it to land somewhere?
In 1807 Fourier claims that a sawtooth is a sum of sines, and Lagrange objects: the part opens with the questions that claim raised about limits, functions and numbers. The rational line is dense and still full of holes; Rudin's map p to (2p + 2)/(p + 2) shows that the rationals below the square root of 2 have no largest element. Dedekind's cuts fill the holes, and the least-upper-bound property gives the Archimedean property, decimals, nested intervals and the bisection engine. Cantor's zigzag and diagonal separate the countable rationals from the uncountable reals. Then the part turns from numbers to space: metric spaces, open and closed sets, and compactness as a game of open covers, which Heine-Borel wins on closed bounded sets by bisection and loses on (0, 1]. The Cantor set and the connected subsets of the line follow, and the part ends with a warning: in C[0, 1] the closed unit ball is closed and bounded but not compact.
What you need. Calculus, and some practice in reading and writing proofs (sets, functions, induction, proof by contradiction).
What you will be able to do
Undergraduate
- Prove that no rational has square 2 and that the rationals with square below 2 have no largest element, using the map p to (2p + 2)/(p + 2).
- Decide whether a given subset of the line or the plane is open, closed, bounded, compact or connected, and justify the answer from the definitions.
- Run Cantor's diagonal argument and explain why it shows the reals are uncountable.
Graduate
- Construct the real numbers by Dedekind cuts and prove that the supremum of a bounded set of cuts is their union.
- Prove Heine-Borel by bisection and point to the step that fails on (0, 1].
Qualifying exam
- Prove that a nonempty perfect set in Euclidean space is uncountable, and apply it to the Cantor set.
- Show that the closed unit ball of C[0, 1] is not compact by exhibiting functions pairwise at sup distance 1.
Applications
- Implement bisection in exact arithmetic and state the error after k steps.
- Compute a sup distance between two functions numerically and say which metric a given approximation problem is using.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 41 min · Graduate 56 min · Qualifying exam 58 min · Applications 41 min.
- 0Fourier's question, and the holes in the fractionsUndergraduate5 min
- 1Holes in the rational lineUndergraduate6 min
- 2Filling the holes: Dedekind cutsGraduate6 min
- 3Archimedes, density and decimalsUndergraduate4 min
- 4Counting infinitiesUndergraduate5 min
- 5What “close” means: metric spacesUndergraduate5 min
- 6Open and closed setsUndergraduate6 min
- 7CompactnessUndergraduate4 min
- 8Heine–Borel, by bisectionUndergraduate4 min
- 9The Cantor setGraduate5 min
- 10ConnectednessGraduate4 min
- 11A first space of functionsQualifying exam3 min
- Recap, and the first row of the ledgerAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.
Fourier's question, and the holes in the fractionsUndergraduate5 min
In 1807, Joseph Fourier submitted a memoir on how heat flows through a solid body. Buried in it was a claim that took mathematics a century to digest. Take a function with a corner, or even a jump, like this sawtooth. Fourier said that it can be written as a sum of sine waves.
Here's the recipe. Start with sine of x. Add sine of 2x, over 2. Then sine of 3x over 3, and keep going, with sine of k x over k. Each wave is perfectly smooth.
And yet, as we add more of them, the sum hugs the sawtooth more and more closely: the straight edges, and even the sudden jump. Written out, the claim is that pi minus x, over 2, equals the infinite sum of sine k x over k, for every x strictly between 0 and 2 pi.
Now look closely at the jump, and the questions start. Every one of these partial sums is smooth: you can differentiate it as often as you like. But the thing they approach is not even continuous. So a limit of continuous functions can fail to be continuous.
At the jump itself, every partial sum equals zero, exactly halfway between the two sides. And right next to the jump, the partial sums overshoot. Add more terms, and the overshoot gets narrower, but not lower: it settles at about nine percent of the size of the jump. We'll prove that in Part 3.
Lagrange, one of the mathematicians who read Fourier's memoir, objected: a sum of smooth waves ought to be smooth. The arguments that followed took most of the nineteenth century, and they forced mathematicians to say exactly what a limit is, what a function is, and what an integral is. Georg Cantor invented set theory while studying these series. And at the bottom of it all, they had to say what a number is.
Here's why. An infinite sum is a limit: we add terms, and ask what the partial sums approach. But a limit needs a place to land. These are the rational numbers, the fractions, drawn as a ruler: each fraction gets a tick, and fractions with smaller denominators get taller ticks. Now take the numbers 1, 1.4, 1.41, 1.414, each one the square root of two cut off one digit later.
Zoom in, and they crowd closer and closer together, closing in on a spot. But no fraction sits there. The square of a fraction is never exactly two, so if fractions were the only numbers we had, these numbers would have nothing to approach. The rational numbers have holes.
This video is Part 1 of a series that builds analysis from those holes all the way to functional analysis: the mathematics of infinite-dimensional spaces, which is where Fourier's question finally gets its full answer. The route follows Walter Rudin's three classic textbooks: Principles of Mathematical Analysis, Real and Complex Analysis, and Functional Analysis. Every theorem we use, we prove on screen.
One idea runs through the whole series. Continuity, derivatives, integrals and infinite sums are all limits, and almost every theorem we'll prove answers a single question: when may we swap the order of two limits? Here's the simplest example of what goes wrong. Take m over m plus n. Send n to infinity first, and every row goes to zero, so the answer is zero. Send m to infinity first, and every column goes to one. Same numbers, different order, different answer.
Fourier's sum is exactly this kind of question. Is the integral of the sum the sum of the integrals? Each new space in this series is invented to make one more swap like this legal.
We'll keep a ledger. Each part adds one row: a new space, the reason it has no holes, what compactness means there, which limits we've earned the right to swap, and how far we've gotten with Fourier. Today's row is the first: the real numbers.
Here's the plan for today. We'll find the holes in the rational numbers and fill them, in a way that makes having no holes a theorem. We'll count infinities. Then we'll step back and ask what close means in general, which gives us the vocabulary of everything that follows: open sets, compact sets and connected sets. And we'll end with a warning: the very first space of functions we meet already breaks one of today's best theorems.
What it establishes: Fourier's sawtooth as a sum of sines; a limit of smooth functions with a jump; every partial sum is 0 at the jump; the 8.95% overshoot. Lagrange's objection and the questions that followed (limit, function, integral, number). The sequence 1, 1.4, 1.41, … has nowhere to land in Q. The series and its ten parts; the thesis (when may two limits be swapped? m/(m + n), Rudin 7.2); the ledger.; Computed on screen: Partial sums of Σ sin(kx)/k up to n = 200; the overshoot checked against Si(π) at n = 5000; the rationals in windows down to width 2.5 × 10⁻⁶ around √2.
1Holes in the rational lineUndergraduate6 min
We start with what we have: the rational numbers. The rational numbers are the fractions p over q, where p and q are whole numbers and q is not zero. You can add, subtract, multiply and divide them, except by zero, and the familiar rules hold. In Rudin's language, they form a field. You can also compare them, and the order plays well with the arithmetic: adding the same number to both sides of an inequality keeps it true, and a product of positive numbers is positive. An ordered field.
Between any two fractions there's another one: their average. Between five quarters and three halves sits eleven eighths; between five quarters and eleven eighths sits twenty-one sixteenths, and so on forever. So the fractions are dense: zoom in anywhere, and there are more of them.
But be careful with this picture. The line I'm drawing the ticks on is already the real line, the thing we haven't built yet. The rationals are only the ticks. Is there a gap between them? You can't see one at any zoom, because there's always another tick nearby. A hole in the rationals only shows up when we ask about limits, or, as Rudin does at the very start of his book, about bounds.
First, the oldest fact in the subject: no fraction squares to two. Suppose p over q, in lowest terms, did. Then p squared is twice q squared, so p squared is even, and therefore p is even: p is 2r for some whole number r. Then four r squared equals two q squared, so q squared is twice r squared, and q is even too. But we said the fraction was in lowest terms. So it can't exist.
Rudin makes this sharper. Color every positive fraction by which side of the missing square root it falls on. Let A be the positive fractions whose square is less than two, and B the ones whose square is more than two. The theorem: A has no largest element, and B has no smallest element.
The proof is a single clever formula. Given a positive fraction p, define q as p minus p squared minus two, over p plus two. Over a common denominator that's 2p plus 2, over p plus 2: another fraction. And if you square it and subtract two, you get two times p squared minus two, over p plus two squared. That has the same sign as p squared minus two.
Now read it off. If p is in A, then p squared minus two is negative, so we subtracted a negative number: q is bigger than p. And q squared is still less than two, so q is in A. A bigger element of A, every time. If p is in B, everything flips: q is smaller than p, and still in B.
Watch it run. Start at one, in A. One hops to four thirds, four thirds hops to seven fifths, then twenty-four seventeenths, then forty-one twenty-ninths. Every hop lands in A again, a little higher, and the squares creep up toward two without ever reaching it.
From above it's the mirror image. Two hops down to three halves, then ten sevenths, then seventeen twelfths: always in B, always smaller, never reaching the bottom.
This is a statement about bounds. A number beta is an upper bound of a set E if everything in E is at most beta. And alpha is the least upper bound, the supremum, written sup E, if it's an upper bound, and nothing smaller is one.
A supremum doesn't have to belong to the set. The fractions below one have supremum one, which is not below one. The set one, a half, a third, and so on, has supremum one, which it contains.
Now apply this to A. Every element of B is an upper bound of A. And there are no others: an upper bound whose square was less than two would itself be in A, and A always has something bigger. So, in the rationals, the upper bounds of A are exactly the elements of B, and B has no smallest element. The set A is bounded above, and yet it has no least upper bound. That's the hole, stated without pictures.
So here's the property we want. An ordered set has the least-upper-bound property if every nonempty subset that is bounded above has a supremum. The rationals don't have it; that's the precise meaning of the rationals have holes. And the first big theorem of the subject says we can fix it: there is an ordered field, the real numbers, that has the least-upper-bound property and contains the rationals. Next, we build it out of nothing but fractions.
What it establishes: Q as an ordered field; density by averages; the picture is the real line, Q is only the ticks. √2 is irrational. Rudin 1.1: A = {p² < 2} has no largest element, B no smallest, by q = (2p + 2)/(p + 2) and q² − 2 = 2(p² − 2)/(p + 2)². Upper bounds, sup; the upper bounds of A in Q are exactly B, so sup A does not exist in Q. The least-upper-bound property; Rudin 1.19.; Computed on screen: The hops 1 → 4/3 → 7/5 → 24/17 → 41/29 and 2 → 3/2 → 10/7 → 17/12 in exact fractions, with their squares; the ruler colored by the sign of p² − 2q² (exact integers).
2Filling the holes: Dedekind cutsGraduate6 min
How do you fill a hole, using nothing but the things around it? In 1872, Richard Dedekind had the idea: describe a number by the set of all the fractions below it.
Here's his definition, as Rudin gives it. A cut is a set of fractions, call it alpha, with three properties. First, it isn't empty, and it isn't everything. Second, it's closed downward: if p is in alpha, so is every fraction smaller than p. Third, it has no largest element.
Picture it as a way of coloring the fractions: blue for the ones in the cut, orange for the rest. This one is the cut of one half: every fraction strictly below one half. Condition two says the blue part runs all the way to the left: once a fraction is blue, everything to its left is blue too.
Condition three is bookkeeping. Zoom in at one half. The fraction one half itself is orange, left out, and blue fractions crowd up to it from below with no last one. Without condition three, one half would have two cuts, with and without the endpoint; this way every fraction gets exactly one.
Now the interesting one. Color blue every fraction that's negative or squares to less than two. Is this a cut? It's clearly not empty, not everything, and closed downward. And it has no largest element: that's exactly the theorem from chapter one, the hop that always finds a bigger element. This cut sits precisely where the hole was. Dedekind's move is to declare that this set is a number.
So: a real number is a cut, and the real line is the set of all cuts. To compare two of them, compare the sets: alpha is less than beta when alpha is a proper subset of beta. Drawn as blue rays, the cut of one half sits inside the cut of root two, so one half is smaller.
For this to be an order, any two cuts must be comparable: one must contain the other. The proof takes three lines. Suppose alpha is not inside beta, so some p is in alpha but not in beta. Then every q in beta is less than p, because if q were at least p, condition two would put p in beta. And then, by condition two for alpha, every q in beta is in alpha: beta is inside alpha.
Now the payoff: the least-upper-bound property. Take any collection of cuts that is bounded above, like the cuts of one, one point four, one point four one, and so on. Each one is a blue ray, and each contains the one before.
Dedekind's answer for the supremum is almost embarrassingly simple: take the union of all of them. Every fraction that is in at least one of the cuts. Here, that union is every fraction that is negative or squares to less than two: the cut of root two. The hole has been filled by the union of the cuts approaching it.
In general, let script A be any nonempty set of cuts, bounded above by some cut beta, and let gamma be their union. Gamma isn't empty, and it sits inside beta, so it isn't everything. It's closed downward, because each of the cuts is. It has no largest element, because any p in gamma lies in some cut, which has something bigger. So gamma is a cut.
It contains every cut in the collection, so it's an upper bound. And it's the least one: if delta is smaller than gamma, some p in gamma is missing from delta, and that p came from a cut alpha, which therefore isn't inside delta. So delta is not an upper bound. The whole difficulty of the real numbers dissolves into one line of set theory: the supremum is the union.
Then comes arithmetic, and it's mostly routine. To add two cuts, add their elements in every possible way. Zero is the cut of the negative fractions, and you can check that adding it changes nothing. Multiplication is defined first for positive cuts, then extended by cases of sign. Rudin checks the field rules one by one; it's tedious and teaches nothing new, so we'll trust it. And the rationals sit inside, each fraction r becoming the cut of fractions below it, in a way that respects sums, products and order.
That's Rudin's theorem: there is an ordered field with the least-upper-bound property, containing the rationals. And, as Rudin remarks, it's unique: any two such fields are the same up to renaming. There's a second classic construction, by Méray and Cantor, from the same years. A real number is a sequence of fractions that bunches up, a Cauchy sequence, with two sequences counting as the same number when their difference goes to zero, like the decimals and the hops for root two.
That second construction is the one this series will reuse. Whenever a space has holes, and the spaces of functions we meet later will, we fill them with the space's own Cauchy sequences. From here on, though, we can forget how the reals were built. Everything we need follows from one fact: every nonempty set that is bounded above has a least upper bound.
What it establishes: Dedekind cuts (I)–(III); (1/2)* and the cut of √2, whose condition (III) is Rudin 1.1. R = all cuts, ordered by inclusion; totality in three lines. sup = union: the five-step proof. Arithmetic, 0*, the embedding r ↦ r*. Rudin 1.19 (existence and uniqueness). Cantor–Méray: two Cauchy sequences for √2 whose difference → 0.; Computed on screen: The cuts drawn from their exact rational members; the decimals and hops of √2 and their differences.
3Archimedes, density and decimalsUndergraduate4 min
The real numbers have no holes. What does that buy us? Three things we'll use constantly.
First, the Archimedean property. Pick any positive x, however tiny, and any y, however large. Then some whole-number multiple of x passes y.
It sounds obvious, but it's a consequence of having no holes. Suppose it failed: every multiple of x stays at or below y. Then the multiples are bounded above, so they have a least upper bound, alpha. Alpha minus x is smaller than alpha, so it isn't an upper bound: some multiple, m x, is bigger than alpha minus x. But then the next one, m plus one times x, is bigger than alpha, which was supposed to be an upper bound. Contradiction.
That's a genuine theorem, not a triviality: there are ordered fields, with infinitely small elements, where it fails. The real numbers are not one of them.
Second: the rationals are dense in the reals. Between any two different reals, however close, sits a fraction. Take x as root two minus one, and y as 0.45. A ruler with marks every quarter can miss the gap entirely. But by the Archimedean property, we can choose n so that n times the gap is bigger than one: here n is 28. Then the marks of a ruler spaced one over n apart are closer together than x and y, so one of them must land in between: twelve twenty-eighths, which is three sevenths.
Third: the hole at root two really is filled. In the reals, let A be the positive numbers whose square is less than two. It's bounded above, by two for instance, so it has a supremum. Call it y. Is y squared equal to two?
Use chapter one's hop again, now on real numbers. If y squared were less than two, the hop would give a bigger number that's still in A, so y wouldn't be an upper bound. If y squared were more than two, the hop would give a smaller upper bound, so y wouldn't be the least one. Only one option is left: y squared is two. The argument that showed the rationals have a hole, run in the reals, shows the reals don't.
Decimal expansions are really a statement about nested intervals. Root two lies between 1 and 2; between 1.4 and 1.5; between 1.41 and 1.42, and so on: each digit picks one of ten smaller intervals inside the last one.
Keep zooming and the intervals keep shrinking, by a factor of ten each time, pinning down a single point.
That a point is actually there is, again, the least-upper-bound property. If closed intervals are nested, each inside the last, then the left endpoints are bounded above by every right endpoint, so they have a supremum x, and x lies in every interval.
Both hypotheses matter. The open intervals from zero to one over n are nested and never empty, but no number lies in all of them: zero is excluded from each, and anything positive is eventually left out. And in the rationals, the decimal intervals of root two have no fraction in common.
Halving instead of cutting into tenths gives the same thing with a clearer rule: split the interval in two and keep the half that still contains the point you're hunting, here the half where t squared minus two changes sign. This bisection engine will prove a surprising number of theorems in this series: the intermediate value theorem, Bolzano–Weierstrass, Heine–Borel, and more. Every time, the least-upper-bound property guarantees there's a point at the bottom of the funnel.
What it establishes: The Archimedean property (1.20) by contradiction with α = sup{nx}. Density of Q: a ruler with spacing 1/28 < 0.45 − (√2 − 1) must land inside. √2 exists: y = sup A, and both y² < 2 and y² > 2 contradict the hop. Decimals as nested intervals; the nested-interval theorem via sup aₙ; why both "closed" and "complete" matter. The bisection engine.; Computed on screen: 40 digits of √2 by integer square roots, every decimal interval asserted to contain it; 30 bisection steps in exact dyadics.
4Counting infinitiesUndergraduate5 min
The rationals are dense: they're everywhere. So are there really more real numbers than fractions? To answer, we need a way to compare the sizes of infinite sets.
Two sets have the same size when their elements can be paired off, one to one, with nothing left over on either side. Infinite sets do strange things under this rule. The whole numbers can be paired with the even numbers, one with two, two with four, three with six, even though the evens are only half of them. A set is countable if it can be paired with the whole numbers, which is the same as saying its elements can be listed, first, second, third, forever. An infinite set that can't be listed is uncountable.
The integers are countable: list zero, then one, minus one, two, minus two, and so on. Every integer gets a place.
The positive fractions are countable too, which is more surprising, since they're dense. Lay them out in a grid: p over q, with p across and q down. Every positive fraction appears somewhere, many of them several times. Now walk the grid along its diagonals, zigzagging back and forth, and number each fraction as you reach it, skipping any you've already counted, like two over two, which is one.
The result is a list: one, a half, two, three, a third, a quarter, two thirds, and on, in which every positive fraction appears exactly once. Add zero and the negatives by interleaving, as we did for the integers, and all of Q is countable. The dense dust of chapter one is just a list.
The same zigzag proves something more general. Take countably many countable sets, E one, E two, E three, and so on, and write each as a row. Walking the diagonals lists every element of every row. So a countable union of countable sets is countable. It's a tool we'll use again and again, for instance when we measure sets in Part 5.
So is everything countable? Here's Cantor's diagonal argument, from 1891. Consider infinite sequences of zeros and ones. Suppose someone hands us a list of them, s one, s two, s three, and so on, claiming it contains every such sequence. Look at the diagonal: the first digit of the first sequence, the second digit of the second, and so on.
Now build a new sequence s by flipping every diagonal digit: zero becomes one, one becomes zero. Then s differs from the first sequence in the first place, from the second in the second place, and from the k-th sequence in the k-th place. So s is not on the list. Any list misses something: the zero-one sequences are uncountable.
It follows that the real numbers are uncountable. Turn each zero-one sequence into a real number by reading it as digits in base three, with the ones written as twos. We use base three and only the digits zero and two to dodge the trap where two expansions name the same number, like 0.4999 forever and 0.5. If two sequences first differ at place n, their numbers differ by at least two over three to the n, minus everything the later digits can make up, which is one over three to the n, more than zero. So different sequences give different numbers, and the reals contain an uncountable set.
This has a startling consequence. A number is algebraic if it solves a polynomial equation with integer coefficients, like root two, which solves x squared minus two equals zero. There are only countably many such polynomials, since each is a finite list of integers, and each has finitely many roots. So the algebraic numbers are countable, by the theorem on unions. That was Cantor's 1874 result. Since the reals are not countable, almost every real number is transcendental: not the root of any such polynomial.
And yet exhibiting even one is hard. The first explicit example came from Liouville in 1844; e was proved transcendental in 1873, and pi only in 1882. The rationals are dense, yet countable: in the sense of size, they're almost nothing, and the numbers that fill the holes are almost everything.
What it establishes: Pairings; countable; Z; the zigzag through p/q (skipping repeats) lists Q; countable unions (2.12); the diagonal (2.14); s ↦ Σ 2sₖ/3ᵏ is one-to-one, so R is uncountable; algebraic numbers are countable, so almost every real is transcendental (Cantor 1874; Liouville, Hermite, Lindemann).; Computed on screen: The first 40 rationals in zigzag order; a seeded 12 × 16 table of 0–1 sequences and its flipped diagonal, asserted different from every row.
5What “close” means: metric spacesUndergraduate5 min
So far everything has lived on a line. But the point of this series is to treat functions as points in a space, with distances between them. So we need to ask what a distance has to be.
Start with the familiar case. Points of k-dimensional space are lists of k real numbers, which we can add and scale like arrows. The inner product multiplies coordinates and adds, and the length of x is the square root of x dotted with itself.
The one inequality that makes all of this work is Cauchy–Schwarz: the inner product of x and y is at most the product of their lengths. Here's the picture behind the proof. Drop x onto the line through y: that gives x's shadow on y. The gap between x and its shadow is an honest vector, so its length squared can't be negative. That's the whole proof; the rest is algebra.
Call the length of y squared B, and the inner product C. Then B x minus C y is B times the gap, so its length squared is at least zero. Expand it. Substitute C for the inner product and B for y's length squared, and factor out B. Since B is positive, the inner product squared is at most the product of the squared lengths. That's Cauchy–Schwarz.
Cauchy–Schwarz immediately gives the triangle inequality. Expand the length of x plus y squared; bound the middle term by Cauchy–Schwarz; and what's left is a perfect square. The side of a triangle is never longer than the other two sides together.
In 1906, Maurice Fréchet turned this into a definition. A metric space is a set together with a distance function d with three properties. Distances between different points are positive, and a point is at distance zero from itself. Distance is symmetric. And the triangle inequality: a detour through a third point is never shorter. That's all. A theorem proved from these three properties alone holds in every metric space at once, and we'll be careful to say when a result needs more.
The same set can carry many distances. On the plane: the Euclidean distance, whose ball of radius one is a disk; the taxicab distance, adding the horizontal and vertical differences, whose ball is a diamond; the max distance, taking the larger of the two, whose ball is a square; and the discrete distance, where any two different points are at distance one. Its open ball of radius one contains only its center.
The first three disagree about distances, but not about nearness. Draw their balls together: the diamond sits inside the disk, which sits inside the square, which sits inside a diamond twice as big. So each kind of ball contains a ball of every other kind around the same point. We'll see in the next chapter that this means they agree about which sets are open, and about which sequences converge. The discrete distance agrees with none of them.
Now the big step. Let the points of our space be continuous functions on the interval from zero to one. The distance between two of them, f and g, is the biggest vertical gap between their graphs: the supremum of f of x minus g of x, in absolute value, over all x.
Sweep across, measuring the gap. The largest gap here is at x about 0.207, where it's about 0.527. So the distance from f to g is 0.527.
And it really is a distance. It's zero only when the graphs coincide; it's symmetric; and the triangle inequality holds at every single x, so it holds for the supremum too.
So a function is now a point, and the distance between two functions is a number. What does a ball look like? The functions within 0.12 of f are exactly the ones whose graphs stay inside a tube of half-width 0.12 around f's graph. These wiggly ones are inside the ball. This one pokes out at a single spot, and that's enough to put it outside. From now on, close means small distance, in whatever metric space we happen to be in.
What it establishes: Rᵏ, the inner product and norm. Cauchy–Schwarz (1.35) from 0 ≤ |Bx − Cy|², with B = |y|², C = x·y, as "the gap between x and its shadow". The triangle inequality. Metric spaces (2.15; Fréchet 1906). Euclidean, taxicab, max and discrete balls; d∞ ≤ d₂ ≤ d₁ ≤ 2d∞. C[0, 1] with the sup distance; balls are tubes.; Computed on screen: The sup distance between f = 0.25 + 0.5x² and g = 0.55 + 0.25 sin 7x: 0.5267 at x = 0.2074 (grid search refined by bounded minimization).
6Open and closed setsUndergraduate6 min
With a distance in hand, we can describe the shape of a set in terms of which points have wiggle room.
Here's a set E in the plane, and here's the basic tool: the neighborhood of radius r around a point p, all the points at distance less than r. A disk, with its edge left out, which is why it's dashed.
A point is interior if some neighborhood of it fits entirely inside E: this one does, with room to spare. A set is open if every one of its points is interior. A point on the edge fails the test: however small the disk, it pokes outside.
The edge point is, however, a limit point of E: every disk around it, however small, catches points of E other than itself. A set is closed if it contains all of its limit points. This isolated point, by contrast, belongs to E but isn't a limit point: a small enough disk around it contains no other point of E.
Notice that open and closed are not opposites. If E contains some of its edge points but not others, it's neither. And some sets are both, like the whole plane.
Our first theorem has a one-picture proof. Every neighborhood is itself an open set. Take any point q inside the disk of radius r around p. Its distance to p is less than r, so there's room to spare: call it h. Any point s within h of q is within r of p, by the triangle inequality. So the small disk around q sits inside the big one, and q is interior.
One more consequence of the triangle inequality. If p is a limit point of E, every neighborhood of p contains infinitely many points of E. Because if some neighborhood held only finitely many, shrink the radius below the nearest of them, and you'd have a neighborhood with none at all. In particular, a finite set has no limit points.
Open and closed are related through complements. E is open exactly when everything outside it, its complement, is closed. If E is open, every x in E has a disk around it inside E, a disk that misses the complement entirely, so x is not a limit point of the complement. So every limit point of the complement lies in the complement: it's closed. The converse runs the same argument backwards.
How do open sets combine? Any union of open sets is open: a point in the union is in one of them, and that one already gives it room. The intersection of finitely many open sets is also open: a point in all of them has a disk inside each, and the smallest of those finitely many disks fits inside all of them.
But only finitely many. The intervals from minus one over n to one over n are all open, and they shrink down onto a single point, zero. Their intersection is just zero, which is not open. With infinitely many sets, the minimum radius can be zero. That one word, finite, is the seed of compactness, in the next chapter.
Rudin collects the standard examples in a table, here in the plane. The open disk is open but not closed; the closed disk, closed but not open. The points one, a half, a third, and so on, are neither: zero is a limit point the set doesn't contain. The whole plane is both. The new column is perfect: closed, with every point a limit point, no isolated points. Perfect sets will give us the Cantor set. And look at the last row: a segment of the x-axis is not open in the plane.
Adding the limit points to a set gives its closure, the smallest closed set containing it. The closure of the rationals is the whole real line: every real number is a limit of fractions. That's what dense means. And yet the rationals contain no interval at all, so their interior is empty. Big and small at once, a theme that will come back in Part 8 as Baire's theorem. And one fact that ties back to chapter one: the supremum of a set of reals always lies in its closure.
That last example deserves a closer look. The interval from a to b, on the real line, is open: around each of its points there's a little interval inside it. But put the same segment inside the plane, and every disk around a point pokes above and below it. As a subset of the plane, it's not open. Being open is not a property of a set alone: it depends on the space around it. Rudin calls this being open relative to a space. The next property we meet, compactness, is different: it belongs to the set itself.
What it establishes: Neighborhoods, interior and limit points, open and closed (2.18); balls are open (2.19); limit points see infinitely many points (2.20); E open ⇔ Eᶜ closed (2.23); unions and finite intersections (2.24) and ⋂(−1/n, 1/n) = {0}; Rudin's table of plane sets; perfect sets; closure, density, sup E ∈ Ē (2.26–2.28); relative openness (2.30).
7CompactnessUndergraduate4 min
Compactness, the single most useful idea in this video, and the hardest to see the point of at first.
Finite sets are pleasant. A function on a finite set always has a largest value: just check them all. And a sequence that stays inside a finite set has to repeat some value infinitely often. Infinite sets lose both properties, in general. Compactness is the property that brings them back; it's often called the next best thing to being finite.
Here's the definition. An open cover of a set K is any collection of open sets whose union contains K. K is compact if every open cover has a finite subcover: finitely many of the sets already cover K. Think of it as a game. You cover K any way you like, with as many open sets as you like. Here's a random cover of the interval from zero to one by seventy little open intervals.
My move is to throw away all but finitely many and still cover K. On this interval, here's a strategy: start at the left end, and take the interval containing that point that reaches furthest right. Jump to where it ends, and repeat. Nine intervals, out of seventy, and the whole interval is covered.
Not every set lets me win. Cover the open interval from zero to one by the intervals from one over n up to one. Together they cover everything, since every point x is bigger than one over n for large n. But any finitely many of them have a largest n, and they leave the gap from zero to one over that n uncovered.
So the open interval is not compact. Neither is the whole real line: the intervals from minus n to n cover it, and finitely many of them are bounded. Notice the trouble in both cases: something escapes, either to a missing endpoint or off to infinity. And unlike openness, compactness doesn't depend on the surrounding space: Rudin proves it's a property of the set itself.
Now three theorems that make compact sets useful. First, compact sets are closed. Take a point p outside a compact set K. For each point q of K, draw a disk around q and a disk around p, each with radius half the distance between them, so they can't overlap. The disks around the points of K cover K, so finitely many of them already do. Now intersect the matching finitely many disks around p. That intersection is still a disk around p, because there are only finitely many, and it misses all of K. So p is not a limit point of K, and K contains all of its limit points: it's closed.
Second, a closed subset of a compact set is compact: given a cover of the subset, throw in the complement of the subset, an open set, to cover everything; keep finitely many; then drop the complement again. Third, nested compact sets can't shrink to nothing: if each one is nonempty and inside the last, something lies in all of them. Compare the open intervals from zero to one over n, which do shrink to nothing. And the one we'll use most: every infinite subset of a compact set has a limit point in the set. Otherwise every point would have a little disk containing at most one point of the subset, finitely many disks would cover everything, and the subset would be finite.
That last one is the finiteness we were after: inside a compact set, infinitely many points can't spread out without piling up somewhere. Which sets are compact? For subsets of the real line, and of k-dimensional space, there's a beautifully simple answer.
What it establishes: Finite sets have maxima and repeat values; open covers and compactness (2.31–2.32); the cover game; (0, 1) and R lose; compactness is intrinsic (2.33). Compact ⇒ closed (2.34), with the disjoint-disks proof; closed subsets (2.35); nested compact sets (2.36); infinite subsets have limit points (2.37).; Computed on screen: A seeded random cover of [0, 1] by 70 open intervals and the 9-interval subcover the greedy walk finds (coverage asserted on a 10⁵-point grid).
8Heine–Borel, by bisectionUndergraduate4 min
Which subsets of the line, or of k-dimensional space, are compact? The proof uses the bisection engine from chapter three.
The basic compact set is a box: a product of closed intervals, which Rudin calls a k-cell. Every k-cell is compact. Here's the square, with k equal to two. Suppose, to get a contradiction, that some open cover of it has no finite subcover. Cut the square into four quarters. If each quarter could be covered by finitely many of the open sets, so could the whole square. So at least one quarter can't.
Keep that bad quarter, and cut it into four again. One of those has no finite subcover either. And so on. We get nested squares, each half the width of the last, and by the nested-cell version of chapter three's theorem, they close in on a single point, call it x star.
x star is in the square, so it's in one of the open sets of the cover, call it G alpha, and since G alpha is open, it contains a whole disk around x star. But the nested squares get as small as we like, so eventually one of them fits inside that disk, and a single open set covers it. That's a finite subcover of a square that supposedly had none. Contradiction.
To see what the proof really used, run the same hunt on the half-open interval from zero to one, with the cover from chapter seven. Split it in half. The right half is covered by finitely many of the sets, but the left half isn't. Split the left half again, and again: the hunt for the place where the cover fails closes in on zero. And zero is not in the set. That's the only step that breaks: in a closed box, the point the hunt finds belongs to the box, and an open set swallows everything near it.
Now we can say exactly which subsets of k-dimensional space are compact. The Heine–Borel theorem says three properties are equivalent. Closed and bounded; compact; and every infinite subset has a limit point inside the set.
Closed and bounded gives compact: a bounded set sits inside some box, which is compact, and a closed subset of a compact set is compact. Compact gives the limit-point property, as we saw last chapter. And if a set is not bounded, points marching off to infinity form an infinite subset with no limit point; if it's not closed, points crowding toward a missing limit point form an infinite subset whose only limit point is outside the set. So the third property forces the first.
One warning, which will matter at the end of this video. Compact and the limit-point property are equivalent in every metric space. But closed and bounded implies compact only in k-dimensional space, because the proof needed boxes, and bisection, and finitely many coordinates.
A corollary that we'll use constantly in Part 2. Every bounded infinite set in k-dimensional space has a limit point. Here are points of the sequence cosine of n, sine of root two times n, all inside a square: up to fifteen hundred of the first hundred thousand.
The proof is bisection once more. Cut the square into quarters; at least one contains infinitely many of the points. Zoom into it, and repeat. The quarters shrink to a point, and every disk around that point contains infinitely many points of the set: a limit point. In sequence language: every bounded sequence has a convergent subsequence.
What it establishes: k-cells are compact (2.40) by bisection (schematic); the same hunt on (0, 1] closes in on the missing 0. Heine–Borel (2.41) with its three implications; (a) ⇒ (b) is special to Rᵏ. Bolzano–Weierstrass (2.42).; Computed on screen: 4,000 points (cos n, sin √2 n), the quarter with the most points chosen four times.
9The Cantor setGraduate5 min
Compactness gives a second, completely different proof that the real numbers are uncountable, and it leads to the most famous strange set in analysis.
Recall that a set is perfect if it's closed and every one of its points is a limit point: no isolated points. Every nonempty perfect set in k-dimensional space is uncountable. Suppose instead that a perfect set P could be listed: x one, x two, x three. Choose a closed disk that meets P, then a smaller closed disk inside it that still meets P but avoids x one. That's possible because every point of P is a limit point, so there are other points of P nearby to aim for. Then a smaller one avoiding x two, and so on.
The pieces of P inside these disks are nested, nonempty and compact, so by theorem 2.36, from the chapter on compactness, something lies in all of them. That something is a point of P, but it can't be x n for any n, because the n plus first disk avoids x n. So the list missed a point. The real line is perfect, so this is a second proof that it's uncountable, built from compactness instead of digits.
The Cantor set, from 1883, is built by removing. Start with the interval from zero to one. Remove its open middle third, leaving two closed pieces. Remove the middle third of each of those, leaving four, then eight, then sixteen. The Cantor set is what survives every step: the intersection of all these stages.
What survives? The Cantor set is compact, as an intersection of closed sets inside a compact interval. It's not empty: zero, one, and every endpoint of every stage is never removed. It contains no interval at all, since any interval, however short, contains some removed middle third. And it's perfect: near every point of the set, there are endpoints of later stages. So, by the theorem, it's uncountable. And yet, the lengths we removed add up to one third, plus two ninths, plus four twenty-sevenths, and so on: exactly one. Uncountably many points, total length zero.
There's a cleaner description in base three. The first removal throws out the numbers whose first base-three digit has to be a one; the second throws out those whose second digit has to be one; and so on. The Cantor set is exactly the numbers that can be written in base three using only zeros and twos. Those are chapter four's zero-one sequences, with ones written as twos. That's why the map we used there landed here.
Here's a strange member. One quarter, in base three, is 0.0202 repeating: only zeros and twos, so it's in the Cantor set, but it's never an endpoint of any stage. Zoom in around it by a factor of nine, and the picture repeats exactly: the set is self-similar. Each zoom reads off two more digits.
One more object to keep for later. Define a function on the Cantor set by reading a number's base-three digits, turning the twos into ones, and reading the result in base two. One quarter, 0.0202 repeating, goes to 0.0101 repeating in binary, which is one third. Fill in each removed middle third with a flat step. As we add stages, the steps multiply.
The limit is the devil's staircase. It's continuous and never decreases, it climbs from zero to one, and it's flat on every removed interval, which have total length one. All of the climbing happens on the Cantor set, a set of length zero. So its derivative is zero almost everywhere, and yet it rises. Keep it in mind: in Part 3 it will be an integrator, in Part 5 a measure, and in Part 6 the function for which the fundamental theorem of calculus fails.
What it establishes: Nonempty perfect sets are uncountable (2.43), by nested compact sets. The Cantor set (2.44): compact, nonempty, no interval, perfect, uncountable, removed length 1. Base-3 digits 0 and 2; 1/4 = 0.0202…₃ is in it but is never an endpoint; zooming by 9 about 1/4 repeats the picture. The Cantor function.; Computed on screen: The intervals to depth 12 (2ⁿ pieces, total (2/3)ⁿ, asserted); the digits of 1/4 in exact arithmetic; F(1/4) = 1/3.
10ConnectednessGraduate4 min
What does it mean for a set to be all in one piece? Rudin's definition is careful. Two sets are separated if neither one contains a point of the other's closure: they don't touch, even at a limit point. A set is connected if it can't be split into two nonempty separated pieces. The half-open interval from zero to one and the closed interval from one to two are disjoint, but they touch at one, which is a limit point of the first. Not separated. Remove the point one, and the two open intervals are separated.
On the real line, connected sets are exactly what you'd hope: the intervals, the sets with no gaps, where any number between two members is also a member. One direction is easy. If a set skips some z between two of its points, then the part below z and the part above z are nonempty and separated, since nothing in either piece is a limit of the other.
The other direction is where the real numbers earn their keep. Suppose an interval were split into two nonempty separated pieces, A and B, with a point x of A to the left of a point y of B. Let z be the supremum of the part of A between x and y: the least-upper-bound property again, finding the seam. z is in the closure of A, so it can't be in B. If z isn't in A either, the interval has a gap at z. If z is in A, it's not in the closure of B, so some point just to the right of z is in neither piece: again a gap. Either way, the interval wasn't an interval.
Now look at the rationals with this definition. Split them at root two: the fractions below it and the fractions above it. Since root two isn't a fraction, every fraction lands on one side, and neither side contains a limit point of the other that's actually a fraction. So the two sides are separated, and the rationals are not connected. The hole from chapter one is literally a seam you can pull apart.
In fact, there's an irrational number between any two fractions, so every set of fractions with at least two points splits like this. In Part 2 we'll see that continuous functions carry connected sets to connected sets, which is the real reason behind the intermediate value theorem.
Connectedness can be subtler than it looks. Here's the graph of sine of one over x, for x between zero and one, oscillating faster and faster as x approaches zero, together with the vertical segment it piles up against. The whole thing is connected: the segment lies in the closure of the curve, so they can't be separated. But you can't walk from the segment onto the curve along a continuous path: the curve wiggles infinitely often before reaching it. Connected, but not path-connected.
What it establishes: Separated sets and connectedness (2.45); the connected subsets of R are the intervals (2.47), the seam found by a supremum; Q splits at √2 and is totally disconnected; preview of the intermediate value theorem; the topologist's sine curve.; Computed on screen: sin(1/x) sampled uniformly in phase (60,000 points).
11A first space of functionsQualifying exam3 min
We end where the series is headed: a space whose points are functions. And it comes with a warning.
Take the continuous functions on the interval from zero to one, with the sup distance from chapter five. Its closed unit ball is the set of functions whose graphs stay between minus one and one: any graph inside this band. It's bounded, obviously. And it's closed: if functions with values between minus one and one converge in the sup distance, their limit's values are between minus one and one too. In k-dimensional space, Heine–Borel would now say: compact.
It isn't. Here's a sequence inside the ball: f n is a tent of height one over the interval from one over n plus one to one over n, and zero everywhere else. The tents march toward zero, getting narrower, each one sitting where all the others are zero.
Now measure distances. Where one tent reaches height one, every other tent is zero, so the distance between any two of them is exactly one. Here's the whole table: zeros on the diagonal, ones everywhere else. So a ball of radius one half contains at most one tent, and the set of tents has no limit point at all. An infinite subset with no limit point: by chapter seven, the unit ball is not compact.
What went wrong? Think of each tent as a point. They're all at distance one from each other, like the corners of a triangle, then a tetrahedron, then shapes in higher and higher dimensions. In three-dimensional space you can fit at most four points all at the same distance from each other; a bounded region of k-dimensional space can only hold finitely many points that keep their distance. The function space has infinitely many independent directions, so there's always room for one more.
So here's the warning, as a dictionary between k-dimensional space and our first function space. Closed and bounded no longer implies compact. Bounded sequences no longer need convergent subsequences. The unit ball is no longer compact. Heine–Borel is a theorem about k-dimensional space, not about space in general. In Part 3 we'll find what replaces it: the Arzelà–Ascoli theorem, which adds one more condition, equicontinuity. And in Part 8 we'll prove that no infinite-dimensional space can have a compact unit ball.
What it establishes: The closed unit ball of C[0, 1] is closed and bounded; the tents on [1/(n + 1), 1/n] are pairwise at distance 1, so it is not compact; infinitely many directions; the dictionary Rᵏ ↔ C[0, 1] and what replaces Heine–Borel (Arzelà–Ascoli, Part 3; Riesz, Part 8).; Computed on screen: The 12 × 12 table of sup distances between tents (off-diagonal entries asserted equal to 1).
Recap, and the first row of the ledgerAll tracks2 min
Let's take stock. We found that the rationals have holes, and filled them in a way that turns having no holes into a theorem: every nonempty set that's bounded above has a least upper bound. We used that to prove the Archimedean property, density, and the nested interval theorem, and we built the bisection engine. We learned that the rationals, dense as they are, are countable, while the reals are not. Then we stepped back to metric spaces, where a function can be a point, and built the vocabulary: open, closed, compact, connected. We proved Heine–Borel by bisection, met the Cantor set, and found that our first function space already breaks Heine–Borel.
And the ledger gets its first row. The space: the real line, and k-dimensional space. Complete because we built it so, with least upper bounds. Compact means closed and bounded. Which limits may we swap? None yet. And Fourier's question: we can't even ask it yet, because we haven't said what it means for a sequence of functions to converge.
Next time, in Part 2, we put the new real numbers to work: sequences, series, continuity and the derivative, the limits behind Fourier's sum. It opens with a shock: the alternating harmonic series adds up to the natural log of two, but rearrange its terms and you can make it add up to pi, or minus one, or anything you like.
This part followed the first two chapters of Rudin's Principles of Mathematical Analysis. Thanks for watching, and see you in Part 2.
Where it goes next. Completeness becomes the convergence of Cauchy sequences in Part 2, and the rational ruler returns there as Thomae's function. The Cantor set returns as an integrator in Part 3 and as a null set in Part 5; what replaces Heine-Borel in a function space is Arzelà-Ascoli in Part 3 and Riesz's theorem in Part 8.
Key results
The part's results in one place, for revision.
Try it
Lab 1 · Heine-Borel as a game: finite subcovers, and the cover that has none
Draw a random open cover of [0, 1] and extract a finite subcover by a greedy walk; then cover (0, 1] by the intervals (x/3, 3x) and count how many are needed for [a, 1] as a shrinks to 0.
python -m videos.analysis.labs 1
needs numpy, scipy, matplotlib · download lab01.py ·
source on GitHubRudin's hop from 1, eight steps 41/29 -> ... -> 1393/985 (2 - p^2 = 1.03e-06)
random cover of [0, 1] 70 open intervals; greedy finite subcover uses 8
greedy against every subset (18 wide intervals) greedy 3, smallest possible 3
(0, 1] cover: intervals needed for [0.1, 1] 2 (theory 2)
(0, 1] cover: intervals needed for [0.01, 1] 3 (theory 3)
(0, 1] cover: intervals needed for [0.001, 1] 4 (theory 4)
(0, 1] cover: intervals needed for [0.0001, 1] 5 (theory 5)
(0, 1] cover: intervals needed for [1e-05, 1] 6 (theory 6)
(0, 1] cover: intervals needed for [1e-06, 1] 7 (theory 7)
growth per factor e in 1/a 0.454 (theory 1/ln 9 = 0.455)
On the closed interval a finite subcover always exists; on (0, 1] the same game needs about ln(1/a)/ln 9 intervals to reach a, so no finite number reaches 0: closedness is what is used.
The code (120 lines; it asserts its own result)
"""Lab 1: play the open-cover game on [0, 1], where it is won, and on (0, 1], where it is lost."""
from fractions import Fraction
from math import floor, log
import numpy as np
from videos.coursekit import labs
TITLE = "Heine-Borel as a game: finite subcovers, and the cover that has none"
GOAL = ("Draw a random open cover of [0, 1] and extract a finite subcover by a greedy walk; then cover (0, 1] by the "
"intervals (x/3, 3x) and count how many are needed for [a, 1] as a shrinks to 0.")
TASKS = [
"Change the family (x/3, 3x) to (x/k, kx) for k = 1.1 and k = 10. How does the count for a = 1e-6 change, and why is it never bounded?",
"Add the single interval (-0.01, 0.01) to the family covering (0, 1]. Show that the count for [0, 1] is now finite, and find it.",
"Replace Rudin's hop by Newton's step p -> p/2 + 1/p and compare how fast the two close in on the hole at the square root of 2.",
]
def greedy(intervals, lo, hi):
"""The fewest open intervals of the list whose union contains [lo, hi], by the walk from the left: among the
intervals containing the first uncovered point, take the one reaching furthest right. None if a point is missed."""
chosen, t = [], lo
while True:
reach = [(b, a) for a, b in intervals if a < t < b]
if not reach:
return None
b, a = max(reach)
chosen.append((a, b))
if b > hi:
return chosen
t = b # b itself is not covered by (a, b): the next interval must contain it
def brute_minimum(intervals, lo, hi, grid, limit=4):
"""The smallest subcover of [lo, hi] with at most ``limit`` intervals, by trying every subset (or None)."""
from itertools import combinations
inside = [(grid > a) & (grid < b) for a, b in intervals]
for k in range(1, limit + 1):
for combo in combinations(range(len(intervals)), k):
if np.all(np.any([inside[i] for i in combo], axis=0)):
return k
return None
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
# 1. Rudin's hop: the set {p in Q : p^2 < 2} has no largest element (exact fractions).
p, ups = Fraction(1), [Fraction(1)]
for _ in range(8):
q = (2 * p + 2) / (p + 2)
assert p < q and q * q < 2 and q * q - 2 == 2 * (p * p - 2) / (p + 2) ** 2, "the hop stays below and climbs"
p = q
ups.append(q)
lab.row("Rudin's hop from 1, eight steps", f"{ups[4]} -> ... -> {ups[-1]} (2 - p^2 = {float(2 - p * p):.2e})")
# 2. A random open cover of [0, 1]: a finite subcover exists and the greedy walk finds a smallest one.
n_cover = 70
centers = np.concatenate([np.linspace(0, 1, 12), rng.uniform(0, 1, n_cover - 12)])
radii = np.concatenate([np.full(12, 0.05), rng.uniform(0.01, 0.09, n_cover - 12)])
cover = [(c - r, c + r) for c, r in zip(centers, radii)]
sub = greedy(cover, 0.0, 1.0)
grid = np.linspace(0, 1, 100_001)
covered = np.zeros(grid.size, bool)
for a, b in sub or []:
covered |= (grid > a) & (grid < b)
assert sub is not None and covered.all(), "the finite subcover covers a 100,001-point grid of [0, 1]"
small = [(c - r, c + r) for c, r in zip(np.concatenate([[0.0, 1.0], rng.uniform(0, 1, 16)]),
rng.uniform(0.12, 0.3, 18))]
walk = greedy(small, 0.0, 1.0)
best = brute_minimum(small, 0.0, 1.0, np.linspace(0, 1, 2001), limit=len(walk) if walk else 0)
assert walk is not None and best == len(walk), "the greedy walk is a smallest subcover (checked by brute force)"
lab.row("random cover of [0, 1]", f"{n_cover} open intervals; greedy finite subcover uses {len(sub)}")
lab.row("greedy against every subset (18 wide intervals)", f"greedy {len(walk)}, smallest possible {best}")
# 3. The cover {(x/3, 3x) : 0 < x <= 1} of (0, 1]: [a, 1] needs more and more intervals as a -> 0.
k = 3.0
family = [(x / k, k * x) for x in np.geomspace(1e-8, 1, 3201)] # a fine sample of the family
lefts = [10.0 ** -e for e in range(1, 7)]
counts, theory = [], []
for a in lefts:
counts.append(len(greedy(family, a, 1.0)))
# each interval spans a factor k^2 and open intervals must overlap, so N intervals reach down only to left
# ends above k^(-2N): N is the least integer greater than ln(1/a) / ln(k^2)
theory.append(floor(log(1 / a) / log(k * k)) + 1)
for a, c, t in zip(lefts, counts, theory):
lab.row(f"(0, 1] cover: intervals needed for [{a:g}, 1]", f"{c} (theory {t})")
assert all(t <= c <= t + 1 for c, t in zip(counts, theory)), "the count matches the logarithmic law"
assert all(c2 > c1 for c1, c2 in zip(counts, counts[1:])), "the count grows without bound as a -> 0"
assert greedy(family, 0.0, 1.0) is None, "no interval of the family contains 0: [0, 1] is not even covered"
fine = np.geomspace(1e-7, 1e-1, 25)
slope = np.polyfit(np.log(1 / fine), [len(greedy(family, a, 1.0)) for a in fine], 1)[0]
lab.row("growth per factor e in 1/a", f"{slope:.3f} (theory 1/ln 9 = {1 / log(9):.3f})")
assert abs(slope - 1 / log(9)) < 0.05
lab.note = ("On the closed interval a finite subcover always exists; on (0, 1] the same game needs about "
"ln(1/a)/ln 9 intervals to reach a, so no finite number reaches 0: closedness is what is used.")
fig, ax = labs.figure(2, size=(11, 4.2))
for i, (a, b) in enumerate(cover):
ax[0].plot([a, b], [i % 14 + 2, i % 14 + 2], color=labs.BLUE, lw=1.2, alpha=0.55)
for i, (a, b) in enumerate(sub):
ax[0].plot([a, b], [-1 - i % 2, -1 - i % 2], color=labs.GOLD, lw=3)
ax[0].plot([0, 1], [0.5, 0.5], color=labs.INK, lw=2.5)
ax[0].plot([], [], color=labs.BLUE, label=f"the cover: {n_cover} open intervals")
ax[0].plot([], [], color=labs.GOLD, lw=3, label=f"a finite subcover: {len(sub)}")
ax[0].plot([], [], color=labs.INK, lw=2.5, label="[0, 1]")
ax[0].set(title="[0, 1]: the game is won", xlabel="x", yticks=[], ylim=(-3, 21))
ax[0].legend(loc="upper right", ncols=1)
aa = np.geomspace(1e-6, 0.5, 200)
ax[1].step(aa, [floor(log(1 / a) / log(k * k)) + 1 for a in aa], color=labs.MUTED, where="mid",
label="theory: least N > ln(1/a) / ln 9")
ax[1].scatter(lefts, counts, color=labs.GOLD, zorder=3, label="greedy count for [a, 1]")
ax[1].set(xscale="log", title="(0, 1] covered by (x/3, 3x): the count has no bound", xlabel="left end a",
ylabel="intervals needed")
ax[1].legend()
lab.fig = fig
return lab
Now change it
- Change the family (x/3, 3x) to (x/k, kx) for k = 1.1 and k = 10. How does the count for a = 1e-6 change, and why is it never bounded?
- Add the single interval (-0.01, 0.01) to the family covering (0, 1]. Show that the count for [0, 1] is now finite, and find it.
- Replace Rudin's hop by Newton's step p -> p/2 + 1/p and compare how fast the two close in on the hole at the square root of 2.
Notes and sources
Sources
Fact-check notes and sources
The mathematics follows W. Rudin, Principles of Mathematical Analysis, 3rd ed. (McGraw-Hill, 1976), chapter 1 and its appendix, and chapter 2; theorem numbers on screen are that edition's. Companion treatments: S. Abbott, Understanding Analysis; C. Pugh, Real Mathematical Analysis; T. Tao, Analysis I.
- Fourier submitted Mémoire sur la propagation de la chaleur dans les corps solides to the Institut de France in December 1807; the examiners included Lagrange, Laplace, Monge and Lacroix, and Lagrange objected to expanding arbitrary functions in trigonometric series. The theory appeared as Théorie analytique de la chaleur (1822).
- Cauchy, Cours d'analyse (1821); Dirichlet, on the convergence of Fourier series (1829), where the indicator of the rationals appears; Riemann's Habilitationsschrift on trigonometric series (1854, published 1867) introduced his integral; Cantor's work on the uniqueness of trigonometric series (1870–1872) led to set theory.
- Dedekind, Stetigkeit und irrationale Zahlen (1872), the cuts (conceived 1858); Cantor (1872) and Méray (1869, 1872): reals from Cauchy sequences of rationals.
- Cantor (1874): the algebraic numbers are countable and the reals are not (by nested intervals); the diagonal argument is from 1891. Liouville (1844) gave the first explicit transcendental numbers; Hermite (1873) proved e transcendental, Lindemann (1882) π.
- Fréchet's thesis (1906) introduced metric spaces; Hausdorff (1914) named them.
- Heine (1872) and Borel (1895) for the covering theorem (the name is Schoenflies's, 1900).
- The Cantor set: Cantor (1883); H. J. S. Smith described such sets in 1875. The Cantor function: Cantor (1884).
- "The next best thing to being finite" is a common description of compactness; it is not quoted from a specific author. T. Tao's essay Compactness and compactification describes compact spaces as "almost finite".
- The topologist's sine curve is not in Rudin (see Munkres, Topology, §24).
On-screen simplifications, stated here for the record:
- The ruler's ticks are capped in height (at 1.6 times the reference height), and the window's tick density targets about 1,300 fractions; the narration says the line under the ticks is the real line.
- The bisection of a k-cell is labeled
schematic: a cover with no finite subcover does not exist, so the nested squares are drawn toward a chosen point. The equidistant tents are drawn as a complete graph, labeledschematicand "impossible to draw flat". - The Cantor set is drawn to depth 12 at each zoom; the screen says so.
About this partfrom its README
Part 1 of a ten-part series that builds mathematical analysis from the holes in the rational numbers to the spectral theorem, following the arc of Walter Rudin's three textbooks (Principles of Mathematical Analysis, Real and Complex Analysis, Functional Analysis). This part covers chapters 1 and 2 of Principles, in an hook and eleven chapters:
- The real numbers. Fourier's 1807 claim and the century of questions it raised. The rationals as an ordered field, dense and full of holes: √2 is irrational, and Rudin's Theorem 1.1, proved by the map p ↦ (2p + 2)/(p + 2), run step by step. Suprema and the least-upper-bound property. Dedekind's cuts: the order, the one-line proof that the supremum of a set of cuts is their union, arithmetic, and the Cantor–Méray construction by Cauchy sequences. The Archimedean property, the density of Q, √2 = sup A, nested intervals, and the bisection engine.
- Counting. Countable and uncountable sets, the zigzag through the fractions, countable unions, Cantor's diagonal, R uncountable, and transcendental numbers.
- The shape of space. Cauchy–Schwarz (as "the gap between x and its shadow has nonnegative length"), the triangle inequality, metric spaces, four metrics on the plane and their balls, and the sup distance between two functions. Open and closed sets, closures, relative openness. Compactness as a game of open covers; compact sets are closed; nested compact sets; limit points. Heine–Borel by bisection, with the same hunt run on (0, 1] to show exactly where closedness is used. Perfect sets are uncountable; the Cantor set and the Cantor function. Connected subsets of R are the intervals; Q splits at √2; the topologist's sine curve.
- A warning. In C[0, 1] the closed unit ball is closed and bounded but not compact.
Every theorem is proved on screen; every number the narration states is computed in
compute.py (exactly, with Python fractions and integers, wherever possible) and asserted.
Schematics are labeled schematic.
The series plan is kept outside the repository; the shared instruments live in
explainer/analysis.
What is computed and builtComputations (compute.py)
| Item | What | Checks |
|---|---|---|
sawtooth |
(π − x)/2 on (0, 2π) and Σ_{k≤n} sin(kx)/k for n = 1 … 200 | every partial sum is 0 at the jumps; at x = 1, 2, 4 the sum to 20,000 terms is within 2 × 10⁻⁴; the first peak at n = 5000 is within 10⁻³ of Si(π) = 1.8519; (Si(π) − π/2)/π = 8.95% |
hops |
Rudin's map from 1 upward and from 2 downward, nine steps each, as exact fractions | q² < 2 and q > p on the way up, q² > 2 and q < p on the way down; q = (2p + 2)/(p + 2) and q² − 2 = 2(p² − 2)/(p + 2)² exactly |
sqrt2 |
40 digits of √2 by isqrt; 30 bisection steps on [1, 2] |
each decimal interval [⌊√2·10ᵏ⌋, +1]/10ᵏ contains √2 (integer comparison); aₖ² < 2 < bₖ² |
diagonal |
12 seeded 0–1 sequences (16 digits shown) | the flipped diagonal differs from row k at place k |
qorder |
the zigzag order of p/q | starts 1, 2, 1/2, 3, 1/3, 4; 2/2 is skipped |
supdist |
sup |f − g| on [0, 1] | grid maximum and bounded minimization agree to 10⁻⁶ |
cover |
70 random open intervals covering [0, 1]; the greedy subcover | the cover covers a 10⁵-point grid with margin; the subcover (9 intervals) covers it |
cantor |
the Cantor set's intervals to depth 12; the digits of 1/4; the Cantor function | 2ⁿ intervals of total length (2/3)ⁿ; 1/4 = 0.0202…₃, inside the depth-12 set but never an endpoint; F(1/4) = 1/3; F nondecreasing |
bumps |
the tents on [1/(n + 1), 1/n], n ≤ 12 | sup distances are exactly 1 off the diagonal |
Chapter notes
0:00 Fourier's question, and the holes in the fractions
4:28 1. Holes in the rational line
9:15 2. Filling the holes: Dedekind cuts
14:29 3. Archimedes, density and decimals
18:12 4. Counting infinities
22:36 5. What “close” means: metric spaces
26:48 6. Open and closed sets
31:28 7. Compactness
35:12 8. Heine–Borel, by bisection
38:45 9. The Cantor set
42:40 10. Connectedness
45:28 11. A first space of functions
47:52 Recap, and the first row of the ledger
Chapter notes
| # | Scene | What it establishes | Computed on screen |
|---|---|---|---|
| 0 | Hook |
Fourier's sawtooth as a sum of sines; a limit of smooth functions with a jump; every partial sum is 0 at the jump; the 8.95% overshoot. Lagrange's objection and the questions that followed (limit, function, integral, number). The sequence 1, 1.4, 1.41, … has nowhere to land in Q. The series and its ten parts; the thesis (when may two limits be swapped? m/(m + n), Rudin 7.2); the ledger. | Partial sums of Σ sin(kx)/k up to n = 200; the overshoot checked against Si(π) at n = 5000; the rationals in windows down to width 2.5 × 10⁻⁶ around √2. |
| 1 | Holes |
Q as an ordered field; density by averages; the picture is the real line, Q is only the ticks. √2 is irrational. Rudin 1.1: A = {p² < 2} has no largest element, B no smallest, by q = (2p + 2)/(p + 2) and q² − 2 = 2(p² − 2)/(p + 2)². Upper bounds, sup; the upper bounds of A in Q are exactly B, so sup A does not exist in Q. The least-upper-bound property; Rudin 1.19. | The hops 1 → 4/3 → 7/5 → 24/17 → 41/29 and 2 → 3/2 → 10/7 → 17/12 in exact fractions, with their squares; the ruler colored by the sign of p² − 2q² (exact integers). |
| 2 | Cuts |
Dedekind cuts (I)–(III); (1/2)* and the cut of √2, whose condition (III) is Rudin 1.1. R = all cuts, ordered by inclusion; totality in three lines. sup = union: the five-step proof. Arithmetic, 0*, the embedding r ↦ r*. Rudin 1.19 (existence and uniqueness). Cantor–Méray: two Cauchy sequences for √2 whose difference → 0. | The cuts drawn from their exact rational members; the decimals and hops of √2 and their differences. |
| 3 | Archimedes |
The Archimedean property (1.20) by contradiction with α = sup{nx}. Density of Q: a ruler with spacing 1/28 < 0.45 − (√2 − 1) must land inside. √2 exists: y = sup A, and both y² < 2 and y² > 2 contradict the hop. Decimals as nested intervals; the nested-interval theorem via sup aₙ; why both "closed" and "complete" matter. The bisection engine. | 40 digits of √2 by integer square roots, every decimal interval asserted to contain it; 30 bisection steps in exact dyadics. |
| 4 | Counting |
Pairings; countable; Z; the zigzag through p/q (skipping repeats) lists Q; countable unions (2.12); the diagonal (2.14); s ↦ Σ 2sₖ/3ᵏ is one-to-one, so R is uncountable; algebraic numbers are countable, so almost every real is transcendental (Cantor 1874; Liouville, Hermite, Lindemann). | The first 40 rationals in zigzag order; a seeded 12 × 16 table of 0–1 sequences and its flipped diagonal, asserted different from every row. |
| 5 | Distance |
Rᵏ, the inner product and norm. Cauchy–Schwarz (1.35) from 0 ≤ |Bx − Cy|², with B = |y|², C = x·y, as "the gap between x and its shadow". The triangle inequality. Metric spaces (2.15; Fréchet 1906). Euclidean, taxicab, max and discrete balls; d∞ ≤ d₂ ≤ d₁ ≤ 2d∞. C[0, 1] with the sup distance; balls are tubes. | The sup distance between f = 0.25 + 0.5x² and g = 0.55 + 0.25 sin 7x: 0.5267 at x = 0.2074 (grid search refined by bounded minimization). |
| 6 | OpenClosed |
Neighborhoods, interior and limit points, open and closed (2.18); balls are open (2.19); limit points see infinitely many points (2.20); E open ⇔ Eᶜ closed (2.23); unions and finite intersections (2.24) and ⋂(−1/n, 1/n) = {0}; Rudin's table of plane sets; perfect sets; closure, density, sup E ∈ Ē (2.26–2.28); relative openness (2.30). | — |
| 7 | Compact |
Finite sets have maxima and repeat values; open covers and compactness (2.31–2.32); the cover game; (0, 1) and R lose; compactness is intrinsic (2.33). Compact ⇒ closed (2.34), with the disjoint-disks proof; closed subsets (2.35); nested compact sets (2.36); infinite subsets have limit points (2.37). | A seeded random cover of [0, 1] by 70 open intervals and the 9-interval subcover the greedy walk finds (coverage asserted on a 10⁵-point grid). |
| 8 | HeineBorel |
k-cells are compact (2.40) by bisection (schematic); the same hunt on (0, 1] closes in on the missing 0. Heine–Borel (2.41) with its three implications; (a) ⇒ (b) is special to Rᵏ. Bolzano–Weierstrass (2.42). | 4,000 points (cos n, sin √2 n), the quarter with the most points chosen four times. |
| 9 | Cantor |
Nonempty perfect sets are uncountable (2.43), by nested compact sets. The Cantor set (2.44): compact, nonempty, no interval, perfect, uncountable, removed length 1. Base-3 digits 0 and 2; 1/4 = 0.0202…₃ is in it but is never an endpoint; zooming by 9 about 1/4 repeats the picture. The Cantor function. | The intervals to depth 12 (2ⁿ pieces, total (2/3)ⁿ, asserted); the digits of 1/4 in exact arithmetic; F(1/4) = 1/3. |
| 10 | Connected |
Separated sets and connectedness (2.45); the connected subsets of R are the intervals (2.47), the seam found by a supremum; Q splits at √2 and is totally disconnected; preview of the intermediate value theorem; the topologist's sine curve. | sin(1/x) sampled uniformly in phase (60,000 points). |
| 11 | FunctionSpace |
The closed unit ball of C[0, 1] is closed and bounded; the tents on [1/(n + 1), 1/n] are pairwise at distance 1, so it is not compact; infinitely many directions; the dictionary Rᵏ ↔ C[0, 1] and what replaces Heine–Borel (Arzelà–Ascoli, Part 3; Riesz, Part 8). | The 12 × 12 table of sup distances between tents (off-diagonal entries asserted equal to 1). |
| 12 | Outro |
Recap in eleven lines; the ledger's first row; Part 2's opening (the rearrangement theorem); sources. | — |
The visual language
- The rational ruler. Q is drawn as ticks, the tick of p/q (in lowest terms) rising in proportion to q^−0.6, so both the density of the fractions and their hierarchy are visible. The fractions in each window are enumerated exactly at every frame by a Stern–Brocot search in integer arithmetic (about 1,400 fractions per frame in under a millisecond, even at window width 10⁻¹²), so a zoom shows the right fractions at every depth. Part 2 reuses it for Thomae's function.
- The narration says what the picture is. The line under the ticks is named as already being the real line,
and pictures of things that cannot be drawn exactly (the k-cell bisection, the equidistant tents) are labeled
schematic. - Proofs as ladders. Each derivation line grows out of the previous one, with a grey note saying why it follows; long proofs get numbered steps.
- Counterexample cards (a red corner tag): the Cantor set, the Cantor function, the topologist's sine curve.
- The chapter cards carry a strip of the history from 1800 to 1970, with the years of the chapter lit.
| Concept | Color |
|---|---|
| the lower set of a cut, A = {p² < 2}, its elements | blue |
| the upper set, B = {p² > 2}, upper bounds | coral |
| a hole: where a limit should be and is not | red ring |
| ε, tolerances, highlights | yellow |
| δ, N, responses, rulers | teal |
| sequences, the hero function f | blue |
| approximants (partial sums), the second function g | magenta |
| open sets, neighborhoods (dashed edge, airy fill) | light blue |
| closed sets, closures | orange |
| compact sets, finite subcovers, nested cells | gold |
| connected sets | green |
| distances, norms, tubes | pale gold |
| inner products, projections | lilac |
| the rationals | grey |
| counterexamples (museum tag) | red |
Build the film
python -m videos.analysis.analysis1.compute # the part's numbers, into .cache/analysis1
python tools/build.py analysis1 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py analysis1 Hook # one chapter, silent, with a contact sheet
Scenes: videos/analysis/analysis1. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
The finished video is not stored in the repository. From the repo root, after the one-time setup in the top-level README:
python -m videos.analysis.analysis1.compute # once: every computed item (a few seconds; cached in .cache/analysis1)
python tools/build.py analysis1 -q k --fps 60 # the full-quality cut: 2160p60 + subtitles + chapters -> renders/analysis1_2160p.mp4
python tools/build.py analysis1 # 1080p30 -> renders/analysis1.mp4
python tools/build.py analysis1 -q l # fast 480p preview
python tools/export_script.py analysis1 # regenerate SCRIPT.md from the code
python tools/check_narration.py analysis1 # Whisper listen test of every narration line