Skip to content
AriadneTechnology

The Inner Ring · Chamber 7 of 9

Taylor Series, the Hessian and Curvature

Approximate smooth functions with polynomials, read curvature from the Hessian, and tell minima from saddle points.

45 min 60 XP + 9 questions + 1 challengeMathVideoPapersProofsCodeLab

In this chamber you will

  • Build Taylor polynomials and bound their error
  • Write the second-order expansion of a loss with its gradient and Hessian
  • Classify critical points by the eigenvalues of the Hessian
  • Run Newton's method and explain its speed and its dangers
DiscoverLearnRead beyondPapers & lecturesYour turn

Two weights with the same magnitude can have very different effects when removed. A quadratic approximation of the loss estimates the damage using curvature. That idea connects Taylor expansions with neural-network pruning.

Spotted in the wild

si=12Hiiwi2s_i=\frac12 H_{ii}w_i^2
Optimal Brain Damage
DiscoverLearnRead beyondPapers & lecturesYour turn
Symbols for this chamber
  • RnR_n“Taylor remainder”
    Error after a degree-n Taylor polynomial.
  • HH“Hessian”
    Matrix of second partial derivatives.
  • hTHhh^THh“h transpose H h”
    Curvature contribution along a displacement.
  • λi(H)\lambda_i(H)“eigenvalue i of H”
    Curvature along a Hessian eigenvector.
  • Hh=−gHh=-g“H h equals minus g”
    Linear system for a Newton displacement.
  • H≻0H\succ0“H is positive definite”
    Every nonzero direction has positive quadratic curvature.

Approximate more than the slope

A Taylor polynomial matches derivatives at a point:

f(a+h)=f(a)+f′(a)h+12f′′(a)h2+⋯+f(n)(a)n!hn+Rn.f(a+h)=f(a)+f'(a)h+\frac12f''(a)h^2+\cdots+\frac{f^{(n)}(a)}{n!}h^n+R_n.

If ∣f(n+1)∣≤M|f^{(n+1)}|\le M throughout the interval and the usual Taylor theorem hypotheses hold, then ∣Rn∣≤M∣h∣n+1/(n+1)!|R_n|\le M|h|^{n+1}/(n+1)!. This gives an error guarantee for a finite approximation. Smoothness alone does not guarantee that an infinite Taylor series equals the function.

For ehe^h around zero, the first three terms are 1+h+h2/21+h+h^2/2. At h=0.1h=0.1, they give 1.105. A cubic remainder bound is e0.1(0.1)3/6<0.000185e^{0.1}(0.1)^3/6<0.000185.

Quick check +20 XP

What is the degree-two Taylor polynomial of exe^x at zero evaluated at x=0.1x=0.1?

The Hessian measures directional curvature

For a scalar function with continuous second partial derivatives, the Hessian is symmetric:

Hij=∂2f∂xi∂xj,f(x+h)≈f(x)+gTh+12hTHh.H_{ij}=\frac{\partial^2f}{\partial x_i\partial x_j},\qquad f(x+h)\approx f(x)+g^Th+\frac12h^THh.

For f(x,y)=x2+xy+2y2f(x,y)=x^2+xy+2y^2, H=[[2,1],[1,4]]H=[[2,1],[1,4]]. The mixed partial records how the slope in one coordinate changes as another moves. Along a unit direction uu, the second derivative is uTHuu^THu.

Classify a stationary point

At g=0g=0, Hessian eigenvalues reveal the quadratic behaviour:

EigenvaluesConclusion
All strictly positiveStrict local minimum
All strictly negativeStrict local maximum
At least one positive and one negativeSaddle point
Some zero, with no mixed signsTest inconclusive

The zero Hessian at zero cannot distinguish x4x^4 from −x4-x^4. A positive semidefinite Hessian at one point is insufficient to prove a local minimum.

Quick check +20 XP

At a stationary point, Hessian eigenvalues are 2 and -1. What is it?

Newton follows the quadratic model

Set the gradient of the quadratic approximation to zero: g+Hh=0g+Hh=0. Solve this linear system for hh and update x←x+hx\leftarrow x+h. Writing h=−H−1gh=-H^{-1}g describes the formula; implementations usually solve the system without forming an inverse.

For f(x)=(x−3)2f(x)=(x-3)^2, Newton reaches 3 from any initial point in one step. For a nonquadratic function, full steps can overshoot. An indefinite Hessian can even send Newton toward a maximum or saddle. Damping, line search, or replacing HH by a positive definite approximation can help.

A badly conditioned positive Hessian makes gradient descent zigzag: one step size must accommodate both steep and shallow directions. Newton rescales by curvature, but computing and storing a dense Hessian is expensive in a large model.

Predict the cost of deleting a weight

Deleting wiw_i means setting hi=−wih_i=-w_i and other displacements to zero. The Taylor prediction is −giwi+12Hiiwi2-g_iw_i+\tfrac12H_{ii}w_i^2. Near a stationary point the first term is small, leaving the saliency in the opening equation. A small weight on a very curved direction can matter more than a larger weight on a flat direction.

Quick check +20 XP

If gi=0g_i=0, Hii=8H_{ii}=8 and wi=0.5w_i=0.5, what is the deletion saliency?

DiscoverLearnRead beyondPapers & lecturesYour turn

Read beyond

Book · free online · ~20 min

Calculus, Volume 2

