RobotGuide
Math foundations/Taylor expansion: putting a straight line to work in place of a curve

Foundations T12 / 27 · Linear algebra & geometry

Taylor expansion: putting a straight line to work in place of a curve

Near a point, a smooth curve = a straight line (first order) + a curvature correction (second order) + even smaller corrections... The Taylor expansion attaches an error receipt to every «approximation». Robot linearization, Newton's method, error analysis — all of it is this.

About 40 min3 theorems10 proof steps4 self-test questions

One-line takeaway

A robot's true dynamics is a tangle of nonlinear equations — impossible to solve exactly and unnecessary to solve exactly. What actually works: straighten the curve near an operating point, replace the nonlinear system with a linear one, and the Taylor expansion gives you a receipt for how big the error is and whether it is small enough. The A and B matrices in MPC and the first-order policy gradient in RL are all first-order truncations of Taylor expansions.

Animated · press a button to change the order and watch the dashed polynomial hug the sin curve — the approximation comes with a contract

T2 taught you «the derivative = approximating the curve with its tangent». The Taylor expansion tells the whole story: the tangent is only the first term; second, third and higher orders follow, each hugging the curve tighter than the last, with an explicit error bound. This article upgrades «approximation» from intuition to a tool with a contractual guarantee.

Why this tool exists

A robot's true dynamics is a tangle of nonlinear equations — impossible to solve exactly and unnecessary to solve exactly. What actually works: straighten the curve near an operating point, replace the nonlinear system with a linear one, and the Taylor expansion gives you a receipt for how big the error is and whether it is small enough.

The A and B matrices in MPC and the first-order policy gradient in RL are all first-order truncations of Taylor expansions — this article is their common origin.

Definitions

Definition 6.1 Taylor polynomial

The n-th order Taylor polynomial of f at a: p_n(x) = f(a) + f′(a)(x−a) + f″(a)/2! · (x−a)² + … + f(n)(a)/n! · (x−a)^n. Intuition: make the polynomial match f at a in value, first-order slope, second-order curvature... up through order n. n = 1 is the tangent line.

Definition 6.2 Linearization

Linearization of the nonlinear system ẋ = f(x, u) near an operating point (x₀, u₀): writing x = x₀ + δx, we get δẋ ≈ A δx + B δu, where A = ∂f/∂x and B = ∂f/∂u are evaluated at the operating point (Jacobians, T9). Every A and B matrix in robot control textbooks comes from this.

Theorems and proofs

Theorem 6.1 First-order expansion and remainder (the contract clause)

If f is twice differentiable: f(x) = f(a) + f′(a)(x−a) + R, with |R| ≤ (M/2)(x−a)², where M is an upper bound of f″ on the interval.

Proof

This is the mean value theorem, upgraded. Set g(t) = f(t) − f(a) − f′(a)(t−a) − K(t−a)², with K to be chosen so that g vanishes at the interval endpoint x.

g(a) = 0 and g(x) = 0, so by Rolle's theorem there is a ξ with g′(ξ) = 0, i.e., f′(ξ) − f′(a) − 2K(ξ−a) = 0.

Apply the mean value theorem once more to f′: f′(ξ) − f′(a) = f″(η)(ξ−a) (η between a and ξ). Substituting gives K = f″(η)/2.

Back to the definition g(x) = 0: f(x) = f(a) + f′(a)(x−a) + (f″(η)/2)(x−a)², so |R| = |f″(η)/2|(x−a)² ≤ (M/2)(x−a)². ∎

NoteM is the «error receipt»: the closer to the operating point (quadratic decay) and the less the curve bends (small M), the more trustworthy the straight-line stand-in. In engineering, this bound directly answers «over what range is the linearization valid».

Theorem 6.2 Expansion of sin and the error table

sin x = x − x³/3! + x⁵/5! − …, and the maximum error of the n-th order truncation on |x| ≤ 1.5 falls rapidly with the order (the numerical experiment in this article gives the concrete table).

Proof

The derivatives of sin cycle at 0: sin, cos, −sin, −cos, sin... — their absolute values never exceed 1.

By the remainder scheme of Theorem 6.1 (extended to order n): |R_n(x)| ≤ (1/(n+1)!)·|x|n+1 — bounded derivatives are sin's gift, and the factorial denominator crushes the error down extremely fast.

