Calculus

Taylor Expansion and Local Approximation

Taylor expansion uses value, slope, and curvature at one point to make a local model, then shows why local models eventually fail.

status: reviewimportance: criticaldifficulty 3/5math: undergraduateread: 13mlive demo

Concept Structure

Taylor Expansion and Local Approximation

01Intuition

Start with the picture, metaphor, or geometric mechanism.

02Math

Make the objects explicit and connect them with notation.

03Code

Mirror the equations with runnable implementation details.

04Interactive Demo

Manipulate the mechanism and watch the idea respond.

1prerequisites
5next concepts
4related links

Learner Contract

What this page should let you do.

You are here becauseTaylor expansion uses value, slope, and curvature at one point to make a local model, then shows why local models eventually fail.

This Calculus concept is the current idea: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.

Before thisDerivatives

1 prerequisite listed; refresh them before leaning on the math or code.

By the end4/4 sections ready | runnable code expected | live demo

Explain the mechanism, trace the main notation, and test one prediction in the live demo.

Do this firstIntuition

Read the intuition before the notation; the math should name a mechanism you already felt.

Test the linkManipulate one control and predict the visible change.Then continue to Lipschitz Smoothness and Strong Convexity (review)

Claim/source review status

Substantive review recorded

1/1 claims have bounded review metadata; still check caveats and source scope.Metadata-derived; review may be AI-assisted. Not a human certification.
Claims1/1 reviewed
Sources3 cited
Codeattached
Demolive
Reviewed2026-07-02
Updatedpage 2026-07-02

Learning item flow

4/4 sections readyAsk about thisResearch room
ConceptTaylor Expansion and Local ApproximationCalculus
3 sources attachedLocal snapshot ready
concept:calculus/taylor-expansion-local-approximation
01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

Section prompt

A derivative is already a prediction machine.

At a point x0x_0, the derivative says: "for a tiny move hh, expect the output to change by about f(x0)hf'(x_0)h." That is a tangent-line model. Taylor expansion keeps the same idea but asks for a better local model: if we also know the curvature at x0x_0, can we predict the bend?

The first-order model is the tangent. The second-order model is a tiny curved patch. Both are promises made near x0x_0, not global descriptions of the function.

This distinction matters everywhere in deep learning. Gradient descent trusts a local linear model of the loss. Newton-style methods trust a local quadratic model. Loss-landscape language about sharpness, curvature, and step-size stability is Taylor language in disguise.

The useful mental model is:

  1. choose an anchor point,
  2. use derivatives at that anchor to build a local model,
  3. move only as far as that local model deserves trust.
02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

Section prompt

Let f:RRf:\mathbb{R}\to\mathbb{R} be differentiable near x0x_0, and define the displacement

h=xx0.h = x - x_0.

The first-order Taylor model is

T1(x0+h)=f(x0)+f(x0)h.T_1(x_0+h)=f(x_0)+f'(x_0)h.

This is the tangent-line prediction: keep the current value and add slope times displacement.

If ff has a second derivative near x0x_0, the second-order Taylor model is

T2(x0+h)=f(x0)+f(x0)h+12f(x0)h2.T_2(x_0+h)=f(x_0)+f'(x_0)h+\frac{1}{2}f''(x_0)h^2.

The new term is the curvature correction. The factor 1/21/2 is not decoration: it is the coefficient that makes the quadratic model match the second derivative at the anchor.

For a smooth function with higher derivatives, the degree-nn Taylor polynomial is

Tn(x0+h)=k=0nf(k)(x0)k!hk.T_n(x_0+h)=\sum_{k=0}^{n}\frac{f^{(k)}(x_0)}{k!}h^k.

The local caveat is the point. A Taylor polynomial is exact for a polynomial of low enough degree, and often excellent near x0x_0, but the remainder can dominate far from the anchor.

The multivariable version is the one optimization uses. For f:RdRf:\mathbb{R}^d\to\mathbb{R}, current point x0Rdx_0\in\mathbb{R}^d, and small displacement δRd\delta\in\mathbb{R}^d,

f(x0+δ)f(x0)+f(x0)Tδ+12δTH(x0)δ,f(x_0+\delta)\approx f(x_0)+\nabla f(x_0)^\mathsf{T}\delta +\frac{1}{2}\delta^\mathsf{T}H(x_0)\delta,

where f(x0)\nabla f(x_0) is the gradient and H(x0)H(x_0) is the Hessian matrix.

Gradient descent comes from the first-order term. If δ=ηf(x0)\delta=-\eta\nabla f(x_0), then

f(x0)Tδ=ηf(x0)22,\nabla f(x_0)^\mathsf{T}\delta =-\eta\|\nabla f(x_0)\|_2^2,

which predicts a local decrease. The second-order term warns that curvature can shrink, improve, or overturn that prediction when the step is too large.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

Section prompt
import numpy as np

def f(x):
    return np.sin(x) + 0.12 * x**3

def df(x):
    return np.cos(x) + 0.36 * x**2

def d2f(x):
    return -np.sin(x) + 0.72 * x

x0 = 0.4
f0 = f(x0)

for h in [0.05, 0.75, 1.6]:
    true = f(x0 + h)
    linear = f0 + df(x0) * h
    quadratic = linear + 0.5 * d2f(x0) * h**2

    print("h =", h)
    print("  true     ", round(true, 6))
    print("  linear   ", round(linear, 6), "error", round(abs(true - linear), 6))
    print("  quadratic", round(quadratic, 6), "error", round(abs(true - quadratic), 6))

