Topics A–Z

Math

Taylor Expansion Explained: Approximating Any Smooth Curve with Polynomials

How matching a curve's height, slope, and bend turns sin(x) and e^x into simple arithmetic — plus factorials, Lagrange error bounds, and complex poles.

LVL 52 min read

For Readers comfortable with basic algebra and derivatives who want to see how smooth functions turn into computable polynomials.

LVL 4

A simpler explanation with fewer formulas.

A processor’s arithmetic unit only knows four operations: add, subtract, multiply, and divide. There is no tiny triangle etched inside silicon to measure sin(0.5). Taylor expansion bridges that gap by replacing almost any smooth curve near a chosen point with a simple polynomial built purely from powers and arithmetic.

Imagine driving down a winding road in fog. Knowing only your position predicts a flat line; adding steering angle (slope) gives a straight tangent; adding how tightly the road curves (bend) fits a parabola that hugs the road far longer. Taylor expansion repeats that trick term by term — height, slope, bend, and higher bends — so an easy polynomial tracks the real curve across a growing neighborhood.

Formulated by Brook Taylor in 1715 (with the a = 0 special case named after Colin Maclaurin), a Taylor expansion builds the unique degree-n polynomial P_n(x) matching a smooth function’s value and first n derivatives at a base point x = a. By turning transcendental functions into finite sums of powers, it anchors physics approximations, differential equations, optimization, and scientific computing.

Three terms nail sin(0.5)

Compute sin(0.5) (in radians, ~28.6°; exact 0.4794255…) with plain arithmetic:

ApproximationFormulaValue at x = 0.5Error
1 termx0.5000000+0.02057
2 termsx − x³ / 60.4791667−0.000259
3 termsx − x³ / 6 + x⁵ / 1200.4794271+0.0000015

Just three terms land within about 1.5 millionths (≈ 3.2 ppm relative) of the true sine. The very first term — sin(x) ≈ x — is the classic small-angle shortcut behind pendulums, optics, and robotics.

Near x = 0, sine’s odd symmetry drops all even powers, leaving sin(x) ≈ x − x³/6 + x⁵/120. At x = 0.5 rad (exact 0.47942554):

DegreePolynomial P_n(x)Value at 0.5Absolute error
n = 1x0.500000002.06 × 10⁻²
n = 3x − x³/60.479166672.59 × 10⁻⁴
n = 5x − x³/6 + x⁵/1200.479427081.54 × 10⁻⁶

The error plunges roughly 80× from n = 1 to 3 and 168× from n = 3 to 5, because 0.5² shrinks by 4 while the factorial denominator jumps from 3! = 6 to 5! = 120.

Why the factorial n! appears

Differentiating x³ repeatedly drops its exponents out front: x³ → 3x² → 6x → 6 (3 × 2 × 1 = 3!). Dividing the x³ term by 3! = 6 cancels that multiplier so every term adjusts exactly one level of bend without disturbing earlier terms.

Write P_n(x) = c_0 + c_1(x − a) + … + c_n(x − a)ⁿ. Differentiating k times and setting x = a kills all terms except k! · c_k, giving the Taylor expansion around a:

f(x)≈∑k=0nf(k)(a)k! (x−a)kf(x) \approx \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}\,(x - a)^k

Setting a = 0 yields the Maclaurin series:

FunctionMaclaurin expansion (a = 0)Convergence
eˣ1 + x + x²/2! + x³/3! + …All real x (R = ∞)
sin(x)x − x³/3! + x⁵/5! − …All real x (R = ∞)
cos(x)1 − x²/2! + x⁴/4! − …All real x (R = ∞)
1 / (1 − x)1 + x + x² + x³ + …`
ln(1 + x)x − x²/2 + x³/3 − x⁴/4 + …−1 < x ≤ 1 (R = 1)

Substituting x = iθ into eˣ immediately splits into cos(θ) + i·sin(θ), giving Euler’s formula in three lines of algebra.

Error bounds and where Taylor breaks down

A Taylor polynomial is a local approximation. eˣ, sin(x), and cos(x) converge everywhere given enough terms, whereas 1 / (1 − x) = 1 + x + x² + … works cleanly at x = 0.5 (sum 2) but blows up at x = 2 (1 + 2 + 4 + 8 + …) because of the division-by-zero cliff at x = 1.

Every power series has a radius of convergence R around a: it converges for |x − a| < R and diverges for |x − a| > R. For ln(1 + x) at a = 0, the blow-up at x = −1 fixes R = 1, so the series also diverges past x = +1 even though ln(1 + x) is smooth at x = 2. To compute ln(3), re-center the expansion near x = 2.

Taylor’s Theorem writes f(x) = P_n(x) + R_n(x), where the Lagrange remainder guarantees some ξ between a and x with:

Rn(x)=f(n+1)(ξ)(n+1)! (x−a)n+1R_n(x) = \frac{f^{(n+1)}(\xi)}{(n + 1)!}\,(x - a)^{n+1}

For sin(x) at x = 0.5 with P_5(x) (identical to P_6(x) because the x⁶ term is 0), |f^(7)(ξ)| ≤ 1 bounds the error before knowing the exact answer:

∣R6(0.5)∣≤0.577!=0.00781255040≈1.55×10−6|R_6(0.5)| \le \frac{0.5^7}{7!} = \frac{0.0078125}{5040} \approx 1.55 \times 10^{-6}

That agrees with the actual error (1.54 × 10⁻⁶) to two significant digits. Two deeper twists round out the picture:

  • Complex poles: 1 / (1 + x²) is smooth across all real x, yet its Maclaurin series diverges for |x| ≥ 1 because 1 + z² = 0 has poles at z = ±i in the complex plane ℂ, distance R = 1 from 0.
  • Beyond raw Taylor: Cauchy’s e^(−1/x²) is infinitely smooth (C^∞) yet has all-zero derivatives at 0 (not real-analytic). In practice, math libraries (libm) range-reduce x and swap raw Taylor coefficients for Chebyshev / Remez minimax polynomials to flatten peak error across the whole interval, while multivariate optimization uses the second-order Hessian term (1/2)·hᵀ H h in Newton’s method.