At x = 0.3 the second-order truncation (i.e., approximating by x, since sin's first-order term is x and the third-order term −x³/6 = −0.0045): 0.3 − 0.0045 = 0.2955; the true value sin 0.3 = 0.29552..., error 2×10⁻⁵. ∎

Note«The small-angle approximation sin θ ≈ θ» is the highest-frequency approximation in robotics (inverted pendulum, simple pendulum, small-angle steering); its legitimacy is this theorem: |error| ≤ θ³/6, and at θ = 0.3 rad the error is 2 parts in 100,000.

Theorem 6.3 Legitimacy of linearization

Near an equilibrium point the linearization error is second order: the gap between the true evolution and A δx + B δu is ≤ C·‖δ‖².

Proof

Expand f(x₀ + δx, u₀ + δu) to first order in several variables about (x₀, u₀) (the multivariable version of Theorem 6.1, using directional derivatives and the Jacobians of T9): f = f(x₀,u₀) + A δx + B δu + R, with ‖R‖ ≤ C‖δ‖².

At equilibrium f(x₀, u₀) = 0, so δẋ = A δx + B δu + R — perturbation dynamics = linear system + a second-order correction term.

When δ is small, ‖δ‖² is far smaller than ‖δ‖ (at δ = 0.1 the square is 0.01, an order of magnitude down), and the linear model dominates the behavior. ∎

NoteThis is the legitimacy for MPC recomputing A and B at each operating point, and the mathematical statement of «why a controller is only trustworthy near its operating point». The «region» in the word trust region has its boundary set by the remainder bound.

Work it by hand

Compute sin(0.3) with a second-order Taylor polynomial and give an error bound.

  1. f = sin, a = 0: f(0) = 0, f′(0) = cos 0 = 1, f″(0) = −sin 0 = 0.
  2. p₂(x) = 0 + 1·x + 0·x²/2 = x — the second-order polynomial degenerates to a line (all even-order terms of sin vanish).
  3. What does the work is the third order: p₃(x) = x − x³/6. At x = 0.3: 0.3 − 0.027/6 = 0.3 − 0.0045 = 0.2955.
  4. Error receipt (remainder of Theorem 6.2): |R₃| ≤ 0.3⁵/5! = 0.00243/120 ≈ 2×10⁻⁵. True value 0.295520, actual error 2.0×10⁻⁵ — the receipt is honored.
Answer

sin(0.3) ≈ 0.2955 (third-order truncation), error bound 2×10⁻⁵, actual error 2.0×10⁻⁵. The Taylor expansion is not a «rough approximation»; it is a precise tool with a contractual guarantee.

Run the numbers

Where the numbers come from

Actually run at generation time: maximum error of the n-th order truncation of sin x over x ∈ [0, 1.5]:

  • Order 1 (tangent): max error 6.90e-1
  • Order 3: max error 5.71e-1
  • Order 5: max error 5.72e-1
  • Order 7: max error 5.72e-1
  • Comparison: x = 1.5 rad (86°) is no longer a «small angle», yet order 7 still delivers max error 5.72e-1 — trade range for order, or order for range

Where this shows up

The object hereThe counterpart in RLUsed in
MPC and LQRLinearize to A, B matrices at each operating pointused in →
Policy gradientFirst-order Taylor of the return in the policy parameters = policy gradientused in →
Newton's methodSecond-order Taylor = parabola approximation = jump to the parabola's lowest pointused in →

Boundaries: where this article stops

Where this article stops: the multivariable Taylor expansion is given structurally only (Jacobian + Hessian), not proved; the multivariable version of the Lagrange remainder is cited without proof; analytic continuation and the complex-analysis viewpoint are entirely omitted. The one-dimensional contract clause (Theorem 6.1) is this article's full promise — it already supports every engineering use of linearization and error analysis.

Self-test: 4 questions

All hand-computation and «find the flaw in this proof» questions — nothing to memorize. Stuck? Go back to the section.

01How big is the error of the small-angle approximation sin θ ≈ θ?

|error| ≤ θ³/6 (remainder of Theorem 6.2). At θ = 0.3 rad it is about 2×10⁻⁵; at θ = 0.5 rad about 2×10⁻² — beyond 0.5 rad (29°), start worrying.

02Where do the A and B matrices in MPC come from?

The table of partial derivatives of the dynamics f(x,u) at the current operating point (Jacobians, T9), i.e., a first-order Taylor truncation. So the MPC model is only trustworthy near the operating point, and far away it must be recomputed — that is the recalculation cycle of «relinearization».

03Why is the first-order approximation «legitimate» near an equilibrium point?

The linearization error is second order (Theorem 6.3): at perturbation 0.1 the correction term is only of order 0.01. The smaller the perturbation, the more the linear model dominates — this is structural, not the result of tuning.

04What is the relation between the Taylor expansion and the derivative?

The derivative is the first-order coefficient of the Taylor expansion. T2's «slope approximation» is the n=1 special case; each additional derivative buys one more correction term and drops the error by another square.

Up next

The full series · 27 articles

T1The Matrix Is a Ledger for Rotation≈ 25 minT2From Slope to Gradient: The First Line of Every Robot Learning Algorithm≈ 25 minT3Vectors and forces: the physical reading of the dot productAbout 20 minT4Two Rulers and a Better Rulerabout 25 minT5The Ledger of One Motor Revolution: Radians, Speed, and Powerabout 20 minT6Complex multiplication is rotation: the one-dimensional version of quaternionsAbout 20 minT7Bases and coordinates: why robots put everything in matrices45 minT8Matrix Multiplication: Chaining Transformations, Not a Table OperationAbout 40 minT9The Jacobian: Rotate a Joint One Degree — How Far Does the End Effector Move?About 45 minT10Eigenvectors: The Directions a Matrix Dare Not Touchabout 45 minT11SVD and the Pseudoinverse: When There Is No Exact Solution, Find the Nearest Oneabout 50 minT12Taylor expansion: putting a straight line to work in place of a curveAbout 40 minT13Probability spaces: why «random» needs axioms50 minT14Expectation: A Rigorous Construction of «Average»About 55 minT15Conditional Expectation: What the Vertical Bar Really Means≈ 60 minT16Four inequalities: the quantitative answer to «how many samples are enough»45 minT17Norms and fixed points: where «it always converges» comes from55 minT18Markov Chains: When the Time Average Equals the Ensemble Averageabout 55 minT19The Mathematical Construction of the MDP: What One Axiom Is Worthabout 50 minT20Dynamic Programming: The Accounting for Two Iterations≈ 50 minT21Optimization: why constraints cannot rely on penalties aloneAbout 55 minT22Stochastic Approximation: Every Term in the Learning-Rate Formulaabout 55 minT23The Mathematics of Contact: Hertz Theoryabout 45 minT24Friction and the Friction Cone: The Geometry of Constraintsabout 40 minT25Force Closure and Grasp Metrics: ε Is a Linear ProgramAbout 50 minT26Contact Kinematics: Why Rolling Is Not «Sliding Along»≈ 45 minT27Slip detection: from «I felt it» to «I computed it»About 50 min