What Is a Taylor Series, What Is It Used For, with Examples
A calculator does not know sin or eˣ directly; it only knows how to add and multiply. A Taylor series turns almost any function into a polynomial that can be computed with additions and multiplications, and it is the reason engineers can write sinθ≈θ with confidence. This article gives the formula, the table of series worth memorising and 8 worked examples.
f(x)=∑k=0∞k!f(k)(a)(x−a)k inside the radius of convergence
Expanding about a=0 gives the Maclaurin series
Keep n terms to get the Taylor polynomial Pn(x), with error at most (n+1)!M∣x−a∣n+1
What is a Taylor series?
To find the polynomial that looks most like f(x) near a point a, force its value, slope, curvature and every higher derivative at a to match those of f. The result is the coefficients ck=k!f(k)(a) and the series
The first two terms f(a)+f′(a)(x−a) are the tangent line, the linearization that engineers use more than any other approximation. Each extra term makes the polynomial follow the function over a wider range.
How to find a Taylor series: the example of eˣ
Example 1
Find the Maclaurin series of ex and approximate e0.5 with 5 terms.
Every derivative of ex is ex; at x=0 this gives f(k)(0)=1 for every k
Coefficients ck=k!1: ex=1+x+2!x2+3!x3+4!x4+⋯
e0.5≈1+0.5+0.125+0.0208333+0.0026042=1.6484375
The true value is 1.6487213, an error of 2.8×10−4. Lagrange bound: 5!e0.5(0.5)5<1201.65×0.03125≈4.3×10−4 ✓
e0.5≈1.6484 from just 5 terms, and we know in advance that the error is below 4.3×10−4.
The Maclaurin series table to memorise
Doing the same for other functions gives the table below. The right-hand column is where the series converges to the function; outside it the series cannot be used.
Function
Maclaurin series
Valid for
ex
1+x+2!x2+3!x3+⋯
all x
sinx
x−3!x3+5!x5−⋯
all x
cosx
1−2!x2+4!x4−⋯
all x
1−x1
1+x+x2+x3+⋯
∣x∣<1
ln(1+x)
x−2x2+3x3−⋯
−1<x≤1
tan−1x
x−3x3+5x5−⋯
∣x∣≤1
(1+x)α
1+αx+2!α(α−1)x2+⋯
∣x∣<1
Remember the first three rows and the geometric series 1/(1−x), and you can build the rest: integrating 1/(1+t) gives ln(1+x), and integrating 1/(1+t2) gives tan−1x (see the geometric series formula).
Approximation examples
Example 2 · The small-angle approximation
What is the percentage error of sinθ≈θ at θ=5∘, and how much better is it with the extra term −θ3/6?
Convert to radians: θ=5π/180=0.0872665. The true value is sin5∘=0.0871557
sinθ≈θ is off by 0.0001107, or 0.13%
θ−θ3/6=0.0871557, off by only 4.2×10−8
At 5°, sinθ≈θ is only 0.13% off, but only in radians (see the error table by angle in the trigonometry lesson, in Thai).
Example 3
Approximate cos0.2 and 1.02 without a calculator.
If the x you need is far from 0, a Maclaurin series needs many terms. Choose instead an expansion point a near x where the function is easy to evaluate; the terms are then powers of (x−a), which is small.
Example 4
Use the second-order Taylor polynomial of x about a=4 to approximate 4.1, with an error bound.
f(x)=x1/2,f′(x)=21x−1/2,f′′(x)=−41x−3/2. At a=4: f=2,f′=41,f′′=−321
P2(x)=2+4x−4−64(x−4)2 (the second-order coefficient is f′′(4)/2!=−1/64)
P2(4.1)=2+0.025−0.00015625=2.02484375. The true value is 2.02484567, an error of 1.92×10−6
Lagrange bound: f′′′(x)=83x−5/2≤83⋅321 on [4,4.1], so ∣R2∣≤3!3/256(0.1)3≈1.95×10−6 ✓
4.1≈2.024844, correct to 5 decimal places from a polynomial of degree two, because x−a=0.1 is small.
How many terms? Computing e
Example 5
How far must the series of ex go to guarantee that e=e1 is within 5×10−5 (correct to 4 decimal places)?
Lagrange bound at x=1: ∣Rn∣≤(n+1)!M with M=maxec≤e<3 on [0,1]
We need (n+1)!3<5×10−5, that is (n+1)!>60000. Since 8!=40320 is not enough but 9!=362880 is, n=8
∑k=08k!1=2.7182788. The true value is 2.7182818, an error of 3.1×10−6 ✓
Going up to x8/8! (9 terms) guarantees it. In fact stopping at x7/7! already gives an error of only 2.8×10−5: the Lagrange bound is a guarantee, so it is usually larger than the actual error.
New series from the table: integrals and limits
You do not have to differentiate from scratch every time. Substitute, multiply, integrate or differentiate the series in the table term by term (inside the radius of convergence). This lets you evaluate integrals that have no antiderivative in terms of elementary functions.
Example 6 · An integral with no elementary antiderivative
Approximate ∫01e−x2dx.
Replace x by −x2 in the series of ex: e−x2=1−x2+2!x4−3!x6+4!x8−⋯
Integrate term by term from 0 to 1: 1−31+101−421+2161−13201+⋯
First five terms: 1−0.333333+0.1−0.023810+0.004630=0.747487
This is an alternating series with decreasing terms, so the error is at most the next term, 1/1320≈7.6×10−4. The true value is 0.746824, an error of 6.6×10−4 ✓
∫01e−x2dx≈0.7475. This function has no elementary antiderivative, yet it is at the heart of the normal distribution and the error function used in noise analysis.
Example 7 · A 0/0 limit
Find x→0limx3sinx−x.
Substitute the series: sinx−x=−6x3+120x5−⋯
Divide by x3: −61+120x2−⋯→−61 as x→0
The limit is −61. L'Hôpital's rule needs three rounds of differentiation; the Taylor series gives the answer in one line and also tells you that sinx differs from x by about x3/6.
Engineering uses
Example 8 · Small-signal diode model
A diode obeys i=ISev/VT and operates at ID=1mA, VT=26mV. If the voltage rises by Δv=2mV, what is the current?
First-order Taylor expansion about the operating point: i≈ID(1+VTΔv), with small-signal resistance rd=VT/ID=26Ω
Approximation: 1mA×(1+2/26)=1.0769mA
Exact: 1mA×e2/26=1.0800mA, an error of 0.3%, because Δv is much smaller than VT
≈1.077mA. This is where every small-signal equivalent circuit in electronics comes from.
Pendulums and control systemssinθ≈θ turns a nonlinear equation into a linear differential equation that can be solved with Laplace transforms.
Sensitivity(1+x)n≈1+nx: a 3% rise in voltage raises the power V2/R by about 6%.
Firmware Microcontrollers without a floating-point sine unit use a Taylor polynomial of a few terms over a narrow angle range.
Keep learning in the library
The full lessons are in Thai, with English technical terms and the same formulas.
What is the difference between a Taylor series and a Maclaurin series?
A Maclaurin series is a Taylor series expanded about a=0, a special case. The formula is the same with a=0 substituted.
How many terms are enough?
It depends on the accuracy you need and the distance ∣x−a∣. Use the Lagrange remainder bound ∣Rn∣≤M∣x−a∣n+1/(n+1)! and choose n so the bound is below your tolerance. The closer x is to a, the fewer terms you need.
Does a Taylor series work for every x?
Not always, only inside the radius of convergence R. For example ex,sinx,cosx have R=∞, but ln(1+x) and 1/(1−x) have R=1. Outside that range, adding more terms never approaches the true value.
What do engineers use Taylor series for?
To approximate complicated functions with polynomials, for example sinθ≈θ for pendulums and control systems, linearization about an operating point in small-signal models of diodes and transistors, and computing sin and eˣ on microcontrollers.