Up close, every smooth curve is almost a polynomial. Unit 6 showed you how to build that polynomial copy. This unit answers the two questions that come next: why does the copy work, and how wrong can it be? Both answers grow from one simple fact about a hiking trail. Then we step into two variables. There the copy's "bend" becomes a small table of numbers, the Hessian, and that table tells you whether a level spot is a valley, a peak or a mountain pass. That is the exact question a learning machine asks at the bottom of its valley.
≈ 90 min read + play9 interactive widgets · 5 in 3D · a judge you can dial17 inline checks🧾 17 proofs, step by step, tucked into drawers — Rolle, the mean value theorem, Taylor's remainder, the Hessian test✍ 12 solved practice problems
drag the landscape to orbit
1
Every smooth curve is secretly a polynomial — up close
Imagine this
Open a maps app and zoom right in on a winding ghat road. At full zoom, the road looks perfectly straight.
Zoom out a little. Now you see it bend, gently, like a smile. Zoom out more, and the bend itself starts to change: it tightens, then loosens.
Every smooth curve behaves like this. Up close, it is a straight line. A bit further out, it is a gentle bend. Further still, you need more detail.
That is the idea behind a Taylor polynomial. Pick one spot on the curve, x=a. We call it the anchor. Then copy what the curve is doing there, one fact at a time:
①its height — the value f(a);
②its slope, how steep it is — the derivative f′(a);
③its bend, how fast the slope is changing — the second derivative f′′(a);
④and so on: each new fact is "how fast the previous one changes".
Glue the facts together, dividing the k-th one by k! (read it "k factorial": 1×2×⋯×k). Out comes the polynomial copy you built in Unit 6:
A tiny example. Take f(x)=x with the anchor at 4. The height there is 2 and the slope is 41. So the straight-line copy says 4.2≈2+41(0.2)=2.05. The true value is 2.04939. Very close, but not exact.
That leaves two questions, and they are the whole of this unit:
?Why does it work? Why should a few facts at one spot give a good copy nearby?
?How wrong can it be? Not a hope, but a guarantee you can compute.
Both answers grow from one simple fact about a hiking trail. After that, we take the idea to two variables. There the "bend" becomes a small table of numbers called the Hessian, and that table tells a valley from a peak.
The realization
A Taylor polynomial is a copy built from a few facts at one spot: height, slope, bend, and so on. Each extra fact keeps the copy close for longer. What we still need is a promise about how close.
Pause & predict
The straight-line copy says 4.2≈2.05. The truth is 2.0494, a little smaller. The next piece of the copy uses the bend. Which way should it push the estimate?
In one sentence: a Taylor polynomial copies a curve's height, slope and bend at one spot, and this unit proves why that copy works and how far it can be trusted.
2
The flat spot — Rolle's theorem
Imagine this
You go on a trek. The first signboard says 1,000 m. After a day of ups and downs, the last signboard also says 1,000 m.
Somewhere on the way, the ground under your boots was perfectly level. Maybe at the top of a climb. Maybe at the bottom of a dip.
You can't be sure where. But you are sure it happened. You cannot go up and come back down without, for one moment, going neither up nor down.
This common-sense fact is called Rolle's theorem. The trail is the graph of a function f, from x=a to x=b. A level spot is a point c where the slope is zero: f′(c)=0 (read it: "the slope at c is zero").
The theorem needs three things. Each one is something any real trail has:
It needs
In everyday words
In symbols
No gaps
The trail never jumps. You walk every step of it.
f continuous on [a,b]
No sharp corners
The trail never turns at a pointed tip.
f differentiable on (a,b)
Same height at both ends
The first and last signboards match.
f(a)=f(b)
Then it promises: there is a c strictly between a and b with f′(c)=0.
A tiny example. Take f(x)=x2−2x from 0 to 2. Both ends have height 0. The slope is f′(x)=2x−2, and it is zero at c=1: the bottom of the dip.
Why "no sharp corners"? Picture a trail shaped like a V, such as ∣x∣. It goes down, then up, and ends at the same height. But at the bottom there is a sharp tip, and the slope jumps from −1 straight to +1. No step is ever level. Try it in the broken tab below.
The flat-spot hunterA hiker, a plank that tilts with the ground, and a rope between two flags. Where does the plank match the rope?
Try: Press ▶ hunt for c. The plank glows green where it runs parallel to the rope. Then open broken: same heights at both ends, but no level spot anywhere.
drag the picture to orbit
—
The rope's slope is the average slope. The plank's slope is the slope right here. The theorem says they match somewhere strictly between the flags.
The realization
If a smooth trail starts and ends at the same height, it has a level spot in between: f′(c)=0. All it needs is no gaps and no sharp corners. This one small fact will build the whole unit.
Pause & predict
The V-shaped trail f(x)=∣x∣ from −1 to 1 has no gaps, both ends at height 1, and a lowest point at 0. So why does Rolle's theorem not give a c with f′(c)=0?
In one sentence: a smooth trail with the same height at both ends must be level somewhere in between, and a sharp corner cancels the promise.
3
Average equals instantaneous — the mean value theorem
Imagine this
You drive 200 km on the expressway in exactly 2 hours. Your average speed is 100 km/h.
Did your speedometer ever show exactly 100? It must have. If you were always below 100, you could not cover 200 km in time. If you were always above 100, you would have covered more.
So at some moment, your speed right then matched your average speed for the whole trip.
This is the mean value theorem ("mean" just means average). On a graph, the average slope over a stretch is the slope of the straight line joining its two ends. That line is called the chord.
The theorem says: somewhere in between, the curve's own slope equals the chord's slope.
f′(c)=b−af(b)−f(a)
Read it: "the slope at some point c equals the rise divided by the run". It needs the same "no gaps, no sharp corners" as Rolle, but the ends may be at any heights.
A tiny example. Take f(x)=x2 from 1 to 3. The rise is 9−1=8 and the run is 2, so the average slope is 4. The slope of x2 is 2x, and 2c=4 gives c=2.
Rolle is the special case where both ends are at the same height, so the average slope is 0. And the proof runs the other way too. Tilt your head until the chord looks level, and the mean value theorem becomes Rolle. The middle tab of the flat-spot hunter above shows exactly this.
If you want the algebra · the mean value theorem, from Rolle
Prove it · the mean value theorem, from Rolle
Claim. If f is continuous on [a,b] and differentiable on (a,b), some c∈(a,b) has f′(c)=b−af(b)−f(a).
1
Name the average slope and build the chord — the straight line through the two endpoints:
m=b−af(b)−f(a),ℓ(x)=f(a)+m(x−a)ℓ is a straight line with slope m that passes through (a,f(a)); by the choice of m it also passes through (b,f(b)).
2
Subtract the chord from the function:
g(x)=f(x)−ℓ(x)=f(x)−f(a)−m(x−a)g is "how far f sits above its own chord". It inherits continuity and differentiability from f, because ℓ is as smooth as anything can be.
3
Check the two ends:
g(a)g(b)=f(a)−f(a)−0=0,=f(b)−f(a)−m(b−a)=f(b)−f(a)−(f(b)−f(a))=0The chord meets the curve at both ends, so the gap is zero at both ends. That is exactly Rolle's "same height" hypothesis — for g.
4
Apply Rolle to g: some c∈(a,b) has g′(c)=0. But g′(x)=f′(x)−m, so
0=g′(c)=f′(c)−m⟹f′(c)=m=b−af(b)−f(a).
That is the claim. ∎Tilting the picture by a straight line does not change where tangents are parallel to it. So the general theorem is the flat one in disguise.
Now rearrange the formula. It says something surprising:
f(b)=f(a)+f′(c)(b−a)
In words: height at b = height at a + slope × distance. That is the straight-line copy from Section 1. But here it is exact, as long as you use the slope at the right secret spot c, not at a.
Taylor's theorem is the same idea with more facts copied. Copy the slope, the bend and more at a, and let one secret point c soak up everything you left out.
The realization
Somewhere, the slope equals the average slope: f′(c)=b−af(b)−f(a). Rearranged, f(b)=f(a)+f′(c)(b−a). That is the straight-line copy, made exact by one secret point.
Pause & predict
Take f(x)=x3 from 0 to 2. The average slope is 2−08−0=4. Where is the point c with f′(c)=4?
In one sentence: somewhere on the way your instant speed equals your average speed, and written as a formula this is already a straight-line copy with no error.
4
The Rolle ladder — one flat spot per rung
Imagine this
Picture a relay race down a staircase, one runner per step. A runner may only run when she holds two tokens.
Every runner gets one token free, at the start line. The top runner also finds a second token at the finish line. So she runs, and drops a new token somewhere in between, for the runner one step below.
Now he has two tokens as well, so he runs and drops one for the next. Step by step, the dropped tokens creep toward the start.
In the maths, the runners are a function and its derivatives: F, then F′, then F′′, and so on. A token is a zero, a place where that function equals 0. And "running" is Rolle's theorem: two zeros of a function give a zero of its slope in between.
The free tokens at the start line mean this: at a, the function is zero and very flat. Its value and its first n−1 derivatives are all zero there. The token at the finish means F(b)=0:
F(a)=F′(a)=⋯=F(n−1)(a)=0,F(b)=0.
Then the tokens pass all the way down. The last runner, F(n), gets one too: there is a c between a and b with F(n)(c)=0. The lecture calls this Proposition P.
A tiny example with n=2. Take F(x)=x2(x−1) from 0 to 1. Here F(0)=F′(0)=0 and F(1)=0. Rung 1: F′(x)=3x2−2x is zero at c1=32. Rung 2: F′′(x)=6x−2 is zero at c2=31, between 0 and c1.
The Rolle ladderEach rung has two zeros, so Rolle hands one new zero down to the rung below — climb it
Try: Press ▶ climb and watch the zeros creep toward a: a<c3<c2<c1<b. Then drag b closer to a and watch every ck squeeze in.
—
Here F=f−P is the gap between f and a copy that is flat at a=0 and zero at b. The bottom rung's zero is where the leftover formula comes from.
If you want the algebra · Proposition P, one rung at a time
Prove it · Proposition P — n flat spots, nested
Claim. If F(a)=F′(a)=⋯=F(n−1)(a)=0 and F(b)=0, with Fn-times differentiable on (a,b) and the lower derivatives continuous on [a,b], then some c∈(a,b) has F(n)(c)=0.
1
Rung 1.F(a)=0=F(b): Rolle gives c1∈(a,b) with F′(c1)=0.
Two zeros of F at the ends, one flat spot of F in between. Standard Rolle.
2
Rung 2. Now look at F′. It is zero at a (given) and at c1 (rung 1). Rolle on [a,c1] gives c2∈(a,c1) with F′′(c2)=0.
The zero handed down from rung 1 plus the zero we were given at a are the two ends Rolle needs. The interval has shrunk: c2<c1.
3
Rung k, in general. Suppose F(k−1)(ck−1)=0 with ck−1∈(a,b), and k−1≤n−1 so that F(k−1)(a)=0 too. Rolle on [a,ck−1] gives
ck∈(a,ck−1)withF(k)(ck)=0.Same move each time: the zero at a is free (it was assumed), the other zero is inherited from the rung above. That is why we needed n−1 zero derivatives at a — one for each rung after the first.
4
After n rungs:
a<cn<cn−1<⋯<c1<b,F(n)(cn)=0.
Set c=cn. Done. ∎Each rung uses one Rolle and shrinks the interval toward a. The last rung needs no zero at a for F(n) — it only needs the inherited cn−1 and the free zero of F(n−1) at a.
The realization
Each Rolle step turns two zeros into one new zero, one derivative lower. If F is zero at b and flat to order n−1 at a, the zeros pass all the way down: F(n)(c)=0 for some c in between.
Pause & predict
Why must F's derivatives be zero at a up to order n−1? Why is F(a)=0 alone not enough?
In one sentence: a function that is very flat at a and zero at b passes one zero down per derivative, until its n-th derivative is zero somewhere in between.
5
Taylor's theorem, built by hand
Imagine this
At 9 a.m. your phone battery is at 80%. It is dropping 6% an hour, and the drop is getting faster by about 2% an hour, every hour.
Forecast 1 p.m. with just these three facts: 80−6×4−21×2×42=40%.
By 1 p.m. the real battery will differ a little. By how much? Taylor's theorem gives an exact answer: the error is what the next fact would add, if you measured it at the right moment during the morning.
Here is the plan, in plain words. We have a function f and a polynomial copy P. Its numbers (the coefficients) are not chosen yet.
1Measure the gap. Let F(x)=f(x)−P(x): how far the real curve is from the copy.
2Make the gap flat at a. Choose the first numbers so the gap, its slope, its bend… are all zero at a. This forces the famous Taylor numbers f(k)(a)/k!.
3Close the gap at b. Choose the last number so the gap is zero at b.
4Run the ladder. Now the gap fits Proposition P, so its n-th derivative is zero at some c. That one fact says the last number is f(n)(c)/n!.
Out comes Taylor's theorem. For some c strictly between a and b:
Read the leftover slowly. It looks exactly like the next term of the copy. The only change: the derivative is taken at a secret point c, not at a.
A tiny example. Copy ex at 0 with two terms: 1+x. At x=1 the copy gives 2, and the truth is e=2.71828. The leftover is 2ec⋅12=0.71828, so ec=1.43656 and c=0.3623. A real point, between 0 and 1, just as promised.
The gap function, pinned. For f=ex, a=0, n=3, b=2: the gap F=f−P leaves 0 perfectly flat (value, slope and bend all zero), dips, and returns to zero at b. The three nested flat spots are exactly where the ladder puts them.If you want the algebra · the three moves, step by step
Prove it · move 1 — flattening the gap at a fixes the first n coefficients
Claim.F(k)(a)=f(k)(a)−k!ak for k=0,1,…,n. So F(k)(a)=0 exactly when ak=k!f(k)(a).
1
Differentiate one power j times and evaluate at a:
dxjdj(x−a)kx=a=⎩⎨⎧0k!0j<kj=kj>kFewer differentiations than the power (j<k): a positive power of (x−a) survives, and it is 0 at a. Exactly k differentiations: the power is used up and leaves k(k−1)⋯1=k!. More than k: a constant differentiated again is 0. Only the term whose power matches the number of differentiations survives at a.
2
So the k-th derivative of P at a picks out one term:
P(k)(a)=j=0∑najdxkdk(x−a)ja=ak⋅k!Every other term in the sum is killed by step 1 — either it still has a factor (x−a), or it has already been differentiated to zero.
3
Therefore F(k)(a)=f(k)(a)−P(k)(a)=f(k)(a)−k!ak, and demanding F(k)(a)=0 for k=0,…,n−1 forces
ak=k!f(k)(a),k=0,1,…,n−1.
That is the claim. ∎This is where the Taylor coefficients come from — not from a formula handed down, but from the demand that the gap be flat. The k! is the factorial left behind by differentiating (x−a)kk times.
Prove it · move 2 — the last coefficient makes the gap zero at b
Claim. With a0,…,an−1 fixed by move 1, F(b)=0 holds exactly when
an=(b−a)n1(f(b)−k=0∑n−1k!f(k)(a)(b−a)k).
1
Write out F(b), separating the last term:
F(b)=f(b)−k=0∑n−1k!f(k)(a)(b−a)k−an(b−a)nThe first n coefficients are already known from move 1; only an is free.
2
Set F(b)=0 and solve for an:
an(b−a)nan=f(b)−k=0∑n−1k!f(k)(a)(b−a)k=(b−a)n1(f(b)−k=0∑n−1k!f(k)(a)(b−a)k).
That is the claim. ∎Divide by (b−a)n, which is not zero because b=a. Read it in words: an is "the gap left by the first n terms, per unit of (b−a)n". We do not yet know what an has to do with f's derivatives — that is move 3.
Prove it · move 3 — Taylor's theorem with the remainder
Claim. There is a c strictly between a and b such that
f(b)=k=0∑n−1k!f(k)(a)(b−a)k+n!f(n)(c)(b−a)n.
1
Differentiate F=f−P exactly n times. By step 1 of move 1, the n-th derivative of P is the constant n!an (every lower power has been differentiated away, and there are no higher ones):
F(n)(x)=f(n)(x)−n!anfor every x.A degree-n polynomial differentiated n times is a constant: its leading coefficient times n!.
2
Proposition P gives c∈(a,b) with F(n)(c)=0. At that c:
f(n)(c)−n!an=0⟹an=n!f(n)(c).The last coefficient — which move 2 defined as "the gap per unit (b−a)n" — is revealed to be the n-th derivative at a secret point, divided by n!. It has the same shape as every other coefficient; only the point where the derivative is taken has moved from a to c.
3
Substitute this an into move 2's equation F(b)=0, i.e. f(b)=∑k<nk!f(k)(a)(b−a)k+an(b−a)n:
f(b)=Taylor polynomial Pn−1(b)k=0∑n−1k!f(k)(a)(b−a)k+remainder Rnn!f(n)(c)(b−a)n.
That is the claim. ∎The polynomial part uses derivatives at a — things you can compute. The remainder uses one derivative at an unknown c — which you cannot compute, but can bound. For n=1 this is the mean value theorem, f(b)=f(a)+f′(c)(b−a); the whole construction is that theorem, repeated up a ladder.
Why the leftover gets small
Replace b by any x: f(x)= copy +n!f(n)(c)(x−a)n. The leftover has two parts you can see, and both help.
(x−a)n is tiny when x is close to the anchor. 1/n! shrinks very fast as you keep more terms. The part you can't see, f(n)(c), is stuck between the smallest and largest values of f(n) on the stretch. The next section turns that into a number.
The realization
Every smooth function is its copy plus one leftover term: f(x)=Pn−1(x)+n!f(n)(c)(x−a)n, exactly. The leftover looks like the next term, measured at a secret point. And the whole proof is Rolle, used again and again.
Pause & predict
In the proof, the last number was first chosen to close the gap at b. Then it turned out to equal f(n)(c)/n!. What did the theorem actually prove?
Pause & predict
Take f(x)=x3, anchor a=0, n=2, and b=2. The copy f(0)+f′(0)x is just 0, so all of f(2)=8 is leftover: 8=2!f′′(c)⋅22. What is c?
In one sentence: make the gap flat at a and zero at b, run the Rolle ladder, and the leftover turns out to be the next term measured at a secret point.
6
How big is the error? — the remainder in your hands
Imagine this
Your cab app can't know exactly where the traffic jams will be. But suppose it knows one thing: on this road, you never crawl slower than 20 km/h.
Then for a 10 km trip it can promise: at most 30 minutes. It never needed to know where the jams are. A worst case was enough for a guarantee.
The leftover has the same problem. We never find out the secret point c. But suppose we know the worst case: f(n) never gets bigger than some number M on the stretch. Then, wherever c is:
∣Rn(x)∣≤n!M∣x−a∣n
Read it: "the error is at most M, divided by n factorial, times the distance to the power n". You can work it out before you trust the copy.
A tiny example. Copy e0.1 with two terms: 1+0.1=1.1. On [0,0.1], the second derivative ex is at most e0.1<1.2, so take M=1.2. The promise: error ≤21.2×0.12=0.006. The true error is 1.10517−1.1=0.00517. Under the promise, as it must be.
The remainder detectiveCut the series, measure the error, and find the secret point c that explains it exactly
Try: Load √4.2 (Problem A3). Slide the order from 2 to 3 and watch the error drop from 0.0006 to 0.000015. Then drag x far from the anchor and watch the shaded band grow.
—
The shaded band is the guarantee: the worst ∣f(n)∣ times ∣x−a∣n/n!. The gold dot is the secret c that makes the leftover formula exact.
If you want the algebra · the error bound in two lines
Prove it · the remainder bound
Claim. If ∣f(n)(t)∣≤M for every t between a and x, then ∣f(x)−Pn−1(x)∣≤n!M∣x−a∣n.
1
Taylor's theorem (with b=x) gives a c between a and x with
f(x)−Pn−1(x)=n!f(n)(c)(x−a)n.This is an equality, not an estimate. Everything uncertain is inside f(n)(c).
2
Take absolute values; c is between a and x, so the hypothesis applies to it:
∣f(x)−Pn−1(x)∣=n!∣f(n)(c)∣∣x−a∣n≤n!M∣x−a∣n.
That is the claim. ∎The only information used about c is where it lives. Whatever it is, the derivative there is at most M in size.
Two examples worth remembering
Small angles.cosx≈1−2x2. Every derivative of cos is at most 1 in size, and the first missing term is order 4 (the x3 term of cos is zero). So the error is at most 24x4. At x=0.5 that is 0.0026; the actual error is 0.00258.
The number e.e≈1+1+2!1+⋯+9!1 (ten terms). The error is at most 10!3≈8×10−7. Six correct decimals, from a sum you could do by hand. Practice Problem 4 works both in full.
The realization
You never need the secret point. If ∣f(n)∣≤M on the stretch, then ∣Rn∣≤n!M∣x−a∣n. A worst case turns the exact leftover into a guarantee you can compute.
Pause & predict
You copy sinx by just x. (The x2 term of sin is zero, so this copy already includes it.) At x=0.3, what is the best guarantee?
In one sentence: you never learn c, but a worst-case size M for the next derivative turns the leftover into a firm promise, ∣Rn∣≤M∣x−a∣n/n!.
7
MacLaurin's series — and why the factorial always wins
Imagine this
Rahul and Priya each start a game with ₹1. Rahul's money is multiplied by 5 every day. That multiplier never changes.
Priya's money is multiplied by the day number: ×1 on day 1, ×2 on day 2, ×3 on day 3, and so on. For the first few days Rahul's multiplier is bigger. From day 6 on, Priya's is bigger, and it keeps growing.
After n days Rahul has 5n, a power. Priya has 1×2×⋯×n=n!, a factorial. Rahul leads early, but in the long run the factorial always wins.
A Taylor series anchored at 0 has its own name: a MacLaurin series. Two famous ones. For ex, every derivative is ex again, so every derivative at 0 is 1:
ex=1+x+2!x2+3!x3+⋯
For cosx, the derivatives at 0 go round in a cycle: 1,0,−1,0,1,…. Only even powers survive, with signs taking turns:
cosx=1−2!x2+4!x4−6!x6+⋯
A tiny example: e≈1+1+21+61=2.667. The true value is 2.718. Add more terms and you get closer.
But does the endless sum really reach the function? The leftover answers it. For ex the leftover is at most e∣x∣n!∣x∣n. So everything rests on n!∣x∣n: Rahul's money divided by Priya's. At x=5 the terms grow for a while (1,5,12.5,20.8,26.0), then the factorial takes over and they crash.
The factorial winsOne glowing tower per term, on a log scale. They rise, peak, then crash, because n! outgrows every power
Try: Press ▶ race: each tower is the last one times ∣x∣/(n+1). Push x to 5 for a bigger hump. Then try ln(1 + x) with x>1: the towers never come down.
drag the picture to orbit
—
Bright towers are the terms you kept. The orange beads show the error still left. Once n+1 passes ∣x∣, every tower is shorter than the one before.
If you want the algebra · why the factorial beats every power
Prove it · the factorial beats every power
Claim. For any fixed x, n!∣x∣n→0 as n→∞. Hence the MacLaurin series of ex, sinx and cosx converge to the function at everyx.
1
Look at how each term grows into the next:
∣x∣n/n!∣x∣n+1/(n+1)!=n+1∣x∣.Going from term n to term n+1 multiplies the power by ∣x∣ (the same number every time) and the factorial by n+1 (a number that keeps growing).
2
Once n+1≥2∣x∣, each step multiplies the term by at most 21. So beyond that point the terms shrink at least as fast as 21,41,81,… times a fixed number — and that goes to zero.
Before the crossover the terms may grow (the "hump" in the widget: for x=5 the largest term is at n=4 or 5); after it they are halved, at least, every step.
3
For ex: ∣Rn∣≤e∣x∣∣x∣n/n!→0. For sinx and cosx: every derivative is bounded by 1, so ∣Rn∣≤∣x∣n/n!→0. In each case Pn−1(x)→f(x): the series converges to the function everywhere. ∎Contrast ln(1+x)=x−2x2+3x3−⋯: its terms shrink only like ∣x∣n/n — no factorial in the denominator — and for ∣x∣>1 they grow. Taylor's remainder is what tells you the difference between "trust it everywhere" and "trust it only near the anchor". Unit 6 saw the cliff at x=1; now you know why it is there.
The realization
Each new term is the previous one times n+1∣x∣. Once n+1 is bigger than ∣x∣, every step shrinks the term. So the series for ex, sinx and cosx can be trusted at everyx. For ln(1+x) there is no factorial, and past x=1 it fails.
Pause & predict
For ex at x=5, the terms 5n/n! first grow, then shrink. Which term is the largest?
In one sentence: a MacLaurin series is Taylor at 0, and the series for ex, sinx and cosx always settle down because n! eventually grows faster than any ∣x∣n.
8
Two variables — walk along a line and it is one variable again
Imagine this
When you plan a walk or a bike ride on a maps app, it can show an elevation profile: a simple graph of height against distance along your route.
The land itself is two-dimensional and full of hills. But along one route, it becomes a single curve, and you can read it like any school graph.
That is the whole trick for two variables. Now the function is a landscape: z=f(x,y) is the height at the point (x,y).
Stand at P=(a,b). You want the height at a nearby point S=(a+h,b+k): h steps east, k steps north. Walk from P to S in a straight line, with a clock t that reads 0 at P and 1 at S. Your height along the walk is:
F(t)=f(a+th,b+tk)
This F is an ordinary one-variable function: the elevation profile. So everything from the first half of the unit works on it. The chain rule gives its slope and its bend (the proofs are in the drawer below):
F′=hfx+kfy,F′′=h2fxx+2hkfxy+k2fyy
Here fx (read: "the slope in the x-direction") and fy are the two slopes. fxx, fxy and fyy say how those slopes change: the landscape's bend.
Put these into one-variable Taylor with two terms plus the bend, and you get the landscape's copy, the quadratic clone. Everything on the right is measured at P:
f(a+h,b+k)≈f+hfx+kfy+21(h2fxx+2hkfxy+k2fyy)
A tiny example: f=exsiny at P=(0,0). There f=0, fx=0, fy=1, fxx=0, fxy=1, fyy=0. Step (h,k)=(0.1,0.2): the clone gives 0.2+21(2×0.1×0.2)=0.22. The truth is 0.21956.
The line trickWalk from P to S along a straight line and the surface becomes a one-variable curve — drag to orbit
Try: Load Problem A2: the clone misses the truth by only 0.00044. Then press double the step: the gap grows about tenfold.
drag the picture to orbit
—
The surface is f(x,y)=exsiny. The glowing curve is your walk from P to S, and the small chart unrolls it into the one-variable F(t). The glass sheet is the quadratic clone.
If you want the algebra · the walk's slope, its bend, and Taylor in two variables
Prove it · the first derivative along the walk
Claim.F′(t)=hfx+kfy, the partials evaluated at the current point (a+th,b+tk).
1
F is f composed with the straight-line map t↦(x(t),y(t)). Unit 6's chain rule for a path says
F′(t)=fxdtdx+fydtdy.Two routes from t to F — through x and through y — multiply along each route and add across them (Unit 7's two rules).
2
On a straight line the velocities are constants: dx/dt=h, dy/dt=k. So
F′(t)=hfx(a+th,b+tk)+kfy(a+th,b+tk).
That is the claim. ∎This is the directional derivative of Unit 6 in the direction (h,k): steepness of the landscape as felt by a walker moving with velocity (h,k).
Prove it · the second derivative along the walk
Claim.F′′(t)=h2fxx+2hkfxy+k2fyy, again at the current point.
1
F′=hfx+kfy is itself a function of the position on the walk, so apply the same chain rule to it:
F′′(t)=∂x∂F′dtdx+∂y∂F′dtdy=∂x∂(hfx+kfy)h+∂y∂(hfx+kfy)k.Same two routes, same two constant velocities h and k.
2
Differentiate inside the brackets, h and k being constants:
∂x∂(hfx+kfy)=hfxx+kfyx,∂y∂(hfx+kfy)=hfxy+kfyy.fyx means "first y, then x". For a twice continuously differentiable f, Clairaut's theorem says the order does not matter: fyx=fxy.
3
Multiply out and collect, using fyx=fxy:
F′′(t)=h(hfxx+kfxy)+k(hfxy+kfyy)=h2fxx+2hkfxy+k2fyy.
That is the claim. ∎A quadratic form in (h,k): the three second partials are its coefficients. This single line is the birthplace of the Hessian.
Prove it · Taylor in two variables, with its remainder
Claim. For some c∈(0,1),
f(a+h,b+k)=f(a,b)+hfx(a,b)+kfy(a,b)+21(h2fxx+2hkfxy+k2fyy)(a+ch,b+ck).
1
One-variable Taylor for F on [0,1] with n=2:
F(1)=F(0)+F′(0)(1−0)+2!F′′(c)(1−0)2,c∈(0,1).The theorem of the previous sections, applied to the walk. The remainder is evaluated at a secret clock-time c — i.e. at a secret point on the segment.
2
Substitute the three ingredients: F(1)=f(a+h,b+k), F(0)=f(a,b), F′(0)=hfx(a,b)+kfy(a,b), and F′′(c)=(h2fxx+2hkfxy+k2fyy) evaluated at (a+ch,b+ck).
That is the claim. ∎The first-order part is Unit 6's tangent plane. The second-order part is new: the landscape's curvature, packed into three numbers and one quadratic form. Replace the secret point by (a,b) and you get the quadratic cloneQ — the glass surface in the widget — with a third-order leftover, exactly as in one variable.
The realization
Walk in a straight line and a landscape becomes a one-variable curve F(t). Its bend is h2fxx+2hkfxy+k2fyy. Those three second slopes are the landscape's curvature, and they are where the Hessian is born.
Pause & predict
On f=exsiny, from P=(0,0), the step (0.1,0.2) gives clone 0.22 and truth 0.21956: a gap of 0.00044. Now double the step to (0.2,0.4). Roughly what happens to the gap?
Pause & predict
Why does the middle term appear as 2hkfxy, with a 2, while the others are just h2fxx and k2fyy?
In one sentence: along a straight walk the landscape is a one-variable curve, and its bend h2fxx+2hkfxy+k2fyy is where the Hessian comes from.
9
At a flat point, the second-order term decides
Imagine this
Open the spirit-level app on your phone and put it down in three places: at the bottom of a bowl, on top of a rounded hill, and in the middle of a mountain pass.
All three times it says the same thing: perfectly level.
So "level" alone can't tell a valley from a peak from a pass. To tell them apart, you need to know how the ground curves around you.
A critical point is a spot where the ground is level: both slopes are zero, fx=fy=0. At such a spot, the slope part of the clone is zero. Only the bend part is left, and it decides everything:
f(a+h,b+k)−f(a,b)=21Q,Q=h2fxx+2hkfxy+k2fyy
The left side is "how much higher you are after the step". So:
⌣Q>0 for every step: every step goes up. You are at the bottom of a bowl, a local minimum.
⌢Q<0 for every step: every step goes down. You are on a hilltop, a local maximum.
⤨Q>0 for some steps and Q<0 for others: a mountain pass, a saddle.
A tiny example: f=x2−y2 at (0,0). Here fxx=2, fxy=0, fyy=−2, so Q=2h2−2k2. A step east (1,0) gives +2: up. A step north (0,1) gives −2: down. A saddle.
The step, seen from above. From a flat point P, a step (h,k) to S changes the height by 21Q, where the quadratic form is evaluated at a secret point on the segment. Whether that is up or down is the question the Hessian will answer.
One small worry. Strictly, Q is measured at a secret point on the way, not at P itself. For small steps it doesn't matter. The secret point is so close to P that the sign stays the same. So the three numbers at the critical point decide.
If you want the algebra · why the secret point cannot flip the sign
Prove it · the secret point cannot flip the sign
Claim. Suppose the second partials are continuous and Q0(h,k)=h2fxx(a,b)+2hkfxy(a,b)+k2fyy(a,b) is positive for every direction (h,k)=(0,0). Then for all sufficiently small steps, f(a+h,b+k)−f(a,b)>0. (The negative case is identical with signs flipped.)
1
Scale out the step size. Write (h,k)=r(u,v) with u2+v2=1 and r>0. Then Q0(h,k)=r2Q0(u,v), and Q0(u,v) is a continuous function on the unit circle, which is closed and bounded, so it attains a minimum m. Because Q0>0 at every point of the circle, m>0.
A quadratic form's sign does not depend on the length of the step, only on its direction. The minimum over directions exists and is positive — that is the number the argument hangs on.
2
Compare the secret point with the anchor. The coefficients fxx,fxy,fyy are continuous, so there is a radius ρ such that within distance ρ of (a,b) each coefficient differs from its value at (a,b) by less than m/4. For the form at the secret point this gives, for any unit direction,
Qc(u,v)−Q0(u,v)≤∣u2∣4m+∣2uv∣4m+∣v2∣4m≤4m(1+1+1)<m.Using u2≤1, v2≤1, ∣2uv∣≤u2+v2=1. The secret point lies on the segment, hence within r<ρ of the anchor, so the estimate applies to it.
3
Hence Qc(u,v)>Q0(u,v)−m≥m−m=0 for every direction, and so
f(a+h,b+k)−f(a,b)=21r2Qc(u,v)>0whenever 0<r<ρ.
That is the claim. ∎"Sufficiently small" means r<ρ, a definite radius that depends only on how fast the second partials change. Inside that radius, the anchor's three numbers rule.
The realization
At a level spot, the height change after a small step is 21Q. If Q is always positive, it's a valley; always negative, a peak; both, a pass. The three second slopes at the spot decide which.
Pause & predict
At a critical point, why can the slope part never help you tell a minimum from a maximum?
In one sentence: at a level spot the slope part is zero, so the bend Q alone decides whether you are in a valley, on a peak, or at a pass.
10
Taylor in matrix form — and how to remember it
Imagine this
Think of a sandwich, or a vada pav: bread, filling, bread.
The formula in this section has exactly that shape. The step you take is the bread, on both sides. A small table of curvatures is the filling. Bite through all three, and you get one number: how much the ground bends along your step.
Three numbers, fxx, fxy and fyy, decided everything in the last section. Let's give them a home: a 2×2 table called the Hessian, H:
H=[fxxfxyfxyfyy]
It is symmetric: fxy sits in both corners, because the order of the two derivatives doesn't matter.
Now make the sandwich. Put the step h=(h,k) on both sides of H (the little ⊤ means "lay the column on its side as a row"):
That is exactly the walk's bend Q. The two corner entries each give hkfxy, and together they make the 2hkfxy.
A tiny example: H=[2112] and h=(1,−1). Then h⊤Hh=2(1)2+2(1)(−1)(1)+2(−1)2=2−2+2=2.
With the Hessian, the whole Taylor formula fits on one line, for any number of variables. It looks just like the one-variable version. Here ∇f (read: "grad f") is the gradient, the list of all the slopes:
f(x0+h)≈f(x0)+∇f⊤h+21h⊤Hh
How to remember it: move each piece up one level, and feed it one copy of the step for each level.
Piece
One variable
Many variables
Copies of the step
height
a number, f(a)
a number, f(x0)
none
slope
a number, f′(a)
a list, the gradient ∇f
one: ∇f⊤h
bend
a number, f′′(a)
a table, the Hessian H
two: h⊤Hh
Rule of thumb: every term must end up as one plain number. A list needs one copy of the step to become a number. A table needs two, one on each side. The 21 is 1/2!, exactly as before.
The rank ladder. Promote each derivative by one rank — number, list, table — and feed it as many copies of the step h as it has indices. The shapes do the remembering for you.
The sandwich, unwrappedhᵀHh looks compact — hover an entry of H to see which part of the sum it makes
Try: Hover the two corner entries f12 and f21: both make the same product h1h2. That is the 2 in 2hkfxy. Then try three variables.
—
Each entry of H is multiplied by the step part of its row and of its column. Mirror-image entries give the same product, so they merge.
If you want the algebra · the matrix form, for any number of variables
Prove it · the matrix form, from the line trick, for any number of variables
Claim. For F(t)=f(x0+th): F′(t)=∇f⊤h and F′′(t)=h⊤Hh, both evaluated at x0+th. Hence f(x0+h)=f(x0)+∇f(x0)⊤h+21h⊤H(x0+ch)h for some c∈(0,1).
1
Along the walk the i-th coordinate is xi(t)=x0,i+thi, so dxi/dt=hi. The chain rule with n routes (Unit 7's add-across-paths, one path per coordinate):
F′(t)=i=1∑n∂xi∂fdtdxi=i=1∑nfihi=∇f⊤h.A sum of (partial) × (step component) over one index is exactly a dot product — a row times a column.
2
Differentiate again. Each fi is itself a function of position on the walk, so it gets its own chain rule with the same constant velocities:
F′′(t)=i=1∑nhidtdfi=i=1∑nhij=1∑n∂xj∂fihj=i=1∑nj=1∑nhiHijhj=h⊤Hh.A double sum of (entry) × (left step component) × (right step component) is exactly a row × matrix × column. Here Hij=∂2f/∂xj∂xi=∂2f/∂xi∂xj by Clairaut, which is why H is symmetric and why the two cross terms h1h2H12 and h2h1H21 merge into 2h1h2H12 in two variables.
3
Apply one-variable Taylor with n=2 to F on [0,1]: F(1)=F(0)+F′(0)+21F′′(c) for some c∈(0,1). Substitute steps 1 and 2:
f(x0+h)=f(x0)+∇f(x0)⊤h+21h⊤H(x0+ch)h.
That is the claim. ∎Nothing about the argument used n=2. The matrix form is not a new theorem — it is the one-variable theorem read along a line, with the chain rule turning derivatives into a gradient and a Hessian. Keep going and the third derivative would be an n×n×n cube of numbers eating three copies of h; linear algebra stops being comfortable there, which is exactly why "second-order" is where most of optimisation stops too.
The realization
f(x0+h)≈f(x0)+∇f⊤h+21h⊤Hh. It is the one-variable formula with each piece moved up a level: number, list, table. The step goes in once for the list and twice, like bread, for the table.
Pause & predict
You remember f(a)+f′(a)h+21f′′(a)h2. Which is its many-variable version?
In one sentence: the Hessian packs the bends into a table, and the step sandwiches it, so many-variable Taylor reads exactly like the one-variable formula.
11
The judge of extrema — the Hessian
Imagine this
Put a marble on three shapes: a bowl, an upside-down bowl, and a potato chip shaped like a horse saddle.
In the bowl, any nudge rolls it back: a minimum. On the upside-down bowl, any nudge sends it rolling off: a maximum.
On the chip, it depends on the direction. Nudge it along the chip and it rolls back. Nudge it across and it falls off. That is a saddle.
At a level spot, the height change after a step is 21h⊤Hh. So "bowl, upside-down bowl, or chip?" becomes one question: is h⊤Hh positive for every step, negative for every step, or both?
In Unit 4's words: is Hpositive-definite, negative-definite, or indefinite? A small table of numbers has become a judge.
For a 2×2 Hessian there is a quick test. Work out one number, the discriminantD=fxxfyy−fxy2. (It is the determinant of H.) Then read the table:
D
fxx
Shape
Verdict
>0
>0
bowl
local minimum
>0
<0
upside-down bowl
local maximum
<0
any
saddle (the chip)
saddle point
=0
any
too flat to tell
no verdict
A tiny example: f=x2+xy+y2 at (0,0). Here fxx=2, fxy=1, fyy=2. So D=2×2−12=3>0 and fxx>0: a bowl, a local minimum.
The judgeThree numbers — fxx, fxy, fyy — decide bowl, dome, or saddle. Turn the dials and watch the landscape rule.
Try: Start from the bowl and slowly raise fxy. The bowl stretches and tilts. The moment fxy2 passes fxxfyy, it tears open into a saddle.
drag the picture to orbit
—
The surface is just the bend part at a level spot: z=21(fxxh2+2fxyhk+fyyk2). The three tabs read the same table three ways, and they always agree.
Why does D work? A bit of completing the square shows that fxxQ is a square plus D times another square. Squares are never negative, so the sign of D is in charge. The drawer has the details.
If you want the algebra · the judge's identity and the three verdicts
Prove it · the judge's identity
Claim.fxxQ=(hfxx+kfxy)2+(fxxfyy−fxy2)k2. Writing D=fxxfyy−fxy2 (the discriminant, which is detH): fxxQ=(hfxx+kfxy)2+Dk2.
1
Multiply the form by fxx:
fxxQ=h2fxx2+2hkfxxfxy+k2fxxfyy.Every term picks up one factor fxx. The first two now look like the start of (hfxx+kfxy)2.
2
Expand the square that those two terms suggest:
(hfxx+kfxy)2=h2fxx2+2hkfxxfxy+k2fxy2.It matches step 1 in the first two terms; the third term is k2fxy2 instead of k2fxxfyy.
3
Subtract step 2 from step 1; only the k2 terms survive:
fxxQ−(hfxx+kfxy)2=k2fxxfyy−k2fxy2=(fxxfyy−fxy2)k2=Dk2.
That is the claim. ∎The right side is a square plus D times another square. Squares are never negative — so the sign of fxxQ is controlled by the sign of D.
Prove it · the three verdicts
Claim. At a critical point: D>0,fxx>0⇒ local minimum; D>0,fxx<0⇒ local maximum; D<0⇒ saddle. D=0: no verdict.
1
D>0. Then fxx=0 (otherwise D=−fxy2≤0). By the identity, fxxQ=(square)+Dk2≥0, with equality only if both k=0 and hfxx=0, i.e. h=k=0. So for every non-zero step, fxxQ>0: Q has the sign of fxx.
fxx>0: Q>0 for all steps — every small step goes up — a bowl, a local minimum. fxx<0: Q<0 for all steps — a dome, a local maximum.
2
D<0, with fxx=0. Step along the x-axis, (h,k)=(1,0): Q=fxx. Step along (h,k)=(−fxy,fxx): the square in the identity is zero (−fxyfxx+fxxfxy=0), leaving fxxQ=Dfxx2<0, so Q has the sign opposite to fxx.
Two directions, two opposite signs: up one way, down another. That is a saddle. (If fxx=0 but fyy=0, run the same argument with the roles of h and k swapped; if both vanish, D=−fxy2<0 means fxy=0 and Q=2hkfxy already changes sign between (1,1) and (1,−1).)
3
D=0. The identity reads fxxQ=(hfxx+kfxy)2≥0: Q never changes sign, but it is zero along a whole direction, and there the second-order term says nothing — the decision passes to third- and fourth-order terms, which this test does not see. Practice Problem 8 shows x4+y4 (a minimum) and x4−y4 (a saddle) with the same zero Hessian. ∎"No verdict" is a fair answer, not a failure: the judge only hears second-order evidence.
Pause & predict
At a critical point you find fxx=−2, fyy=−2, fxy=1. What kind of point is it?
D is one way to read the table. Unit 4 gave you two more, and they always agree:
①Sylvester's test. Look at the top-left corners: first fxx alone, then the whole determinant D. Both positive means a bowl. For a 2×2 table, that is the D-test above.
②Eigenvalues. Turn slowly on the spot and feel how sharply the ground bends in each direction. The strongest bend and the weakest bend are the two eigenvaluesλ1≥λ2 of H. Both positive: bowl. Both negative: upside-down bowl. One of each: saddle.
And they fit together: D=λ1λ2. Two positives or two negatives give D>0; one of each gives D<0. The directions where the bend is strongest and weakest are the eigenvectors. The compass below lets you turn and feel it.
The curvature compassFace a direction θ and read how the ground bends that way — the rose that tells bowls from saddles
Try: Press ▶ sweep. On a saddle the needle crosses zero four times per turn; on a bowl, never. Then drag fxy and watch the longest and shortest spokes turn.
—
Green petals: the ground bends up in that direction. Red: it bends down. The longest and shortest spokes are the eigenvalues, pointing along the eigenvectors.
If you want the algebra · eigenvalues are the extreme bends, and the "upside-down" signs
Prove it · eigenvalues are the extreme curvatures, and their signs are the verdict
Claim. Let H be symmetric with eigenvalues λ1≥λ2 and orthonormal eigenvectors e1,e2. Then for every unit direction u, λ2≤u⊤Hu≤λ1, with equality along e2 and e1. Consequently H is positive-definite ⟺λ1,λ2>0, negative-definite ⟺ both negative, indefinite ⟺ opposite signs; and D=detH=λ1λ2, fxx+fyy=λ1+λ2.
1
Unit 4's spectral theorem: H=QΛQ⊤ with Q=[e1e2] orthogonal and Λ=diag(λ1,λ2). Write any direction in the eigenbasis, u=αe1+βe2, i.e. Q⊤u=(α,β)⊤. Then
u⊤Hu=(Q⊤u)⊤Λ(Q⊤u)=λ1α2+λ2β2.In the eigenbasis the cross term disappears: the quadratic form is just two squares, each weighted by an eigenvalue.
2
For a unit direction α2+β2=1, so λ1α2+λ2β2 is a weighted average of λ1 and λ2 with non-negative weights summing to 1. It therefore lies between them:
λ2≤u⊤Hu≤λ1,
with λ1 reached at α=1 (direction e1) and λ2 at β=1 (direction e2).
The compass rose is exactly this: the needle's reading swings between the two eigenvalues, touching them along the eigenvectors.
3
Signs. Q>0 for every direction ⟺ the minimum reading λ2>0⟺ both eigenvalues positive. Q<0 for every direction ⟺λ1<0. Opposite signs ⟺ the needle crosses zero ⟺ saddle.
Definiteness is a statement about the smallest (or largest) curvature, and those are eigenvalues.
4
Bridge to the discriminant: detH=det(QΛQ⊤)=detΛ=λ1λ2=D, and trH=fxx+fyy=λ1+λ2. So D<0⟺ opposite signs ⟺ saddle; and D>0 with fxx>0 forces fyy>fxy2/fxx≥0, hence λ1+λ2>0 with λ1λ2>0: both positive. The three readings of H — discriminant, Sylvester, eigenvalues — are one verdict. ∎Which reading to use is a matter of convenience: D is fastest by hand; eigenvalues also tell you how bowl-shaped (their ratio is the condition number that will govern gradient descent in Unit 9); Sylvester scales to n×n Hessians where "D" no longer exists.
Prove it · negative-definite means the minors alternate
Claim.H is negative-definite ⟺fxx<0 and D>0 — the leading minors alternate in sign, starting negative.
1
H is negative-definite exactly when −H is positive-definite (multiply h⊤Hh<0 by −1).
A dome flipped upside down is a bowl.
2
Apply Sylvester to −H=[−fxx−fxy−fxy−fyy]: its minors are −fxx and det(−H)=(−1)2detH=D. Both must be positive: fxx<0 and D>0.
That is the claim. ∎Flipping the sign of a k×k block multiplies its determinant by (−1)k — that is why, for a larger Hessian, the minors of a negative-definite matrix alternate: negative for odd k, positive for even k. The eigenvalues are all negative, as the lecture says.
The realization
The Hessian is the judge. Work out D=fxxfyy−fxy2: positive with fxx>0 is a bowl, positive with fxx<0 is an upside-down bowl, negative is a saddle. The eigenvalues say the same thing: they are the strongest and weakest bends, and D=λ1λ2.
Pause & predict
A Hessian has eigenvalues λ1=7.24 and λ2=2.76 at a critical point (Practice Problem 7). Without working out anything else, what do you know?
Pause & predict
For f=exsiny at (0,0), the Hessian is [0110]: both pure bends are zero. Is the ground flat there, or a saddle?
In one sentence: the Hessian's discriminant, its corner determinants and its eigenvalues are three ways to read one verdict — bowl, upside-down bowl, or saddle.
12
The judge at work — six landscapes
Imagine this
A trekking map of a hill station marks the special spots: peaks, lake beds and passes.
The map-maker finds them all the same way. First she finds every level spot. Then she checks how the ground curves around each one, one spot at a time.
That is the whole recipe. Three moves, every time:
1Find the level spots. Solve fx=0 and fy=0 together.
2Work out fxx, fxy, fyy at each spot separately. For anything beyond a simple bowl, they change from spot to spot.
3Read D, then fxx. Give the verdict.
The widget has six landscapes: the companion's two worked examples, the practice set's landscapes, and two where the judge must stay silent.
The critical-point hunterSix landscapes from the companion and the practice set: find every flat point, then let the Hessian judge it — drag to orbit
Try: Load x³ + y³ − 3xy + 1: two level spots, one saddle and one minimum. Click each dot and compare. Then load the two x4 landscapes, where the Hessian is all zeros and stays silent.
drag the picture to orbit · tap a dot to select it
—
For each landscape the widget solves ∇f=0, then judges every level spot with its own Hessian. The glass shell is the quadratic clone at the chosen spot.
One formula, two verdicts
Take f=x3+y3−3xy+1. Move 1:fx=3x2−3y=0 and fy=3y2−3x=0 give y=x2 and x=y2. So x=x4, and the level spots are (0,0) and (1,1).
Moves 2 and 3: here fxx=6x, fxy=−3, fyy=6y. At (0,0): D=0−9=−9, a saddle. At (1,1): D=36−9=27 with fxx=6>0, a local minimum, with height 0.
Only local, though: at (−2,0) the height is −7, lower still. The judge only rules on the spot's close neighbourhood.
Now the two landscapes where the judge must stay silent: g=x4+y4 and h=x4−y4. Both have one level spot, the origin, and there every second slope is zero, so D=0.
Yet they are different shapes. g is never negative and is zero only at the origin: a minimum. h goes up along the x-axis and down along the y-axis: a saddle. The difference is in the fourth-order terms, which the Hessian cannot see. When D=0, you need another test: look at higher terms, or reason about the function's shape directly.
The realization
Find every level spot. Work out the Hessian at each one, because it changes from place to place. Read D, then fxx. And when D=0, the bends have run out of evidence, so look further.
Pause & predict
For f=x3−3xy+3y2 (Practice Problem 6), the level spots are (0,0) and (21,41), with fxx=6x, fxy=−3, fyy=6. Which verdict goes where?
In one sentence: find every level spot, judge each one with its own Hessian, and when D=0 admit that the bends cannot decide.
13
Why a learning machine cares — curvature, conditioning, and the saddle problem
Imagine this
You are walking down into a long, narrow valley in thick fog. You can only feel the slope under your feet.
The side walls are steep, but the valley floor slopes gently. So each downhill step points mostly at the nearest wall. You bounce from wall to wall, and crawl along the valley.
This is how a learning machine trains.
Training is walking downhill. The machine's error, called the lossL(w), depends on millions of weights w. Every step of gradient descent (Unit 9) is a step down that landscape. At the bottom the slopes are zero, and the Hessian is the judge from this unit. All eigenvalues positive: a true minimum. Mixed signs: a saddle you can still slide off.
The bends set the speed limit. Near the bottom, the loss is its own quadratic clone. The steepest bend λmax forces small steps, or you overshoot across the valley. The gentlest bend λmin then makes progress along the floor painfully slow. The ratio λmax/λmin, the condition number, says how narrow the valley is. Momentum, RMSProp and Adam (Unit 11) are all ways to cope with a bad Hessian without ever computing it.
The clone suggests a jump. If you trusted the quadratic clone completely, you would not creep downhill. You would jump straight to the clone's lowest point. That is Newton's method, and its step is:
h⋆=−H−1∇f
Read it: "undo the bends, then go against the slope". Where the valley is steep, the step shrinks. Where it is flat, the step grows. For a perfect bowl, one jump lands exactly at the bottom.
If you want the algebra · Newton's step is the bottom of the clone
Prove it · Newton's step is the bottom of the quadratic clone
Claim. The quadratic clone of f at x0, Q(h)=f(x0)+∇f⊤h+21h⊤Hh, is minimised (when H is positive-definite) at h⋆=−H−1∇f.
1
Differentiate Q with respect to h, using Unit 7's cookbook (∇h(a⊤h)=a, ∇h(21h⊤Hh)=Hh for symmetric H):
∇hQ=∇f+Hh.The clone is a quadratic, so its gradient is linear in h.
2
Set it to zero and solve: Hh⋆=−∇f, so h⋆=−H−1∇f. The clone's Hessian is H itself, positive-definite, so this flat point of Q is its minimum — by this unit's own verdict. ∎Gradient descent moves along −∇f, scaled by a step size you must guess. Newton moves along −H−1∇f: the curvature rescales every direction — big steps where the valley is flat, small where it is steep. For a true quadratic it lands on the minimum in one jump. The price is H: for a million weights it is unaffordable, which is why the whole optimiser zoo exists.
Two ways down an elongated bowl. Contours of 21(9u2+v2), condition number λ1/λ2=9. Gradient descent (orange, step size 0.2) must keep its steps short for the steep axis, so it bounces between the walls and crawls along the valley; Newton's step (green) uses H−1 to rescale every direction and lands on the minimum at once. Unit 9 begins where the orange path does.
The realization
Near its bottom, a loss is its own quadratic clone. The Hessian's eigenvalues say how narrow the valley is, and so how hard plain descent will be. Its inverse turns the clone into Newton's one jump, −H−1∇f, which is powerful but costly for millions of weights.
Pause & predict
Gradient descent steps by −η∇f (η, read "eta", is a fixed step size). Newton steps by −H−1∇f. In a stretched bowl with λ1 much bigger than λ2, why doesn't Newton zig-zag?
In one sentence: near its bottom a loss is its own quadratic clone, so the Hessian decides how hard training is, and its inverse gives Newton's one-jump step.
14
What to carry forward
One level spot on a hiking trail built this whole unit. Everything else was the same move, Rolle, used again: tilted, stacked into a ladder, then walked along a line.
Idea
The one-line version
Where it returns
Rolle
Same height at both ends + smooth ⇒ a flat spot between
every existence argument in calculus
Mean value theorem
f(b)=f(a)+f′(c)(b−a) — Rolle, tilted
Unit 9 · why a descent step works
Taylor with remainder
f(x)=Pn−1(x)+n!f(n)(c)(x−a)n, c between a and x
every "local approximation" from here on
The bound
∣Rn∣≤M∣x−a∣n/n! — you never need c
numerical methods, error budgets
MacLaurin
Taylor at 0; ex,sin,cos converge everywhere because n! wins
Units 10–11 · second-order methods and why we avoid them
The realization
Every smooth function is, up close, a polynomial, and Taylor's theorem tells you exactly how far "up close" reaches. The leftover f(n)(c)(x−a)n/n! came from a ladder of level spots. In two variables, the bend part is a table, the Hessian, whose signs say whether a level spot is the bottom of a bowl. When a training run says it has found a minimum, this unit is how you can check.
In one sentence: Taylor copies a function near a point with a guaranteed error, and the Hessian in that copy judges every valley a learning machine finds.
15
Practice arena — the unit's problem set, solved in full
Twelve problems, each solved in full. Six come from the practice set (three on Taylor, three on the Hessian), three from the companion guide, and three are new: an error-bound workout (Problem 4), a hunt for the secret point c (Problem 5), and a proof workout for the judge's identity (Problem 12). Every number is machine-checked.
Two habits do most of the work. For a Taylor polynomial, list the derivatives at the anchor first, and keep the k!. For a critical point, work out the Hessian at each point separately, then read D first and fxx second.
Problem 1easy
Let f(x)=lnx. (a) Compute f and its first four derivatives at x=1. (b) Write the fourth-order Taylor polynomial P4(x) of f about the point a=1. (c) Use P4 to estimate ln1.1 and compare with the true value.
What this tests. The recipe itself — differentiate, evaluate at the centre, divide by k!, attach (x−a)k. Plan. Make a small table of derivatives first and evaluate every one at the centre before assembling anything; then look for the pattern in the coefficients, and finish by plugging in a nearby x to see the polynomial earn its keep.
Show the full solution
(a) Step 1 — differentiate four times. Each derivative of lnx is a power of x, so the pattern is easy to carry:
ff′′′=lnx,=2x−3,f′f(4)=x−1,=−6x−4.f′′=−x−2,
At the centre x=1 every power of x is 1:
f(1)=0,f′(1)=1,f′′(1)=−1,f′′′(1)=2,f(4)(1)=−6.
(b) Step 2 — divide by k! and attach the powers of (x−1). The coefficient of (x−1)k is f(k)(1)/k!:
1!f′(1)=1,2!f′′(1)=−21,3!f′′′(1)=62=31,4!f(4)(1)=−246=−41,
so
P4(x)=(x−1)−21(x−1)2+31(x−1)3−41(x−1)4.
The coefficients are (−1)k+1/k — the k! in the denominator has eaten the (k−1)! that the derivatives produced.
Step 3 — the quicker route. Put u=x−1. Then lnx=ln(1+u), whose MacLaurin series is a standard one:
ln(1+u)=u−2u2+3u3−4u4+⋯
Truncate at degree 4 and write u=x−1 back: the same P4, in one line, with no differentiation at all. Expanding about a is always the same as expanding about 0 in the shifted variable x−a.
(c) Step 4 — check at x=1.1, where u=0.1:
P4(1.1)=0.1−20.01+30.001−40.0001=0.1−0.005+0.000333−0.000025=0.095308.
The true value is ln1.1=0.095310; the error is 1.8×10−6, about the size of the first term we dropped, u5/5=2.0×10−6. Four terms, six correct decimals.
(a) f(1)=0,f′(1)=1,f′′(1)=−1,f′′′(1)=2,f(4)(1)=−6. (b) P4(x)=(x−1)−21(x−1)2+31(x−1)3−41(x−1)4. (c) P4(1.1)=0.095308 against ln1.1=0.095310, error 1.8×10−6.
Remember
The coefficient is f(k)(a)/k!, never f(k)(a) alone, and the variable is (x−a), never x. Those two slips lose most of the marks on this type. When the function is a shifted standard one — ln(1+u), eu, 1+u — substitute first and copy the known series.
Problem 2easy
Let f(x)=x, expanded about the point a=4. (a) Find the first-order (linear) polynomial P1(x) and the second-order (quadratic) polynomial P2(x). (b) Use each to estimate 4.2. (c) Explain why the quadratic estimate is the better one.
What this tests. That P1 is the tangent line, that P2 adds the curvature, and that the sign of f′′ tells you on which side of the curve the tangent sits. Plan. Compute f,f′,f′′ at the centre; halve f′′ when it becomes a coefficient; plug in the increment x−4=0.2 rather than x itself; compare both estimates with the true value at the end.
Show the full solution
(a) Step 1 — derivatives at the centre. With f=x1/2:
f(4)=2,f′(x)f′′(x)=21x−1/2=−41x−3/2⇒f′(4)=41,⇒f′′(4)=−41⋅81=−321.
Step 2 — assemble. The quadratic coefficient is f′′(4)/2!=−641, so
P1(x)=2+41(x−4),P2(x)=2+41(x−4)−641(x−4)2.
(b) Step 3 — plug in the increment h=x−4=0.2.P1(4.2)P2(4.2)=2+41(0.2)=2.05,=2.05−641(0.2)2=2.05−0.000625=2.049375.
The true value is 4.2=2.0493902. So P1 is off by +6.1×10−4 and P2 by −1.5×10−5 — about forty times closer.
(c) Step 4 — why the quadratic wins.P1 is the tangent line at x=4: it matches the height and the slope there but knows nothing about bending. Since f′′(4)=−321<0, the curve bends downward, so the tangent rides above it and drifts away — that is why P1's error is positive. The remainder formula says how far: with n=2 the error is 21f′′(c)h2 for some c between 4 and 4.2, and 21⋅321⋅0.04=6.25×10−4 — almost exactly the 6.1×10−4 we found. P2 puts that missing bend back in with the term −641h2, so what remains is the third-order piece
3!f′′′(4)h3=63/256(0.008)=5120.008=1.56×10−5,
which matches P2's leftover error to two figures (and its sign explains why P2 now sits just below the curve).
Step 5 — the binomial shortcut. Factor out the centre and use (1+t)1/2=1+21t−81t2+⋯ with t=h/4:
4+h=21+4h=2(1+21⋅4h−81⋅16h2+⋯)=2+4h−64h2+⋯
Both polynomials fall out at once.
(a) P1(x)=2+41(x−4), P2(x)=2+41(x−4)−641(x−4)2. (b) P1(4.2)=2.05, P2(4.2)=2.049375, true 2.0493902; errors 6.1×10−4 and 1.5×10−5. (c) f′′<0: the tangent sits above a curve that bends down; the quadratic term restores the bend.
Remember
f′′(a) is not the coefficient — f′′(a)/2 is. Writing −321(x−4)2 instead of −641(x−4)2 is the classic lost mark here. And always substitute the incrementx−a, not x: P1(4.2) uses 0.2, not 4.2.
Problem 3medium
Let f(x,y)=exsiny. (a) Compute ∇f and the Hessian H at (0,0). (b) Write the second-order Taylor polynomial Q(x,y) of f about (0,0). (c) Use Q to approximate f(0.1,0.2), compare with the exact value, and say where the error comes from.
What this tests. The two-variable quadratic clone — five partial derivatives, the 21 in front and the 2 on the cross term — and reading the Hessian as a shape. Plan. List all five partials before evaluating any; substitute the centre; assemble Q in the form value + gradient term + half the quadratic form; then evaluate and compare, and name the order of the first neglected term.
Show the full solution
(a) Step 1 — the five partials. The exponential survives every x-derivative; the sine cycles under y-derivatives:
fxfxx=exsiny,=exsiny,fyfxy=excosy,=excosy,fyy=−exsiny.
At (0,0), e0=1,sin0=0,cos0=1, so f=0,fx=0,fy=1,fxx=0,fxy=1,fyy=0:
∇f(0,0)=[01],H(0,0)=[0110].
(b) Step 2 — assemble the clone. With centre (0,0) the increments are h=x,k=y:
Q(x,y)=f+(fxx+fyy)+21(fxxx2+2fxyxy+fyyy2)=0+(0⋅x+1⋅y)+21(0+2⋅1⋅xy+0)=y+xy.
(c) Step 3 — the numbers.Q(0.1,0.2)=0.2+(0.1)(0.2)=0.22. Exactly,
f(0.1,0.2)=e0.1sin0.2=1.105171×0.198669=0.2195636,
so Q overshoots by 4.4×10−4.
Step 4 — where the error comes from. Multiply the one-variable series and keep track of total degree:
exsiny=(1+x+2x2+6x3+⋯)(y−6y3+⋯)=y+xy+degree 321x2y−61y3+⋯
This is the product-of-series shortcut: Q=y+xy appears with no Hessian at all. The first neglected terms are cubic, and at (0.1,0.2) they give 0.001−0.001333=−3.3×10−4; the quartic terms 61x3y−61xy3 add −1.0×10−4, and together they account for almost the whole gap of −4.4×10−4. Doubling the step to (0.2,0.4) gives f=0.475637 against Q=0.48, a gap of −4.4×10−3 — ten times larger for a step twice as long, exactly what a cubic-led error (23=8, plus the quartic share) predicts.
Step 5 — read the Hessian as a shape.H=[0110] has trace 0 and determinant −1, so its eigenvalues solve λ2−1=0: λ=±1. The pure curvatures fxx,fyy vanish and all the bending lives in the cross term — the quadratic part xy is a saddle, rising along y=x and falling along y=−x. (The origin is not a critical point, since fy=1, so this is a statement about the clone's shape, not a classification of an extremum.)
(a) ∇f(0,0)=(0,1)⊤, H(0,0)=[0110]. (b) Q(x,y)=y+xy. (c) Q(0.1,0.2)=0.22 against f=0.2195636; error 4.4×10−4, third order, mostly 21x2y−61y3.
Remember
The quadratic term is 21(fxxh2+2fxyhk+fyyk2) — a 21 outside and a 2 on the cross term. Dropping either is where this problem sheds marks. When both functions have known series, multiply them and truncate by total degree: it is faster and it also shows you the size of the next term.
Problem 4mediumadded — covers the remainder bound
Bound the lie. (a) The small-angle rule cosx≈1−2x2 is used at x=0.5. Using the remainder formula, bound the error before computing anything; then compute the actual error and compare. (b) How many terms of the MacLaurin series of ex are needed at x=1 to guarantee an error below 10−6? Confirm by summing.
What this tests. Using Rn=f(n)(c)(x−a)n/n! as a guarantee: choosing n, bounding ∣f(n)(c)∣ over the whole interval, and reading "how many terms" off a factorial. Plan. First decide which n the remainder formula should carry (count a zero coefficient as a kept term); replace the unknown c by the worst case on the interval; only then compute the true value and check that it sits inside the bound.
Show the full solution
(a) Step 1 — pick n honestly. The MacLaurin coefficients of cos are 1,0,−21,0,241,… because f′′′(0)=sin0=0. So 1−2x2 is not only P2 but also P3: the degree-3 term is present and equals zero. The remainder formula therefore applies with n=4:
R4(x)=4!f(4)(c)x4=24coscx4,cbetween0andx.
Step 2 — bound the unknown c away. Whatever c is, ∣cosc∣≤1, so
∣R4(0.5)∣≤240.54=240.0625=0.0026042.
That is a promise made before any cosine was evaluated: the rule cannot lie by more than 0.0026.
Step 3 — the actual error.cos0.5=0.8775826 and 1−20.25=0.875, so the error is 0.0025826 — inside the bound, and almost equal to it (ratio 0.99). The bound is nearly tight because cosc≈1 for every c in (0,0.5): the next term of the series, x4/24, is essentially the error. Had we lazily used n=3, the bound ∣sinc∣0.53/6≤0.0208 would still be true, but eight times looser.
(b) Step 4 — write the bound. Keeping the terms k=0,…,n−1 of ex=∑xk/k! leaves the remainder Rn=ecxn/n! with c∈(0,1). At x=1, ec≤e<3, so
∣Rn∣≤n!e<n!3.
Step 5 — find the first n that works.9!3=3628803=8.27×10−6(too big),10!3=8.27×10−7<10−6.
So n=10: keep the terms k=0,1,…,9 — ten terms, up to x9/9!.
Step 6 — confirm by summing.k=0∑9k!1=2.7182815againste=2.7182818,
an error of 3.0×10−7, below 10−6 as promised. And nine terms genuinely fail: ∑k≤81/k!=2.7182788, error 3.1×10−6. The bound was honest, not lazy.
(a) n=4: ∣R4∣≤0.54/24=0.0026042; actual error cos0.5−0.875=0.0025826, inside the bound. (b) 3/n!<10−6 first at n=10: ten terms (k=0,…,9); the sum is 2.7182815, error 3.0×10−7.
Remember
In the remainder formula n is one more than the highest degree you kept — and a zero coefficient still counts as kept, which is why 1−x2/2 earns the x4 bound. Two habits lose marks: bounding f(n)(c) by its value ata instead of its maximum over the interval, and confusing "number of terms" with "degree".
Problem 5easyadded — covers the secret c
Find the secret c. Take f(x)=x3 on [0,2], anchored at a=0. Taylor's theorem promises a c∈(0,2) with f(2)=Pn−1(2)+n!f(n)(c)2n. (a) For n=1 (the mean value theorem), find c. (b) For n=2, find c. (c) For n=3, what happens?
What this tests. That the c in the remainder is a definite number fixed by f, a, x and n — not a free parameter — and that it moves when n moves. Plan. Write the theorem with the given n, fill in every known value (f and its derivatives at the anchor, the power of x−a), and solve the one equation left for c; check it lands strictly inside the interval.
Show the full solution
(a) Step 1 — n=1 is the mean value theorem.f(2)−f(0)=f′(c)(2−0) with f′(x)=3x2:
8−0=3c2⋅2=6c2⇒c2=34⇒c=32=1.1547.
The negative root −1.1547 lies outside [0,2]; the positive one is inside, as promised. Check: the chord has slope 8/2=4, and f′(1.1547)=3⋅34=4. ✓
(b) Step 2 — n=2. Now P1(x)=f(0)+f′(0)x=0+0⋅x=0: at the anchor the cubic is flat, so its tangent line is the x-axis and the whole of f(2) is remainder. With f′′(x)=6x:
8=2!f′′(c)22=26c⋅4=12c⇒c=32.
Again c∈(0,2). The curvature that explains the climb to height 8 is the curvature measured at x=32.
(c) Step 3 — n=3.f′′′(x)≡6, so
R3(x)=3!f′′′(c)x3=66x3=x3=f(x)
for everyc. The remainder is the entire function: a cubic is its own degree-3 Taylor polynomial, so P3=f, R4≡0 and f(4)≡0. The theorem is true for all c at once and stops telling you anything.
Step 4 — c depends on n and on x. Redo (a) and (b) with a general endpoint x instead of 2: x3=3c2x gives c=x/3, and x3=3cx2 gives c=x/3. At x=2 these are 1.1547 and 0.6667; at x=1 they would be 0.5774 and 0.3333. The secret point slides with the endpoint and jumps when the order changes.
(a) c=2/3=1.1547. (b) c=2/3. (c) f′′′≡6 makes R3=x3=f(x): every c works, because a cubic equals its own P3. In general c=x/3 for n=1 and c=x/3 for n=2.
Remember
The theorem promises that some c strictly between a and x makes the formula exact; it does not tell you which one, and it changes with n and x. Marks go when a student sets c=a or c=x "for simplicity", or forgets the (x−a)n factor next to f(n)(c)/n!.
Problem 6medium
Let f(x,y)=x3−3xy+3y2. (a) Find all critical points. (b) Form the Hessian and classify each point with the second-derivative test. (c) State the local-minimum value, and confirm the classification by the eigenvalue route.
What this tests. The full routine — solve ∇f=0, build H, read D=fxxfyy−fxy2 and then fxx — at two points where the Hessian is not constant. Plan. Use the simpler gradient equation to eliminate a variable; keep H symbolic and only then substitute each point; write D's sign before fxx's; finish with trace and determinant for the eigenvalues as an independent check.
Show the full solution
(a) Step 1 — solve ∇f=0.∇f=(3x2−3y,−3x+6y). The second component gives x=2y; substitute into the first:
3(2y)2−3y=12y2−3y=3y(4y−1)=0⇒y=0ory=41.
Then x=2y gives the critical points (0,0) and (21,41).
(b) Step 2 — the Hessian, kept symbolic.fxx=6x,fxy=−3,fyy=6:
H=[6x−3−36],D=fxxfyy−fxy2=36x−9.
Step 3 — the verdicts. At (0,0): D=−9<0 ⇒ saddle (no need to look at fxx). At (21,41): D=36⋅21−9=9>0 and fxx=3>0 ⇒ local minimum.
(c) Step 4 — the value.f(21,41)=81−3⋅21⋅41+3⋅161=162−166+163=−161.
Step 5 — the eigenvalue route. At the minimum H=[3−3−36] has trace 9 and determinant 18−9=9, so its eigenvalues solve λ2−9λ+9=0:
λ=29±81−36=29±45=29±6.708=7.854,1.146,
both positive ⇒ positive-definite ⇒ a bowl. At the origin H=[0−3−36] has determinant −9, so λ=3±18=7.243,−1.243: opposite signs ⇒ indefinite ⇒ saddle. For a symmetric 2×2 matrix detH=λ1λ2, which is exactly why D<0 forces a saddle.
(a) (0,0) and (21,41). (b) (0,0): D=−9, saddle; (21,41): D=9,fxx=3, local minimum. (c) fmin=−161; eigenvalues there (9±45)/2≈7.854,1.146.
Remember
Ask D's sign first, then fxx's — a saddle needs no second question. The mark most often lost here: evaluating H once and reusing it, when fxx=6x changes from point to point. And fxx=0 at the origin does not make it "neither"; D=−9 already says saddle.
Problem 7medium
A model is trained by minimising the quadratic loss f(x,y)=2x2+2xy+3y2−4x−2y. (a) Find the unique critical point. (b) Show in two ways — Sylvester's criterion and the eigenvalues — that the Hessian is positive-definite, and conclude the point is the global minimum. (c) State the minimum value.
What this tests. That "positive-definite Hessian" can be certified by leading minors or by eigenvalue signs, and that for a quadratic a constant positive-definite Hessian makes the local minimum global. Plan. Solve the linear gradient system; write the constant H; check Δ1=fxx and Δ2=detH; get the eigenvalues from trace and determinant; evaluate f at the point, and if time allows complete the square to prove the minimum is global.
Show the full solution
(a) Step 1 — the critical point.∇f=(4x+2y−4,2x+6y−2)=0, i.e. 2x+y=2 and x+3y=1. From the first, y=2−2x; substitute:
x+3(2−2x)=1⇒−5x=−5⇒x=1,y=0.
The critical point is (1,0).
(b) Step 2 — Sylvester. Because f is quadratic the Hessian is the same everywhere:
H=[4226],Δ1=4>0,Δ2=detH=24−4=20>0.
Both leading principal minors are positive ⇒ H is positive-definite.
Step 3 — eigenvalues. Trace 10, determinant 20:
λ=210±100−80=5±5=7.236,2.764,
both positive ⇒ positive-definite again. Since H≻0 at every point, f is strictly convex: it has exactly one stationary point and that point is the global minimum.
(c) Step 4 — the value.f(1,0)=2−4=−2.
Step 5 — completing the square proves "global" by hand. Shift to the critical point with x=1+u,y=v:
f=2(1+u)2+2(1+u)v+3v2−4(1+u)−2v=−2+(2u2+2uv+3v2)=−2+2(u+2v)2+25v2≥−2,
with equality only at u=v=0. One manoeuvre certifies definiteness and pins the value.
Step 6 — how elongated is the bowl? The condition number λmax/λmin=7.236/2.764=2.618 (exactly (3+5)/2). The contours are ellipses whose axes are in the ratio 2.618≈1.62: steepest along the λ≈7.24 eigenvector, gentlest along the λ≈2.76 one. The larger this ratio, the more gradient descent zig-zags before it settles.
(a) (1,0). (b) H=[4226]: minors 4>0,20>0; eigenvalues 5±5≈7.236,2.764; H≻0 everywhere ⇒ global minimum. (c) fmin=−2; condition number ≈2.618.
Remember
Sylvester uses the leading minors: the top-left 1×1 entry and then the full determinant. Checking fyy>0 instead of fxx>0 is not the criterion (it happens to agree here). For a quadratic, H is constant, so positive-definite once means convex everywhere — and "local" upgrades to "global" for free.
Problem 8medium
Consider g(x,y)=x4+y4 and h(x,y)=x4−y4. (a) Show that for both, the origin is a critical point and the Hessian there is the zero matrix, so the second-derivative test is inconclusive. (b) Determine the true nature of the origin for each by a direct argument. (c) In one line, say why the Hessian could not tell them apart.
What this tests. What D=0 actually means — "no verdict", not "flat" — and how to classify a point when the quadratic clone is silent. Plan. Compute gradient and Hessian at the origin for both; when the test is silent, argue directly from the sign of the function (a global inequality, or two directions with opposite signs); the ray slice (tcosθ,tsinθ) is the systematic version of that.
Show the full solution
(a) Step 1 — gradients and Hessians.∇g∇h=(4x3,4y3),=(4x3,−4y3),HgHh=[12x20012y2],=[12x200−12y2].
At the origin both gradients vanish (critical point) and both Hessians are the zero matrix, so D=detH=0 for each: the test says nothing.
(b) Step 2 — g by a global inequality.g(x,y)=x4+y4≥0 for every (x,y), with equality only at the origin ⇒ a strict local (indeed global) minimum.
Step 3 — h by two directions. Along the x-axis, h(t,0)=t4>0; along the y-axis, h(0,t)=−t4<0. A point that is a minimum in one direction and a maximum in another is a saddle.
Step 4 — the ray slice does both at once. Put (x,y)=t(cosθ,sinθ):
gh=t4(cos4θ+sin4θ)=t4(1−21sin22θ)≥21t4>0,=t4(cos4θ−sin4θ)=t4cos2θ,
using cos4+sin4=(cos2+sin2)2−2sin2cos2 and cos4−sin4=(cos2−sin2)(cos2+sin2). Every ray of g climbs; the rays of h climb for ∣θ∣<45∘ and fall for 45∘<θ<135∘. A sign that changes with direction is the signature of a saddle.
(c) Step 5 — why the Hessian was blind. The Hessian records second-order behaviour only; here the first non-zero behaviour is fourth order, and the quadratic clone of both functions is the same flat plane z=0.
(a) Both have ∇=0 and H=0 at the origin, so D=0. (b) g≥0 ⇒ minimum; h=t4 along x and −t4 along y ⇒ saddle (ray slice: g=t4(1−21sin22θ), h=t4cos2θ). (c) The difference is quartic; a second-order test cannot see it.
Remember
D=0 is a refusal to judge, not a verdict of "flat" or "neither". Writing "inconclusive" and stopping loses the marks: the question asks for the true nature, which needs a direct argument — an inequality, two opposite directions, or a ray slice.
Problem 9easy
Find the local extreme values of f(x,y)=xy−x2−y2−2x−2y+4.
What this tests. The three-step routine on a function whose Hessian is constant: critical point, D, verdict, value. Plan. Solve the two linear gradient equations by substitution; write the three second partials (they are numbers here); compute D and then look at fxx; substitute back to get the value, and cross-check with the eigenvalues.
Show the full solution
Step 1 — critical points.fx=y−2x−2=0 and fy=x−2y−2=0. From the first, y=2x+2; into the second:
x−2(2x+2)−2=0y⇒−3x−6=0⇒x=−2,=2(−2)+2=−2.
The only critical point is (−2,−2).
Step 2 — second partials and D.fxx=−2,fyy=−2,fxy=1, constants:
D=fxxfyy−fxy2=(−2)(−2)−12=4−1=3>0.
Step 3 — verdict and value.D>0 and fxx=−2<0 ⇒ local maximum. Its value:
f(−2,−2)=4−4−4+4+4+4=8.
Step 4 — cross-check by eigenvalues.H=[−211−2] has trace −4 and determinant 3, so λ2+4λ+3=0 gives λ=−1,−3: both negative ⇒ negative-definite ⇒ a dome. Because H is constant, f is concave everywhere and 8 is in fact the global maximum.
One critical point (−2,−2); D=3>0, fxx=−2<0: a local (indeed global) maximum with f(−2,−2)=8.
Remember
A maximum needs bothD>0 and fxx<0; a negative fxx with D<0 is a saddle, not a maximum. The marks that go missing here are almost always a sign slip in the two-line linear system — substitute your point back into both gradient equations before moving on.
Problem 10medium
Find the local extreme values of f(x,y)=x3+y3−3xy+1.
What this tests. A nonlinear gradient system with a real-root argument, and a Hessian that must be re-evaluated at each point. Plan. Turn each gradient equation into a substitution, reduce to one polynomial equation, keep only the real roots; evaluate fxx,fyy,fxy separately at each point; give both the verdict and the value, and say whether the minimum is global.
Show the full solution
Step 1 — critical points.fx=3x2−3y=0⇒y=x2,fy=3y2−3x=0⇒x=y2.
Substituting y=x2 into the second: x=x4, so x(x3−1)=0. The real roots are x=0 and x=1 (the other two roots of x3=1 are complex). Hence the critical points are (0,0) and (1,1).
Step 2 — the Hessian entries.fxx=6x,fyy=6y,fxy=−3 — the diagonal changes from point to point, the off-diagonal does not.
Step 3 — at (0,0).fxx=0,fyy=0,fxy=−3:
D=0⋅0−(−3)2=−9<0⇒saddle,f(0,0)=1.
Step 4 — at (1,1).fxx=6,fyy=6,fxy=−3:
D=6⋅6−(−3)2=36−9=27>0,fxx=6>0⇒local minimum,f(1,1)=1+1−3+1=0.
Step 5 — eigenvalue check, and local versus global. At (1,1), H=[6−3−36] has eigenvalues 6±3=9,3 (both positive: bowl); at (0,0), H=[0−3−30] has eigenvalues ±3 (saddle). The minimum value 0 is local only: f(−2,0)=−8+1=−7, and a cubic runs to −∞ — the test describes a neighbourhood, nothing more.
fxx=fyy=0 at the origin does not make D=0: the cross term fxy=−3 gives D=−9 and a clear saddle. And for cubics, local is not global — say so when you report a minimum.
Problem 11hard
Find the absolute maximum and minimum of f(x,y)=x2+y2−x−y on the region D={(x,y):x2≤y≤1}.
What this tests. Absolute extrema on a closed, bounded region: interior critical points and every piece of the boundary and the corners, then a comparison. Plan. Draw the region first; collect the interior critical points that lie inside it; reduce each boundary curve to a one-variable function and find its critical points; add the corners; make one list of values and pick the largest and smallest — the second-derivative test is not needed for any of this.
Show the full solution
Step 1 — draw the region in words.D is the set of points above the parabola y=x2 and below the line y=1: a parabolic bowl with a flat lid, meeting at the corners (−1,1) and (1,1). It is closed and bounded, so an absolute maximum and minimum exist, and each lives either at an interior critical point or somewhere on the boundary. The second-derivative test can only classify flat points in the open interior; on the boundary the gradient need not vanish at all, so the boundary must be searched separately.
Step 2 — interior critical points.fx=2x−1=0 and fy=2y−1=0 give (21,21). Is it inside D? (21)2=41≤21≤1, yes. Its value:
f(21,21)=41+41−21−21=−21.
(Here H=2I, a bowl, so this is a local minimum — but that says nothing about the boundary.)
Step 3 — the parabola arc y=x2, −1≤x≤1. Substitute:
g(x)g′(x)=f(x,x2)=x2+x4−x−x2=x4−x,=4x3−1=0⇒x=(41)1/3=0.62996.
Then y=x2=0.39685, and since 4x3=1 we have x4=x/4, so g=4x−x=−43x=−0.47247. The arc's endpoints are the corners:
f(−1,1)=1+1+1−1=2,f(1,1)=1+1−1−1=0.
Step 4 — the lid y=1, −1≤x≤1.h(x)=f(x,1)=x2+1−x−1=x2−x, with h′(x)=2x−1=0 at x=21:
f(21,1)=41+1−21−1=−41.
Its endpoints are the same two corners, already counted.
Step 5 — compare. The candidate values are {−21,−0.47247,2,0,−41}. The absolute maximum is 2 at the corner (−1,1); the absolute minimum is −21 at the interior point (21,21).
Step 6 — a geometric cross-check. Completing squares, f=(x−21)2+(y−21)2−21: f is the squared distance from (21,21), minus 21. The minimum is at that centre, which lies in D; the maximum is at the point of D farthest from it — the corner (−1,1), at squared distance 1.52+0.52=2.5, giving 2.5−0.5=2. ✓ The arc point (0.63,0.40) is merely the foot of the perpendicular from the centre to the parabola — the closest point of the arc, never a contender for either extreme. Note ∇f(−1,1)=(−3,1)=0: the maximum sits where the gradient does not vanish, which is exactly why the boundary must be checked by hand.
Interior: f(21,21)=−21. Parabola: f(0.62996,0.39685)=−0.47247, corners f(−1,1)=2, f(1,1)=0. Lid: f(21,1)=−41. Absolute maximum 2 at (−1,1); absolute minimum −21 at (21,21).
Remember
On a closed, bounded region keep three lists — interior critical points, each boundary piece reduced to one variable, and the corners — and only then compare. The marks vanish when the corners are skipped (that is where the maximum lives here) or when the arc's −0.47 is reported as the minimum without checking it against −21.
Problem 12hardadded — covers the judge's identity
The judge's identity, proved and used. Let Q(h,k)=h2fxx+2hkfxy+k2fyy with the partials taken at a critical point, and D=fxxfyy−fxy2. (a) Prove that fxxQ=(hfxx+kfxy)2+Dk2 by expanding the right-hand side. (b) Deduce the three verdicts: D>0,fxx>0 ⇒ Q>0 for all (h,k)=0; D>0,fxx<0 ⇒ Q<0; D<0 ⇒ Q takes both signs. (c) For a symmetric H=[abbc], show λ1λ2=ac−b2=D and λ1+λ2=a+c; hence D<0 exactly when the eigenvalues have opposite signs, and D>0 with a>0 forces c>0 and both eigenvalues positive. (d) Apply (c) to H=[3−3−36].
What this tests. The one identity behind the whole second-derivative test, and why the discriminant D and the eigenvalue signs are the same criterion in two languages. Plan. Expand, cancel, factor; for each verdict start from the sign of the right-hand side and divide by fxx with the correct flip; for the saddle, exhibit two explicit directions; for (c) write the characteristic polynomial and read off sum and product of roots; finish with the numbers.
Show the full solution
(a) Step 1 — expand the right-hand side.(hfxx+kfxy)2Dk2=h2fxx2+2hkfxxfxy+k2fxy2,=fxxfyyk2−fxy2k2.
Adding, the two k2fxy2 terms cancel and what is left has a common factor fxx:
h2fxx2+2hkfxxfxy+k2fxxfyy=fxx(h2fxx+2hkfxy+k2fyy)=fxxQ.■
The identity is nothing more than completing the square in h, with everything multiplied by fxx so that no fractions appear.
(b) Step 2 — verdict 1: D>0 and fxx>0. The right-hand side is a square plus Dk2, so it is ≥0. It can be 0 only if k=0andhfxx+kfxy=0, i.e. hfxx=0, i.e. h=0. So for (h,k)=0 we have fxxQ>0, and dividing by fxx>0 gives Q>0: uphill in every direction — a bowl, a local minimum.
Step 3 — verdict 2: D>0 and fxx<0. The same right-hand side is still strictly positive for (h,k)=0 — its sign never depended on the sign of fxx. Dividing by fxx<0 flips the inequality: Q<0 in every direction — a dome, a local maximum. (Note that D>0 forces fxx=0, since fxxfyy>fxy2≥0, so the division is always legal in verdicts 1 and 2.)
Step 4 — verdict 3: D<0. Test two explicit directions. Along (h,k)=(1,0):
Q(1,0)=fxx.
Along (h,k)=(−fxy,fxx):
Q(−fxy,fxx)=fxy2fxx−2fxyfxxfxy+fxx2fyy=fxx(fxxfyy−fxy2)=fxxD,
so fxx⋅Q(−fxy,fxx)=fxx2D<0 whenever fxx=0: the two values Q(1,0)=fxx and Q(−fxy,fxx)=fxxD have opposite signs — up one way, down another, a saddle. If fxx=0, then D=−fxy2<0 means fxy=0, and along (h,k)=(1,t):
Q(1,t)=2tfxy+t2fyy=t(2fxy+tfyy),
which for small t has the sign of tfxy — opposite signs at t=±ε. (When fyy=0 one can instead swap the roles of x and y and run the identity with fyy.) Either way Q changes sign: saddle.
(c) Step 5 — eigenvalues of a symmetric 2×2.det(H−λI)=(a−λ)(c−λ)−b2=λ2−(a+c)λ+(ac−b2).
For a monic quadratic with roots λ1,λ2, the sum of the roots is the negated middle coefficient and the product is the constant term:
λ1+λ2=a+c=trH,λ1λ2=ac−b2=detH=D.
(The roots are real because the discriminant (a+c)2−4(ac−b2)=(a−c)2+4b2≥0.) Hence D<0⟺λ1λ2<0⟺ the eigenvalues have opposite signs. And if D>0 with a>0: ac>b2≥0 with a>0 forces c>0, so the sum a+c>0 and the product D>0 — two real numbers with positive sum and positive product are both positive. (By the same token a<0 forces c<0 and both eigenvalues negative.) This is why "D and fxx" and "eigenvalue signs" are one criterion in two languages.
(d) Step 6 — the numbers.H=[3−3−36]: trace 9, determinant 18−9=9=D. So λ2−9λ+9=0:
λ=29±81−36=29±45=7.854,1.146.
Check: sum 9, product 9. ✓ Both positive ⇒ positive-definite ⇒ a bowl — this is the Hessian of Problem 6 at its minimum (21,41). Sylvester says the same in one line (3>0,9>0), and the identity of part (a) shows it explicitly: 3Q=(3h−3k)2+9k2>0 for (h,k)=0.
(a) Expanding gives fxx(h2fxx+2hkfxy+k2fyy)=fxxQ. (b) D>0: the right side is positive for (h,k)=0, so Q has the sign of fxx; D<0: Q(1,0)=fxx and Q(−fxy,fxx)=fxxD have opposite signs (or Q(1,±ε) when fxx=0). (c) λ1λ2=D, λ1+λ2=a+c. (d) λ=(9±45)/2≈7.854,1.146, both positive: bowl.
Remember
The whole test is one line of completed square: fxxQ=(hfxx+kfxy)2+Dk2. Read it as "a square plus D times a square" and the three verdicts follow, and D=detH=λ1λ2 is why the discriminant's sign is the eigenvalue story in disguise. Marks are lost by forgetting the fxx=0 case in the saddle argument, or by claiming D>0 alone gives a minimum.
You now know what a landscape looks like near a flat point and how to tell a bowl from a saddle. Unit 9 starts walking: the descent rule proved, the step-size speed limit the Hessian's eigenvalues set and the zig-zag it causes, exact line search, learning-rate schedules, gradient checking — and stochastic gradient descent, why a random spoonful of the data points the right way.