Type to search, in English or Thai

  1. Home
  2. Articles
  3. Sequences & Series
  4. Taylor series

// Article · Sequences & series

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⁡θ≈θ\sin\theta \approx \theta with confidence. This article gives the formula, the table of series worth memorising and 8 worked examples.

By Ajarn ModUpdated
30-second summary
  • f(x)=∑k=0∞f(k)(a)k!(x−a)kf(x) = \sum_{k=0}^{\infty} \dfrac{f^{(k)}(a)}{k!}(x - a)^k inside the radius of convergence
  • Expanding about a=0a = 0 gives the Maclaurin series
  • Keep n terms to get the Taylor polynomial Pn(x)P_n(x), with error at most M∣x−a∣n+1(n+1)!\dfrac{M|x - a|^{n+1}}{(n+1)!}

What is a Taylor series?

To find the polynomial that looks most like f(x)f(x) near a point aa, force its value, slope, curvature and every higher derivative at aa to match those of ff. The result is the coefficients ck=f(k)(a)k!c_k = \dfrac{f^{(k)}(a)}{k!} and the series

f(x)=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+f′′′(a)3!(x−a)3+⋯f(x) = f(a) + f'(a)(x - a) + \frac{f''(a)}{2!}(x - a)^2 + \frac{f'''(a)}{3!}(x - a)^3 + \cdots

The first two terms f(a)+f′(a)(x−a)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 exe^x and approximate e0.5e^{0.5} with 5 terms.

  1. Every derivative of exe^x is exe^x; at x=0x = 0 this gives f(k)(0)=1f^{(k)}(0) = 1 for every k

  2. Coefficients ck=1k!c_k = \dfrac{1}{k!}: ex=1+x+x22!+x33!+x44!+⋯e^x = 1 + x + \dfrac{x^2}{2!} + \dfrac{x^3}{3!} + \dfrac{x^4}{4!} + \cdots

  3. e0.5≈1+0.5+0.125+0.0208333+0.0026042=1.6484375e^{0.5} \approx 1 + 0.5 + 0.125 + 0.0208333 + 0.0026042 = 1.6484375

  4. The true value is 1.64872131.6487213, an error of 2.8×10−42.8\times10^{-4}. Lagrange bound: e0.5(0.5)55!<1.65×0.03125120≈4.3×10−4\dfrac{e^{0.5}(0.5)^5}{5!} < \dfrac{1.65\times0.03125}{120} \approx 4.3\times10^{-4} ✓

