Book I · Principles of Mathematical Analysis
Part 4 of 10Calculus in Many Dimensions
What is the derivative of a map of several variables, and how does one idea, a map that shrinks distances, solve equation after equation?
The part opens with Newton's method on a circle and a hyperbola, and with the picture behind it: a map of the plane that shrinks every distance collapses the plane onto its one fixed point. Linear maps get a norm, the largest stretch, and the invertible ones form an open set, by a geometric series of matrices. The derivative becomes the linear map seen when a contour map is zoomed until its level lines are straight and evenly spaced. Two museum functions show that partial derivatives, and even directional derivatives in every direction, do not make a derivative; continuous partials do. Then the contraction principle is proved and used: for cos x = x, for Picard's solution of differential equations in C[0, h], and for the inverse and implicit function theorems, each built from one contraction. The part turns to two more swaps, mixed partials that disagree and differentiation under the integral sign, and ends with a tour, stated and checked but not proved, of the change of variables formula and Stokes' theorem.
What you need. Linear algebra: matrices as linear maps, determinants and inverses.
What you will be able to do
Undergraduate
- Compute a Jacobian matrix and use it as the best linear approximation of a map near a point.
- Show by example that the existence of partial derivatives does not imply differentiability, or even continuity.
- Iterate a contraction and bound the distance to its fixed point before computing it.
Graduate
- Prove the contraction principle, and prove that continuous partial derivatives make a function continuously differentiable.
- Derive the inverse function theorem from the contraction x + A^{-1}(y - f(x)), and the implicit function theorem from the inverse function theorem.
Qualifying exam
- Prove that mixed partials agree when one of them is continuous, and analyse the function whose mixed partials at the origin are -1 and 1.
- State exactly where completeness and the Lipschitz condition enter Picard's theorem, with the equation y' = 2 sqrt(y) as the example of lost uniqueness.
Applications
- Solve an initial value problem by Picard iteration and compare with a numerical integrator.
- Explain why Newton's method doubles the number of correct digits near a simple root, and check an area by a line integral around its boundary.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 14 min · Graduate 25 min · Qualifying exam 27 min · Applications 19 min.
- 0Newton's method, and the contraction behind itUndergraduate2 min
- 1Linear maps and their normsUndergraduate3 min
- 2The derivative is a linear mapUndergraduate3 min
- 3Partial derivatives are not enoughUndergraduate2 min
- 4The contraction principleUndergraduate3 min
- 5Picard: differential equations in C[a, b]Applications3 min
- 6The inverse function theoremGraduate2 min
- 7The implicit function theoremGraduate3 min
- 8Mixed partials, and differentiating under the integralQualifying exam3 min
- 9A tour of integration in many variablesApplications2 min
- The fourth 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.
Newton's method, and the contraction behind itUndergraduate2 min
Three rows of the ledger are filled: the real line, limits, and the first space of functions. Part 4 takes calculus into many dimensions, and it runs on one idea.
Here are two equations in two unknowns: a circle and a hyperbola, and we want a point where they cross. Newton's method starts from a guess. At the guess, replace each of the two functions by its best linear approximation. Where each approximation is zero is a straight line, and two lines are easy: they cross at one point, the next guess. Repeat. After four steps F is about ten to the minus eleven away from zero. Once close, the number of correct digits doubles at every step.
Behind Newton's method is a simpler picture. Take a map of the plane that shrinks every distance by a fixed factor, here 0.62, while it turns and slides. Apply it again and again, and the whole plane collapses onto one point, the only point the map leaves where it is. That's the contraction principle, and this part uses it four times: for Newton's method, for differential equations, and for the inverse and implicit function theorems. Equation after equation, the solution is the fixed point of a contraction.
Here's the plan, following chapter nine of Rudin's Principles. First the linear maps, and the derivative as a linear map, and why partial derivatives alone don't make one. Then the contraction principle, and what it builds: solutions of differential equations, and the inverse and implicit function theorems. We finish with mixed partial derivatives, one more swap of limits, and a guided tour of chapter ten.
1Linear maps and their normsUndergraduate3 min
Linear maps, the raw material of derivatives in many variables. A linear map of the plane respects addition and scaling. Watch what it does to a square grid: lines go to lines, equally spaced lines stay equally spaced, and the origin stays put. It's determined by where it sends the two unit vectors, and those images are the columns of its matrix.
How big is a linear map? Rudin measures it by the largest stretch: the norm of A is the supremum of the length of A x over unit vectors x. Run a unit vector around the circle and watch its image: the length of A x rises and falls. The images trace an ellipse, and the norm is its longest semi-axis, here about 2.03; the shortest is about 0.73. The norm is at most the square root of the sum of the squared entries, and it behaves like a length: the triangle inequality holds, and the norm of a product is at most the product of the norms. So the linear maps form a metric space of their own.
Which linear maps can be undone? Rudin's theorem 9.8: the invertible ones form an open set. Around an invertible A there's a ball of radius one over the norm of A inverse, and every map in it is invertible. That radius is the shortest semi-axis of A's ellipse. Push A along its weakest direction and the ellipse flattens. It collapses to a segment, and the map becomes singular, exactly when the push reaches the radius: the ball is as large as it can be.
One proof is a geometric series. Write B as A times the identity minus a small map; then B inverse is the sum of the powers of that small map, times A inverse, just as one over one minus q is the sum of the powers of q. The partial sums, drawn as images of the unit circle, close in on B inverse's ellipse, with the error shrinking geometrically. This little series comes back in Part 10, where it runs the theory of the spectrum.
2The derivative is a linear mapUndergraduate3 min
What the derivative becomes when there is more than one variable. Here's a function of two variables, drawn by its level curves, the way a map shows a landscape. Zoom in at a point. The curves straighten, and their spacing evens out. In the limit they become the level lines of a linear function: parallel, and equally spaced. That linear function is the derivative. In one variable, a curve under the microscope becomes a line; in two, a landscape becomes a tilted plane.
Rudin's definition: f is differentiable at x if some linear map A approximates the change in f so well that the error is small even compared with the size of the step: the error divided by the length of h goes to zero. That A is unique, and it is the derivative. Check it at our point. For each step length, try two hundred directions and record the worst ratio. On a log scale the ratios fall along a line of slope one: the error is of the order of the step squared, far smaller than the step itself.
With derivatives as linear maps, the chain rule says: the derivative of a composition is the composition of the derivatives, which for matrices is their product. Follow a small square. The first map bends it into a curvy quadrilateral, nearly the parallelogram its derivative predicts. The second map bends it again, and the result is nearly the parallelogram of the product of the two matrices.
In coordinates, the matrix of the derivative is the Jacobian, the array of partial derivatives. For a real-valued function it's a single row, the gradient. On the level-curve map the gradient points uphill, perpendicular to the curves, longest where they crowd together. The rate of change in a direction u is the gradient dotted with u. As u turns, that's a pure cosine of the angle: a linear function of the direction. Remember this shape: in the next chapter, a function will fail it.
So the dictionary from one variable to several: the derivative stops being a number and becomes a linear map; the tangent line becomes the best linear approximation; the chain rule multiplies matrices instead of numbers; and the mean value inequality survives on convex sets, with the norm of the derivative in place of the absolute value.
3Partial derivatives are not enoughUndergraduate2 min
Two exhibits for the museum, and the theorem that repairs the damage. The first exhibit: x y over x squared plus y squared, with value zero at the origin. Its colors show its values, and they depend only on the direction from the origin. Along both axes the function is identically zero, so both partial derivatives at the origin exist, and both are zero. But along the diagonal it equals one half, right up to the origin. So it isn't even continuous there, let alone differentiable. Partial derivatives only look along the axes, and a function can misbehave in every other direction.
The second exhibit is subtler: x squared y over x squared plus y squared. It is continuous, and at the origin it has a derivative in every direction, not just along the axes. Plot that directional derivative against the angle of the direction. If g were differentiable, this would be the gradient dotted with u, a pure cosine. The gradient is zero, so it would be flat. It isn't. Cos squared times sine is a quarter of sine theta plus a quarter of sine three theta, and the sine three theta part is not linear in the direction. No linear map fits, so there is no derivative: directional derivatives in every direction are not enough either.
The repair is Rudin's theorem 9.21: if the partial derivatives exist and are continuous, the function is continuously differentiable. The idea: to go from x to x plus h, move one coordinate at a time. On each leg only one variable changes, so the one-variable mean value theorem gives the change as a partial derivative at some point of that leg, times the step. If the partials are continuous, their values at those points are close to their values at x, and the change is the gradient dotted with h, up to an error small compared with h. In the museum, the partials jump at the origin, and the argument breaks.
4The contraction principleUndergraduate3 min
To solve cosine of x equals x, just iterate: start anywhere, apply the cosine, and apply it again. On the graph, bounce between the curve and the diagonal: the path spirals in on the crossing. Why it works: on this interval the cosine's slope is at most sine of one, about 0.84, so each application shrinks distances by that factor. The errors shrink geometrically, and the theorem we're about to prove even predicts a bound for them in advance, the last column. The solution is 0.7390851332, the only one there is.
The theorem, Rudin 9.23: on a complete metric space, a map that shrinks every distance by a factor c less than one has exactly one fixed point. Start anywhere and iterate. Each step is at most c times the one before, so the n-th step is at most c to the n times the first. Adding up the steps between the n-th point and any later one gives a geometric series: every later point lies in a disc of radius c to the n over one minus c times the first step. The discs shrink to nothing, so the sequence is Cauchy. The space is complete, so the points converge, and because the map is continuous, the limit is fixed. And two fixed points would have to be closer to each other than they are, so there's only one.
Completeness can't be dropped. The map x over two plus one over x sends rationals to rationals, and on the interval from one to two it shrinks distances by at least half. Iterate from one: three halves, seventeen twelfths, five hundred seventy-seven over four hundred eight. The iterates form a Cauchy sequence, but the point they close in on is the square root of two, the hole in the rationals from Part 1. Among the rationals, there is no fixed point at all.
And Newton's method from the opening is a contraction too. Its step is the map g of x equals x minus f over f prime, and at a simple root its derivative is zero. For the square root of two, g is flat where it crosses the diagonal, so near the root it shrinks distances by a factor as small as we like. That's why Newton's method is so fast: each step contracts harder than the one before, the error squares, and the number of correct digits doubles.
5Picard: differential equations in C[a, b]Applications3 min
The function space of Part 3 earns its keep. By the fundamental theorem of calculus, a differential equation with an initial value is the same as an integral equation. Read the right side as a machine T that takes a continuous function y and returns another one. Solutions are exactly the functions T leaves unchanged. If F is Lipschitz in y with constant L, then T shrinks sup distances by the factor L times h, the length of the interval. Here are two functions and their images: the largest gap shrinks to less than half. For h small, T is a contraction of the complete space C of zero h, Part 3's space, and the contraction principle hands us a solution, and only one.
Watch it work on the simplest equation, y prime equals y, starting from y equal to one. Start the iteration from the zero function. The first iterate is the constant one, the next is one plus t, then one plus t plus t squared over two. The Picard iterates are the Taylor polynomials of e to the t, and they converge to it uniformly. On the camera, each iterate is a single point, plotted by its values at one half and one, and the points march to the point of the exponential function.
Now an equation with no formula for its solution: y prime equals t plus sine y. The same iteration closes in on the solution, drawn in white from an independent numerical method. On the whole interval from zero to one, L times h is one, so T is not quite a contraction there, but a sharper estimate shows the k-th change is at most h to the k over k factorial times the first, which is even better than geometric. After twelve steps the iterate agrees with the numerical solution to about eight digits.
The Lipschitz condition is not a technicality. y prime equals twice the square root of y, starting from zero. The zero function solves it. So does t squared. So does the function that waits until any time c and then follows t minus c squared. Infinitely many solutions through one point. Peano's theorem, proved with Arzelà–Ascoli from Part 3, still gives existence for any continuous right side, but without the Lipschitz bound that makes T a contraction, uniqueness can fail.
6The inverse function theoremGraduate2 min
Here's the map that sends x, y to e to the x times cosine y, e to the x times sine y: the complex exponential, seen as a map of the plane. It wraps the strip on the left around the origin: vertical lines become circles, horizontal lines become rays. Its derivative is invertible everywhere, and near each point the map is one-to-one: a small square goes to a small curved square. But a square two pi higher lands in exactly the same place. The map can be undone near every point, and not globally. The inverse function theorem is precisely the local statement.
The theorem, Rudin 9.24: if f is continuously differentiable near a and its derivative at a is invertible, then f maps some neighborhood of a one-to-one onto a neighborhood of f of a, and the inverse is continuously differentiable too, with derivative the inverse matrix. The proof has four steps, and the first carries the weight. To solve f of x equals y, start at a and correct x by the linear guess: add A inverse times the remaining error. A fixed point of that correction is exactly a solution. Its derivative is the identity minus A inverse times f prime of x, which is zero at a and small nearby. So on a small ball it's a contraction, and the contraction principle finds the solution, and only one.
Here it is, run. Choose a target y near f of a. Start at a and apply the correction again and again. On the left, the iterates in the domain; on the right, their images, closing in on y. On the green ball, which holds every iterate, the correction map shrinks distances by a factor of at most 0.42, and here each error is about a third of the one before. If we updated A at every step, using the derivative at the current point, this would be Newton's method from the opening, and it would converge even faster.
7The implicit function theoremGraduate3 min
When an equation can be solved for some of its variables. The equation x cubed plus y cubed equals three x y defines a curve, the folium of Descartes. Does it define y as a function of x? Not globally, but often locally. Near the point two thirds, four thirds, a small window contains a piece of the curve that every vertical line meets exactly once: there it's the graph of a function g. Its slope is minus the ratio of the two partial derivatives, here 0.8. At the fold, the curve turns back, and vertical lines meet it twice or not at all: there's no function of x there. That's exactly where the partial derivative in y vanishes. And at the origin both partials vanish, and two branches cross.
The theorem, Rudin 9.28, here with one variable on each side: if f vanishes at a, b, and its partial derivative in y is not zero there, then near a the equation defines y as exactly one continuously differentiable function of x. It comes straight from the inverse function theorem. Build a map of the plane that keeps x and records the value of f. Near the point, it straightens the level sets of f into horizontal lines. Its derivative is a triangular matrix: vertical lines stay vertical, and its determinant is the partial derivative in y, so the inverse function theorem inverts it near a, b. The points where f is zero are the points that map to the x-axis, so the inverse, applied to the x-axis, traces the graph. Differentiating the identity f of x, g of x equals zero gives the slope: zero point eight here, the tangent we met on the folium.
The same circle of ideas gives Rudin's rank theorem, which we'll only picture. If the derivative of a map has the same rank everywhere, then in suitable coordinates the map is just a projection, which flattens each vertical line to a point. Here is a rank-one map before the coordinates are straightened. The rank is one: a whole family of lines in the plane, each collapsed to a single point, and the plane folded onto a curve.
8Mixed partials, and differentiating under the integralQualifying exam3 min
Two more interchanges of limits, one that fails and one that works. In Rudin's Exercise 9.27, a function has two mixed partial derivatives at the origin that disagree. Both come from one quantity: the second difference across a small rectangle with corners at the origin, divided by its area. For this function that quotient depends only on the rectangle's shape. A tall, thin rectangle gives minus one: that's differentiating in x first, then in y. A short, wide one gives plus one: the other order. The two iterated limits disagree, the same way as the grid of m over m plus n from Part 3.
The cure is continuity again. Rudin's theorem 9.41: if f x, f y and the mixed partial f x y exist near a point, and f x y is continuous there, then the other one exists and they're equal. The reason: by the mean value theorem, used twice, the second difference over h k equals f x y at some point inside the rectangle. Shrink the rectangle, whatever its shape, and that point is squeezed into the corner; if f x y is continuous, the quotient has only one possible limit. In the museum piece, f x y depends only on the direction: plus one along the x-axis, minus one along the y-axis. A flat rectangle's quotient is near plus one, a tall one's near minus one, so the mean-value point rides a different ray for each shape, however small the rectangle. The swap fails exactly where continuity does.
The swap that works is differentiation under the integral sign, Rudin 9.42: if phi and its partial derivative in t are continuous on a closed rectangle, the derivative of the integral is the integral of the derivative. The change in area between two nearby curves is the integral of the change in height; dividing by delta t and shrinking it is exactly the interchange. Try it on the integral of x to the t from zero to one, which is one over t plus one. Differentiating the answer gives minus one over t plus one squared; integrating the derivative of the integrand, x to the t times log x, gives the same numbers. A derivative is a limit, so this is one more interchange of limits, made legal by the uniform continuity of Part 3. It's the swap Part 4 adds to the ledger.
9A tour of integration in many variablesApplications2 min
Chapter nine is a guided tour of Rudin's tenth chapter, integration in many variables. We'll state and picture the main results, and check them numerically, but we won't prove them.
First, the change of variables formula. When a one-to-one, continuously differentiable map T, with nonzero Jacobian, reshapes a region, integrals pick up a factor: the absolute value of the determinant of T's derivative. Here's why. Cut the region into small squares; each becomes, nearly, the parallelogram of the derivative, whose area is the determinant times the square's area. Computed for all sixty-four cells, the ratio of the true area to the determinant's prediction is one, to within a few millionths.
Second, partitions of unity: continuous bumps, each living inside one small piece of a cover, that add up to exactly one on a compact set. Smooth ones exist too. They let us cut an integral into local pieces, do each piece in convenient coordinates, and add the results.
The summit of the chapter is Stokes' theorem: the integral of a form over the boundary of a region equals the integral of its exterior derivative over the region. Green's theorem, the divergence theorem and the classical Stokes theorem are all special cases. In the plane, with the right form, it says that the area of a region is a line integral around its edge. Walk once around the loop of the folium from chapter seven, and the line integral gives its area: exactly three halves.
Last stop: a form with zero exterior derivative, a closed form, need not be the derivative of a function, an exact form. The classic example is the angle form in the plane with the origin removed. A loop that misses the hole gives zero. A loop around the hole gives two pi, which no exact form could: the angle can't be defined continuously all the way around. On a convex set this can't happen, which is Poincaré's lemma. Holes are detected by integrals: the beginning of topology, and a preview of Part 7's winding numbers.
The fourth row of the ledgerAll tracks2 min
Let's take stock. Linear maps have a norm, the largest stretch, and the invertible ones form an open set. The derivative is the linear map you see when you zoom in, and continuous partial derivatives always make one. The contraction principle solves equations by iteration in any complete space: differential equations in the space of continuous functions, and the inverse and implicit function theorems. Mixed partial derivatives commute when they're continuous, and derivatives pass through integrals. And chapter ten's tour ended at Stokes' theorem, where integrals detect holes.
The ledger's fourth row. The spaces: R n, and the continuous functions again. Completeness now pays off as fixed points of contractions. Compact sets are the same as before. The new swap: a derivative may pass through an integral when everything is continuous on a closed box. And Fourier's question hasn't moved; it waits for a better integral.
Next time, in Part 5, measure, and Lebesgue's integral. Raise cosine of m factorial pi x to a higher and higher even power, then let m grow. The functions are continuous, but in the limit they become Dirichlet's function: one at the rationals, zero elsewhere, which Part 3 showed has no Riemann integral. Lebesgue's integral handles it, and under it, limits pass through integrals without any uniformity at all.
This part followed chapter nine of Rudin's Principles of Mathematical Analysis, with a tour of chapter ten. Thanks for watching, and see you in Part 5.
Where it goes next. The geometric series for an inverse returns in Part 10, where it runs the theory of the spectrum. The angle form whose integral detects a hole previews the winding numbers of Part 7, and the ledger's unanswered question about Fourier series waits for the integral of Part 5.
Key results
The part's results in one place, for revision.
Try it
Lab 4 · One contraction, three equations
Iterate cos from a random start and check the error bound the contraction principle gives in advance; run Picard's iteration for y' = t + sin y and check the h^k/k! estimate; watch Newton's residuals square.
python -m videos.analysis.labs 4
needs numpy, scipy, matplotlib · download lab04.py ·
source on GitHubcos x = x from x0 = 0.637 x_60 = 0.7390851332 (0.7390851332)
error after 20 steps, and the bound 3.62e-05 <= 3.34e-02 (c = sin 1 = 0.8415)
x/2 + 1/x from 1, in Q 3/2, 17/12, 577/408, ... (p² - 2 = 2.5e-24, never 0)
Picard, y' = t + sin y: change at step 8 9.19e-08 <= first/8! = 2.48e-05
sup distance to solve_ivp after 12 steps 3.4e-11
Newton's residuals |F| 2.2e+00 2.0e-01 2.9e-03 6.1e-07 2.8e-14 1.1e-16
A contraction's fixed point comes with an error bound known before iterating; in C[0, 1] the same iteration solves a differential equation, and Newton's method contracts harder at every step.
The code (96 lines; it asserts its own result)
"""Lab 4: solve three equations by iterating a contraction: cos x = x, a differential equation, a system."""
from fractions import Fraction
from math import cos, factorial, sin
import numpy as np
from scipy.integrate import cumulative_simpson, solve_ivp
from videos.coursekit import labs
TITLE = "One contraction, three equations"
GOAL = ("Iterate cos from a random start and check the error bound the contraction principle gives in advance; run "
"Picard's iteration for y' = t + sin y and check the h^k/k! estimate; watch Newton's residuals square.")
TASKS = [
"Iterate x -> 2.5 cos x instead. The slope at the fixed point now exceeds 1: describe what the iteration does, and find the two points it settles on.",
"Run Picard's iteration for y' = 2 sqrt(y), y(0) = 0, from the starts y = 0 and y = t. Which solution does each start find, and which hypothesis failed?",
"Freeze the Jacobian at the starting point in Newton's method (the inverse function theorem's iteration) and compare the two convergence rates.",
]
def picard(y_start, t, steps, y0=0.5):
"""Picard iterates for y' = t + sin y, y(0) = y0: T(y)(t) = y0 + the integral from 0 to t of s + sin y(s)."""
ys = [y_start]
for _ in range(steps):
ys.append(y0 + cumulative_simpson(t + np.sin(ys[-1]), x=t, initial=0))
return np.array(ys)
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
# 1. cos x = x on [0, 1]: cos maps [0, 1] into itself and |cos'| <= sin 1 = c there.
c, x0 = sin(1.0), float(rng.uniform(0, 1))
xs = [x0]
for _ in range(60):
xs.append(cos(xs[-1]))
xs = np.array(xs)
star = 0.7390851332151607
err = np.abs(xs - star)
bound = c ** np.arange(61) / (1 - c) * abs(xs[1] - xs[0])
assert abs(xs[-1] - star) < 1e-9 and abs(cos(star) - star) < 1e-15
assert np.all(err <= bound + 1e-15), "the a priori bound c^n/(1 - c) |x1 - x0| holds at every step"
assert np.all(err[1:41] <= c * err[:40] + 1e-15), "each step shrinks the error by at least c"
lab.row("cos x = x from x0 = %.3f" % x0, f"x_60 = {xs[-1]:.10f} (0.7390851332)")
lab.row(" error after 20 steps, and the bound", f"{err[20]:.2e} <= {bound[20]:.2e} (c = sin 1 = {c:.4f})")
# 2. Completeness cannot be dropped: x/2 + 1/x keeps the rationals in Q and closes in on the hole at sqrt 2.
p, seq = Fraction(1), []
for _ in range(5):
p = p / 2 + 1 / p
seq.append(p)
assert seq[:3] == [Fraction(3, 2), Fraction(17, 12), Fraction(577, 408)] and all(q * q != 2 for q in seq)
lab.row("x/2 + 1/x from 1, in Q", f"{seq[0]}, {seq[1]}, {seq[2]}, ... (p² - 2 = {float(seq[4] ** 2 - 2):.1e}, never 0)")
# 3. Picard for y' = t + sin y, y(0) = 0.5 on [0, 1] (L = 1, h = 1), from a random constant start.
t = np.linspace(0, 1, 2001)
ys = picard(np.full_like(t, rng.uniform(-1, 2)), t, 14)
steps = np.abs(np.diff(ys, axis=0)).max(axis=1)
fact = np.array([steps[0] / factorial(k) for k in range(len(steps))])
ref = solve_ivp(lambda s, y: s + np.sin(y), (0, 1), [0.5], t_eval=t, rtol=1e-12, atol=1e-13).y[0]
gap = np.abs(ys - ref).max(axis=1)
assert np.all(steps <= fact * (1 + 1e-9) + 1e-13), "the k-th change is at most h^k / k! times the first"
assert gap[12] < 1e-7 and np.all(np.diff(gap[:12]) < 0), "the iterates converge to the solution"
lab.row("Picard, y' = t + sin y: change at step 8", f"{steps[8]:.2e} <= first/8! = {fact[8]:.2e}")
lab.row(" sup distance to solve_ivp after 12 steps", f"{gap[12]:.1e}")
# 4. Newton on the circle and the hyperbola: x² + y² = 4, xy = 1.
f = lambda q: np.array([q[0] ** 2 + q[1] ** 2 - 4, q[0] * q[1] - 1]) # noqa: E731
jac = lambda q: np.array([[2 * q[0], 2 * q[1]], [q[1], q[0]]]) # noqa: E731
q = np.array([2.5, 1.0]) + rng.uniform(-0.2, 0.2, 2)
res = [np.linalg.norm(f(q))]
for _ in range(6):
q = q - np.linalg.solve(jac(q), f(q))
res.append(np.linalg.norm(f(q)))
res = np.array(res)
assert np.all(res[1:5] <= 0.5 * res[:4] ** 2 + 1e-14) and res[5] < 1e-12, "the residual squares at each step"
lab.row("Newton's residuals |F|", " ".join(f"{r:.1e}" for r in res[:6]))
lab.note = ("A contraction's fixed point comes with an error bound known before iterating; in C[0, 1] the same "
"iteration solves a differential equation, and Newton's method contracts harder at every step.")
fig, ax = labs.figure(2, size=(11, 4.2))
n = np.arange(41)
ax[0].semilogy(n, bound[:41], "--", color=labs.GOLD, label="bound: cⁿ/(1 - c) · |x₁ - x₀|")
ax[0].semilogy(n, err[:41], "o-", ms=3, color=labs.BLUE, label="|xₙ - x*| for cos")
ax[0].semilogy(np.arange(len(res))[res > 1e-16], res[res > 1e-16], "s-", ms=4, color=labs.GREEN, label="Newton's residual |F|")
ax[0].set(title="Geometric for a contraction, squaring for Newton", xlabel="step n", ylim=(1e-16, 30))
ax[0].legend(loc="upper right")
k = np.arange(len(steps))
ax[1].semilogy(k, fact, "--", color=labs.GOLD, label="first change / k!")
ax[1].semilogy(k, steps, "o-", ms=3, color=labs.BLUE, label="sup |y_(k+1) - y_k|")
ax[1].semilogy(np.arange(len(gap)), gap, "o-", ms=3, color=labs.PINK, label="sup |y_k - solution|")
ax[1].set(title="Picard's iteration for y' = t + sin y in C[0, 1]", xlabel="iteration k")
ax[1].legend(loc="lower left")
lab.fig = fig
return lab
Now change it
- Iterate x -> 2.5 cos x instead. The slope at the fixed point now exceeds 1: describe what the iteration does, and find the two points it settles on.
- Run Picard's iteration for y' = 2 sqrt(y), y(0) = 0, from the starts y = 0 and y = t. Which solution does each start find, and which hypothesis failed?
- Freeze the Jacobian at the starting point in Newton's method (the inverse function theorem's iteration) and compare the two convergence rates.
Notes and sources
Sources
W. Rudin, Principles of Mathematical Analysis, 3rd ed. (1976); Real and Complex Analysis, 3rd ed. (1987); Functional Analysis, 2nd ed. (1991). Theorem numbers on screen are those editions'. Each part's credits scene lists the original authors and the companion texts.
About this partfrom its README
Part 4 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. This part covers chapter 9 of Principles of Mathematical Analysis (and a tour of chapter 10), in a hook, 9 chapters and an outro.
The derivative becomes a linear map: operator norms and the Neumann series, the derivative as the best linear approximation (a contour map zoomed until its level lines are straight), partial derivatives and their museum of failures, the contraction principle and Picard's existence theorem, the inverse and implicit function theorems built from one contraction, higher derivatives and the equality of mixed partials, and a labeled tour of differential forms and Stokes' theorem.
Every number the narration states is computed in compute.py and asserted; most scenes also assert the specific values they display.
What is computed and builtComputations (compute.py)
| Item | What is computed and asserted |
|---|---|
newton |
Newton's method on F(x, y) = (x^2 + y^2 - 4, xy - 1): iterates, residuals squaring each step |
linmaps |
the operator norm as the largest singular value (the unit circle's image is an ellipse); the Neumann series for an inverse, summed (Rudin 9.8) |
derivative |
the derivative as a linear map: tangent-plane residuals |
museum |
xy / (x^2 + y^2) (partials at 0, not continuous) and x^2 y / (x^2 + y^2) (directional derivatives in every direction, not linear in the direction: not differentiable) contraction cos x = x by iteration, errors under c^n / (1 - c) |
picard |
Picard iterates for y' = y and y' = x + sin y, sup distances shrinking geometrically |
inverse |
the inverse function theorem's contraction phi(x) = x + A^-1 (y - f(x)) for f = (e^x cos y, e^x sin y) |
implicit |
the folium x^3 + y^3 = 3xy traced by continuation; its fold where f_y = 0 |
mixed |
f = xy(x^2 - y^2)/(x^2 + y^2): f_xy(0, 0) = -1, f_yx(0, 0) = 1; differentiation under the integral |
forms |
area factors of a map on a grid against |
Chapter notes
0:00 Newton's method, and the contraction behind it
1:40 1. Linear maps and their norms
3:45 2. The derivative is a linear map
6:09 3. Partial derivatives are not enough
8:13 4. The contraction principle
10:35 5. Picard: differential equations in C[a, b]
12:59 6. The inverse function theorem
15:03 7. The implicit function theorem
17:12 8. Mixed partials, and differentiating under the integral
19:39 9. A tour of integration in many variables
21:49 The fourth row of the ledger
Chapter notes
| # | Scene | Chapter |
|---|---|---|
| 0 | Hook |
Newton's method, and the contraction behind it |
| 1 | LinearMaps |
1. Linear maps and their norms |
| 2 | Derivative |
2. The derivative is a linear map |
| 3 | Partials |
3. Partial derivatives are not enough |
| 4 | Contraction |
4. The contraction principle |
| 5 | Picard |
5. Picard: differential equations in C[a, b] |
| 6 | InverseFunction |
6. The inverse function theorem |
| 7 | ImplicitFunction |
7. The implicit function theorem |
| 8 | HigherOrder |
8. Mixed partials, and differentiating under the integral |
| 9 | FormsTour |
9. A tour of integration in many variables |
| 10 | Outro |
The fourth row of the ledger |
Build the film
python -m videos.analysis.analysis4.compute # the part's numbers, into .cache/analysis4
python tools/build.py analysis4 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py analysis4 Hook # one chapter, silent, with a contact sheet
Scenes: videos/analysis/analysis4. 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.analysis4.compute # once: every computed item (cached in .cache/analysis4)
python tools/build.py analysis4 -q k --fps 60 # the full-quality cut: 2160p60 + subtitles + chapters -> renders/analysis4_2160p.mp4
python tools/build.py analysis4 # 1080p30 -> renders/analysis4.mp4
python tools/build.py analysis4 -q l # fast 480p preview
python tools/export_script.py analysis4 # regenerate SCRIPT.md from the code
python tools/check_narration.py analysis4 # Whisper listen test of every narration line
The scenes share the series' instruments in explainer/analysis and helpers from earlier parts (see common.py). The full narration is in SCRIPT.md.