← Module 05 / Calculus & optimization

Lesson 05.7 · §4.6

How accurate is the local picture?

Distinguish first-order, integral-gradient, and second-order Taylor formulas.

In this lesson 4 ideas
  1. A tangent predicts; curvature corrects
  2. Understand the intermediate point
  3. Transfer
  4. Explore the relationship

Source scope: §4.6, PDF pages 29. Numerical examples, experiments, added derivations, and practice are teaching supplements unless identified as source results.

A tangent predicts; curvature corrects

For f(x)=exf(x)=e^x at zero, the tangent predicts 1+h1+h and the quadratic model predicts 1+h+h2/21+h+h^2/2. At h=0.2h=0.2, the exact value is about 1.2214031.221403, compared with 1.21.2 and 1.221.22. As the step shrinks, both models improve. A plot helps us see error, but a theorem specifies the assumptions and the remainder.

Theorem 6 (Taylor’s theorem). Suppose f:Rd→Rf:\mathbb R^d\to\mathbb R is continuously differentiable and h∈Rdh\in\mathbb R^d. There is a t∈(0,1)t\in(0,1) such that

f(x+h)=f(x)+∇f(x+th)Th.f(x+h)=f(x)+\nabla f(x+th)^Th.

If ff is twice continuously differentiable, then

∇f(x+h)=∇f(x)+∫01∇2f(x+th)h dt,\nabla f(x+h)=\nabla f(x)+\int_0^1\nabla^2f(x+th)h\,dt,

and there exists t∈(0,1)t\in(0,1) such that

f(x+h)=f(x)+∇f(x)Th+12hT∇2f(x+th)h.f(x+h)=f(x)+\nabla f(x)^Th+\tfrac12 h^T\nabla^2 f(x+th)h.

These are all three source formulas. Each existential tt can be different. The tt in the integral is a dummy variable covering the whole segment. If the function is defined on an open domain smaller than Rd\mathbb R^d, require the entire segment and a neighborhood of it to be inside that domain with the stated smoothness.

Understand the intermediate point

The first formula is exact because it uses a gradient at some intermediate point. It does not say f(x+h)=f(x)+∇f(x)Thf(x+h)=f(x)+\nabla f(x)^Th exactly. Likewise the exact second-order formula uses a Hessian at an intermediate point. Replacing it by ∇2f(x)\nabla^2f(x) gives the local quadratic approximation.

For exe^x at zero, the exact second-order remainder beyond the linear model is 12h2eth\tfrac12h^2e^{th} for some t∈(0,1)t\in(0,1). The quadratic approximation instead uses e0=1e^0=1. This makes the distinction visible in the running example.

Teaching derivation. Set ϕ(s)=f(x+sh)\phi(s)=f(x+sh). The chain rule gives ϕ′(s)=∇f(x+sh)Th\phi'(s)=\nabla f(x+sh)^Th and ϕ′′(s)=hT∇2f(x+sh)h\phi''(s)=h^T\nabla^2f(x+sh)h. Apply the one-variable mean value theorem and second-order Taylor theorem on [0,1][0,1]. Apply the fundamental theorem of calculus separately to each gradient component to obtain the integral formula. The PDF states these formulas without proof and attributes this version to [1].

Transfer

For f(x,y)=x2+2y2f(x,y)=x^2+2y^2, the Hessian is constant, so the quadratic expansion is exact at every step. For exe^x it is only a local approximation because curvature changes along the step.

Source reference [1]. J. Nocedal and S. J. Wright, Numerical Optimization, Springer Science+Business Media, 2006. The next lesson uses these formulas to prove local-minimum conditions.

Explore the relationship

Explore it yourself

Compare exact values and local models

As the step shrinks, which approximation loses error faster?

Preparing interactive controls…

xyf / 20

Wireframes sample −1.5 ≤ x,y ≤ 1.5; the vertical axis is f / 2. Rotating the camera changes only the view. The 3D example adds y² to eˣ; the graph and readouts below are its y = 0 section.

xvalue0-3-2-11234

eʰ = 1.2214; tangent = 1.2; quadratic = 1.22.

Absolute errors: linear 0.0214; quadratic 0.0014. Gradient change eʰ − 1 = 0.2214 = ∫₀¹ eᵗʰ h dt.

All three graphs share the same coordinate scale. The interval control changes the portion displayed, not the axis scale. The exact second-order remainder beyond the tangent uses eᵗʰ at some intermediate point; the quadratic model replaces it with e⁰.