The small step makes both models look impressive. The medium step shows why curvature can matter. The large step reminds you that a Taylor model is a local contract, not a license to extrapolate forever.

04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

Section prompt

Use the lab below as a local-approximation prediction check. Pick a probe, inspect the anchor x0x_0 and displacement hh, then predict which local model will be closest at x0+hx_0+h:

  • the tangent line,
  • the quadratic patch,
  • or neither model because the step is too wide.

Then reveal the true value, the two estimates, the residuals, and the trust note. Try changing hh: the formulas stay the same, but the amount of trust they deserve changes quickly.

Live Concept Demo

Explore Taylor Expansion and Local Approximation

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 3/5undergraduatecode-aligned
Demo Prediction Checkpoint

Manipulate one control and predict the visible change.

Commit to what Taylor Expansion and Local Approximation should make visible before reading the result.

After The First Pass

Turn the concept into an inspected object.

Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.

Mechanism Storyboard

See the idea move before the page explains it

Taylor expansion uses value, slope, and curvature at one point to make a local model, then shows why local models eventually fail.

Prediction open01 / Intuition
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Taylor Expansion and Local Approximation should make visible.

Visual Inquiry

Make the image answer a mathematical question

Taylor expansion uses value, slope, and curvature at one point to make a local model, then shows why local models eventually fail.

4/4 stages readyLive demo connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Taylor Expansion and Local Approximation easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

book · 2020Mathematics for Machine LearningDeisenroth, Faisal, and Ong

Supports Taylor polynomials, local linearization, and multivariate first- and second-order Taylor expansions.

Open source
book · 2016Deep LearningGoodfellow, Bengio, and Courville

Uses second-order Taylor approximation to explain gradient steps, curvature, and why large steps can move uphill.

Open source
book · 2004Convex OptimizationBoyd and Vandenberghe

Supports first- and second-order Taylor models, directional derivative intuition, and Newton's method as a quadratic-model minimizer.

Open source

Claim Review

Taylor expansion uses value, slope, and curvature at one point to make a local model, then shows why local models eventually fail.

Status1 substantive review recorded

Claims without a substantive review badge still need exact source-support review.

Sources3 references

deisenroth-2020-mml-taylor, goodfellow-2016-deep-learning-numerical, boyd-2004-convex-optimization-taylor

Local checks4 local checks

Use equations, runnable code, and demos to check whether the source support is operational.

Substantively reviewedTaylor expansion turns derivatives at one point into local polynomial models: the first-order term gives a tangent prediction, the second-order term adds curvature, and the approximation is trustworthy only near the expansion point unless stronger smoothness/error information is available.Claim metadata: source checked

The three sources consistently ground Taylor expansion as a local polynomial model built from derivatives at the expansion point. They support the tangent/curvature story and its optimization use.

Sources: Mathematics for Machine Learning, Deep Learning, Convex OptimizationThis page teaches smooth one-variable examples plus the standard multivariate formula. It does not prove rigorous remainder bounds, analytic continuation, nonsmooth subgradient theory, or convergence guarantees for deep-learning optimization.A bounded review summary is present; still check caveats and exact reference scope.

Checked MML vector-calculus Taylor sections for univariate Taylor polynomials, local approximation, and multivariate first/second-order terms; checked Goodfellow et al. numerical computation for the second-order Taylor model used to reason about gradient descent and curvature; checked Boyd/Vandenberghe for first-order directional approximations, second-order models, and Newton-step motivation. GPT Pro publication critique remains pending because the user-confirmed Oracle browser lane refused connection.

Reviewer: codex-local-source-review; reviewed 2026-07-02

Practice Loop

Try the idea before it explains itself

Taylor expansion uses value, slope, and curvature at one point to make a local model, then shows why local models eventually fail.

Readiness0/3 checks ready
Predict

Before touching the demo, predict one visible change that should happen in Taylor Expansion and Local Approximation.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Grounded research drawerClose
ConceptTaylor Expansion and Local ApproximationCalculus
Runnable code comparisonTaylor Expansion and Local Approximation runnable code 1x0 = 0.4Prediction before revealTaylor Expansion and Local Approximation interactive demoManipulate one control and predict the visible change.
Grounded room questionWhat is the smallest example that makes Taylor Expansion and Local Approximation click without losing the math?Local snapshot ready

Research Room

Attach the question to a claim, equation, code, or demo

Pick the concept, equation, source, runnable code, claim, misconception, or demo state before asking for help. The handoff keeps that page item in context.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptCalculus

Taylor Expansion and Local Approximation

Attached question

What is the smallest example that makes Taylor Expansion and Local Approximation click without losing the math?

Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays in this browser, attached to the selected learning item.

No local draft saved.
Evidence to inspect
  • References to inspect: attached references on this page.
  • Definition, prerequisite, and contrast concept links
  • The equation or runnable code that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Grounded AI handoff

I am working in Continuous Function's research reading room. Object: concept - Taylor Expansion and Local Approximation Selected item key: recorded for copy. Context: Calculus Page anchor: recorded for copy. Open question: What is the smallest example that makes Taylor Expansion and Local Approximation click without losing the math? Evidence to inspect: - References to inspect: attached references on this page. - Definition, prerequisite, and contrast concept links - The equation or runnable code that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.

View it in context
concept/concept-notebook/calculus/taylor-expansion-local-approximation concept:calculus/taylor-expansion-local-approximation