OpenStax · Chapter 6: power series

Distinguish a finite Taylor polynomial from an infinite series.

Book · free online · ~20 min

Mathematics for Machine Learning

Deisenroth, Faisal & Ong · Sections 5.7–5.8: higher derivatives and Taylor series

Write the quadratic approximation with its dimensions visible.

Book · free online · ~20 min

Convex Optimization

Boyd & Vandenberghe · Section 9.5: Newton’s method

Read how damping and line search improve the full Newton step.

DiscoverLearnRead beyondPapers & lecturesYour turn

Read the equation in context

Optimal Brain DamageYann LeCun, John S. Denker & Sara A. Solla · 1989

Optimal Brain Damage estimates deletion cost using second derivatives. The displayed saliency assumes training is near a stationary point and uses a diagonal quadratic approximation. Correlations between simultaneous deletions and higher-order effects can make the approximation inaccurate.

Decode the paper · Diagonal second-order saliency, with H used for the loss Hessian

Optimal Brain Damage

Yann LeCun, John S. Denker & Sara A. Solla · 1989

+25 XP
si=12Hiiwi2s_i=\frac12 H_{ii}w_i^2

Optimal Brain Damage estimates deletion cost using second derivatives. The displayed saliency assumes training is near a stationary point and uses a diagonal quadratic approximation. Correlations between simultaneous deletions and higher-order effects can make the approximation inaccurate.

sis_i
HiiH_{ii}
wiw_i

Options

Taylor series3Blue1Brown
DiscoverLearnRead beyondPapers & lecturesYour turn

Your turn

Explore Himmelblau’s function. Locate stationary points and classify them from the two Hessian eigenvalues. Positive, negative and mixed curvature give different local geometry.

Interactive lab

Critical point cartographer

Explore f(x,y)=(x²+y−11)²+(x+y²−7)². There are four minima, four saddles and one maximum. Locate and classify all nine.
Contours of Himmelblau’s function and recorded stationary points-5-5-2.5-2.5002.52.555xy
● Contours● Recorded points● Current point

Gradient norm

5.97e+1

Hessian eigenvalues

-29.31, -6.69

Challenge: Critical cartographerFind and classify all nine critical points of Himmelblau's function.+50 XP

Match · Expression ↔ Meaning

Stationary geometry

+20 XP
λ1>0,λ2>0\lambda_1>0,\lambda_2>0
λ1<0,λ2<0\lambda_1<0,\lambda_2<0
λ1<0<λ2\lambda_1<0<\lambda_2

Options

Match · Expression ↔ Meaning

Approximation terms

+20 XP
f(x)f(x)
gThg^Th
12hTHh\tfrac12h^THh

Options

Proof puzzle

Newton’s displacement

+25 XP

Claim

Derive the Newton step from q(h)=f(x)+gTh+12hTHhq(h)=f(x)+g^Th+\tfrac12h^THh for symmetric invertible H.

Tap lines in the order they should appear. Tap a line in your proof to send it back.

Your proof

  1. Pick the first line below.

Available lines

Prove it yourself

A quadratic remainder

+35 XP

Claim

For f(x)=x2f(x)=x^2, prove the linear approximation error at a is exactly h2h^2.

Preview

Your typeset proof appears here.

Coding problems

Problem 19·Warm-up

Approximate the exponential

+20 XP

Compute ∑k=0101/k!\sum_{k=0}^{10}1/k!, the degree-ten Taylor approximation to ee, to 8 decimal places.

A number, rounded to 8 decimal places

Problem 20·Standard

Newton’s reciprocal

+35 XP

Use Newton’s method to minimise f(x)=x−log⁡xf(x)=x-\log x for x>0x>0, starting at x0=0.5x_0=0.5. After four full updates report x to 8 decimal places.

A number, rounded to 8 decimal places

Problem 21·Challenge

Rank deletion costs

+50 XP

For weights indexed by i=1,…,100i=1,\ldots,100, let wi=1/iw_i=1/i and Hii=iH_{ii}=i. Sum the predicted saliencies of deleting weights 51 through 100, treating each deletion separately. Give 6 decimal places.

A number, rounded to 6 decimal places

Key takeaways

  • A finite Taylor polynomial needs a remainder estimate to certify accuracy.
  • Hessian eigenvalues classify nondegenerate stationary points.
  • Zero eigenvalues require further analysis.
  • Newton solves a local quadratic model; curvature estimates also suggest pruning costs.

Checkpoint

Prove it to the labyrinth

Answer every question to clear this chamber. First-try answers earn the most XP.

0/6
Question 1 of 6 +20 XP

For f(x)=(x−3)2f(x)=(x-3)^2, starting at x=0, where does a full Newton step go?

Question 2 of 6 +20 XP

A stationary point has a zero Hessian. What follows?

Question 3 of 6 +20 XP

For f=x2+xy+2y2f=x^2+xy+2y^2, what is H12H_{12}?

Question 4 of 6 +20 XP

What is preferable to explicitly forming an inverse for a Newton step?

Question 5 of 6 +20 XP

For H=diag⁡(2,8)H=\operatorname{diag}(2,8) and u=(1,0)u=(1,0), what is uTHuu^THu?

Question 6 of 6 +20 XP

When does a finite Taylor error bound apply?

End of the chamber

Clear this chamber

+60 XPTaylor ApproximationHessianSaddle PointNewton’s Method