e0.5≈1.6484e^{0.5} \approx 1.6484 from just 5 terms, and we know in advance that the error is below 4.3×10−44.3\times10^{-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.

FunctionMaclaurin seriesValid for
exe^x1+x+x22!+x33!+⋯1 + x + \dfrac{x^2}{2!} + \dfrac{x^3}{3!} + \cdotsall x
sin⁡x\sin xx−x33!+x55!−⋯x - \dfrac{x^3}{3!} + \dfrac{x^5}{5!} - \cdotsall x
cos⁡x\cos x1−x22!+x44!−⋯1 - \dfrac{x^2}{2!} + \dfrac{x^4}{4!} - \cdotsall x
11−x\dfrac{1}{1 - x}1+x+x2+x3+⋯1 + x + x^2 + x^3 + \cdots∣x∣<1|x| < 1
ln⁡(1+x)\ln(1 + x)x−x22+x33−⋯x - \dfrac{x^2}{2} + \dfrac{x^3}{3} - \cdots−1<x≤1-1 < x \le 1
tan⁡−1x\tan^{-1} xx−x33+x55−⋯x - \dfrac{x^3}{3} + \dfrac{x^5}{5} - \cdots∣x∣≤1|x| \le 1
(1+x)α(1 + x)^{\alpha}1+αx+α(α−1)2!x2+⋯1 + \alpha x + \dfrac{\alpha(\alpha - 1)}{2!}x^2 + \cdots∣x∣<1|x| < 1

Remember the first three rows and the geometric series 1/(1−x)1/(1 - x), and you can build the rest: integrating 1/(1+t)1/(1 + t) gives ln⁡(1+x)\ln(1 + x), and integrating 1/(1+t2)1/(1 + t^2) gives tan⁡−1x\tan^{-1} x (see the geometric series formula).

Approximation examples

Example 2 · The small-angle approximation

What is the percentage error of sin⁡θ≈θ\sin\theta \approx \theta at θ=5∘\theta = 5^\circ, and how much better is it with the extra term −θ3/6-\theta^3/6?

  1. Convert to radians: θ=5π/180=0.0872665\theta = 5\pi/180 = 0.0872665. The true value is sin⁡5∘=0.0871557\sin 5^\circ = 0.0871557

  2. sin⁡θ≈θ\sin\theta \approx \theta is off by 0.00011070.0001107, or 0.13%0.13\%

  3. θ−θ3/6=0.0871557\theta - \theta^3/6 = 0.0871557, off by only 4.2×10−84.2\times10^{-8}

At 5°, sin⁡θ≈θ\sin\theta \approx \theta is only 0.13% off, but only in radians (see the error table by angle in the trigonometry lesson, in Thai).

Example 3

Approximate cos⁡0.2\cos 0.2 and 1.02\sqrt{1.02} without a calculator.

  1. cos⁡x≈1−x22+x424\cos x \approx 1 - \dfrac{x^2}{2} + \dfrac{x^4}{24}: cos⁡0.2≈1−0.02+0.0000667=0.9800667\cos 0.2 \approx 1 - 0.02 + 0.0000667 = 0.9800667 (true 0.9800666)

  2. 1+x≈1+x2−x28\sqrt{1 + x} \approx 1 + \dfrac{x}{2} - \dfrac{x^2}{8}: 1.02≈1+0.01−0.00005=1.00995\sqrt{1.02} \approx 1 + 0.01 - 0.00005 = 1.00995 (true 1.0099505)

cos⁡0.2≈0.98007\cos 0.2 \approx 0.98007 · 1.02≈1.00995\sqrt{1.02} \approx 1.00995

Taylor series about a point other than 0

If the x you need is far from 0, a Maclaurin series needs many terms. Choose instead an expansion point aa near x where the function is easy to evaluate; the terms are then powers of (x−a)(x - a), which is small.

Example 4

Use the second-order Taylor polynomial of x\sqrt{x} about a=4a = 4 to approximate 4.1\sqrt{4.1}, with an error bound.

  1. f(x)=x1/2, f′(x)=12x−1/2, f′′(x)=−14x−3/2f(x) = x^{1/2},\ f'(x) = \tfrac12 x^{-1/2},\ f''(x) = -\tfrac14 x^{-3/2}. At a=4a = 4: f=2, f′=14, f′′=−132f = 2,\ f' = \tfrac14,\ f'' = -\tfrac{1}{32}

  2. P2(x)=2+x−44−(x−4)264P_2(x) = 2 + \dfrac{x - 4}{4} - \dfrac{(x - 4)^2}{64} (the second-order coefficient is f′′(4)/2!=−1/64f''(4)/2! = -1/64)

  3. P2(4.1)=2+0.025−0.00015625=2.02484375P_2(4.1) = 2 + 0.025 - 0.00015625 = 2.02484375. The true value is 2.024845672.02484567, an error of 1.92×10−61.92\times10^{-6}

  4. Lagrange bound: f′′′(x)=38x−5/2≤38⋅132f'''(x) = \tfrac38 x^{-5/2} \le \tfrac38\cdot\tfrac{1}{32} on [4, 4.1][4,\ 4.1], so ∣R2∣≤3/2563!(0.1)3≈1.95×10−6|R_2| \le \dfrac{3/256}{3!}(0.1)^3 \approx 1.95\times10^{-6} ✓

4.1≈2.024844\sqrt{4.1} \approx 2.024844, correct to 5 decimal places from a polynomial of degree two, because x−a=0.1x - a = 0.1 is small.

How many terms? Computing e

Example 5

How far must the series of exe^x go to guarantee that e=e1e = e^1 is within 5×10−55\times10^{-5} (correct to 4 decimal places)?

  1. Lagrange bound at x=1x = 1: ∣Rn∣≤M(n+1)!|R_n| \le \dfrac{M}{(n+1)!} with M=max⁡ec≤e<3M = \max e^c \le e < 3 on [0, 1][0,\ 1]

  2. We need 3(n+1)!<5×10−5\dfrac{3}{(n+1)!} < 5\times10^{-5}, that is (n+1)!>60 000(n+1)! > 60\,000. Since 8!=40 3208! = 40\,320 is not enough but 9!=362 8809! = 362\,880 is, n=8n = 8

  3. ∑k=081k!=2.7182788\sum_{k=0}^{8} \dfrac{1}{k!} = 2.7182788. The true value is 2.71828182.7182818, an error of 3.1×10−63.1\times10^{-6} ✓

Going up to x8/8!x^8/8! (9 terms) guarantees it. In fact stopping at x7/7!x^7/7! already gives an error of only 2.8×10−52.8\times10^{-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−x2 dx\displaystyle\int_0^1 e^{-x^2}\,dx.

  1. Replace xx by −x2-x^2 in the series of exe^x: e−x2=1−x2+x42!−x63!+x84!−⋯e^{-x^2} = 1 - x^2 + \dfrac{x^4}{2!} - \dfrac{x^6}{3!} + \dfrac{x^8}{4!} - \cdots

  2. Integrate term by term from 0 to 1: 1−13+110−142+1216−11320+⋯1 - \dfrac13 + \dfrac{1}{10} - \dfrac{1}{42} + \dfrac{1}{216} - \dfrac{1}{1320} + \cdots

  3. First five terms: 1−0.333333+0.1−0.023810+0.004630=0.7474871 - 0.333333 + 0.1 - 0.023810 + 0.004630 = 0.747487

  4. This is an alternating series with decreasing terms, so the error is at most the next term, 1/1320≈7.6×10−41/1320 \approx 7.6\times10^{-4}. The true value is 0.7468240.746824, an error of 6.6×10−46.6\times10^{-4} ✓

∫01e−x2dx≈0.7475\displaystyle\int_0^1 e^{-x^2}dx \approx 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 lim⁡x→0sin⁡x−xx3\displaystyle\lim_{x\to0}\frac{\sin x - x}{x^3}.

  1. Substitute the series: sin⁡x−x=−x36+x5120−⋯\sin x - x = -\dfrac{x^3}{6} + \dfrac{x^5}{120} - \cdots

  2. Divide by x3x^3: −16+x2120−⋯→−16-\dfrac16 + \dfrac{x^2}{120} - \cdots \to -\dfrac16 as x→0x \to 0

The limit is −16-\tfrac16. L'Hôpital's rule needs three rounds of differentiation; the Taylor series gives the answer in one line and also tells you that sin⁡x\sin x differs from xx by about x3/6x^3/6.

Engineering uses

Example 8 · Small-signal diode model

A diode obeys i=ISev/VTi = I_S e^{v/V_T} and operates at ID=1 mAI_D = 1\ \text{mA}, VT=26 mVV_T = 26\ \text{mV}. If the voltage rises by Δv=2 mV\Delta v = 2\ \text{mV}, what is the current?

  1. First-order Taylor expansion about the operating point: i≈ID(1+ΔvVT)i \approx I_D\left(1 + \dfrac{\Delta v}{V_T}\right), with small-signal resistance rd=VT/ID=26 Ωr_d = V_T/I_D = 26\ \Omega

  2. Approximation: 1 mA×(1+2/26)=1.0769 mA1\ \text{mA}\times(1 + 2/26) = 1.0769\ \text{mA}

  3. Exact: 1 mA×e2/26=1.0800 mA1\ \text{mA}\times e^{2/26} = 1.0800\ \text{mA}, an error of 0.3%, because Δv\Delta v is much smaller than VTV_T

≈1.077 mA\approx 1.077\ \text{mA}. This is where every small-signal equivalent circuit in electronics comes from.

  • Pendulums and control systems sin⁡θ≈θ\sin\theta \approx \theta turns a nonlinear equation into a linear differential equation that can be solved with Laplace transforms.
  • Sensitivity (1+x)n≈1+nx(1 + x)^n \approx 1 + nx: a 3% rise in voltage raises the power V2/RV^2/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.

Frequently asked questions

What is the difference between a Taylor series and a Maclaurin series?

A Maclaurin series is a Taylor series expanded about a=0a = 0, a special case. The formula is the same with a=0a = 0 substituted.

How many terms are enough?

It depends on the accuracy you need and the distance ∣x−a∣|x - a|. Use the Lagrange remainder bound ∣Rn∣≤M∣x−a∣n+1/(n+1)!|R_n| \le 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, sin⁡x, cos⁡xe^x,\ \sin x,\ \cos x have R=∞R = \infty, but ln⁡(1+x)\ln(1 + x) and 1/(1−x)1/(1 - x) have R=1R = 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⁡θ≈θ\sin\theta \approx \theta 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.

All 7 articles in Sequences & Series → · All articles