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.
For Readers comfortable with basic algebra and derivatives who want to see how smooth functions turn into computable polynomials.
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:
| Approximation | Formula | Value at x = 0.5 | Error |
|---|---|---|---|
| 1 term | x | 0.5000000 | +0.02057 |
| 2 terms | x − x³ / 6 | 0.4791667 | −0.000259 |
| 3 terms | x − x³ / 6 + x⁵ / 120 | 0.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):
| Degree | Polynomial P_n(x) | Value at 0.5 | Absolute error |
|---|---|---|---|
n = 1 | x | 0.50000000 | 2.06 × 10⁻² |
n = 3 | x − x³/6 | 0.47916667 | 2.59 × 10⁻⁴ |
n = 5 | x − x³/6 + x⁵/120 | 0.47942708 | 1.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:
Setting a = 0 yields the Maclaurin series:
| Function | Maclaurin 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:
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:
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 realx, yet its Maclaurin series diverges for|x| ≥ 1because1 + z² = 0has poles atz = ±iin the complex planeℂ, distanceR = 1from0. - Beyond raw Taylor: Cauchy’s
e^(−1/x²)is infinitely smooth (C^∞) yet has all-zero derivatives at0(not real-analytic). In practice, math libraries (libm) range-reducexand 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 hin Newton’s method.