Unit 7, lesson 106

Taylor Polynomials and Taylor’s Theorem

How to build the polynomial that matches a function and its first n derivatives at a point, and how the Lagrange and integral remainders give a guaranteed bound on its error.

  • Theory part 211
  • Practice part 212
  • Taylor and Maclaurin Series

A calculator cannot compute 4.1\sqrt{4.1} or e0.1e^{0.1} directly. It can only add and multiply, so it evaluates a polynomial. The tangent line is the first such polynomial, matching the value and the slope at one point. Matching the second, third and later derivatives as well gives better and better polynomials, and Taylor’s theorem tells you exactly how far off each one can be.

Key terms

Higher derivatives

Definition The derivatives of ff of higher order are defined one after another by f(0)=ff^{(0)} = f and f(n+1)=(f(n))′f^{(n+1)} = \bigl(f^{(n)}\bigr)', wherever that derivative exists. So f(1)=f′f^{(1)} = f', f(2)=f′′f^{(2)} = f'', f(3)=f′′′f^{(3)} = f'''. A function is nn times differentiable at aa if f(n)(a)f^{(n)}(a) exists, and it is of class CnC^n on an interval if f(n)f^{(n)} exists and is continuous there.

In plain words Keep differentiating. Each new derivative describes a finer feature of the graph near a point.

Example For f(x)=ln⁡xf(x) = \ln x on (0,∞)(0, \infty),

f′(x)=1x,f′′(x)=−1x2,f′′′(x)=2x3,f(4)(x)=−6x4,f'(x) = \frac{1}{x}, \quad f''(x) = -\frac{1}{x^2}, \quad f'''(x) = \frac{2}{x^3}, \quad f^{(4)}(x) = -\frac{6}{x^4},

and in general

f(n)(x)=(−1)n−1(n−1)!xnfor n≥1.f^{(n)}(x) = (-1)^{n-1} \frac{(n - 1)!}{x^n} \qquad \text{for } n \ge 1.

Expansion center

Definition The expansion center is the point aa at which a polynomial approximation is built. It must be a point where ff has as many derivatives as the polynomial uses, so f(n)(a)f^{(n)}(a) must exist for a polynomial of degree nn.

In plain words Choose the center where you know everything about ff and close to the xx you care about. The approximation is best near the center.

Example To approximate 4.1\sqrt{4.1}, center at a=4a = 4, where 4=2\sqrt{4} = 2 and the derivatives are easy. Centering at a=0a = 0 would fail, since x\sqrt{x} is not differentiable at 00.

Taylor polynomial

Definition Let ff be nn times differentiable at aa. The Taylor polynomial of degree nn of ff at aa is

Tn(x)=∑k=0nf(k)(a)k!(x−a)k=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+⋯+f(n)(a)n!(x−a)n.T_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!} (x - a)^k = f(a) + f'(a)(x - a) + \frac{f''(a)}{2!}(x - a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x - a)^n.

It is the unique polynomial of degree at most nn with Tn(k)(a)=f(k)(a)T_n^{(k)}(a) = f^{(k)}(a) for k=0,1,…,nk = 0, 1, \ldots, n. For n=1n = 1 it is the tangent line.

In plain words It is the polynomial whose value, slope, bending and so on up to order nn agree with those of ff at aa.

Example Take f(x)=xf(x) = \sqrt{x} at a=4a = 4. Then f(4)=2f(4) = 2 and

f′(4)=124=14,f′′(4)=−14⋅4−3/2=−132.f'(4) = \frac{1}{2\sqrt{4}} = \frac{1}{4}, \qquad f''(4) = -\frac{1}{4} \cdot 4^{-3/2} = -\frac{1}{32}.

So

T2(x)=2+x−44−(x−4)264,T2(4.1)=2.02484375,T_2(x) = 2 + \frac{x - 4}{4} - \frac{(x - 4)^2}{64}, \qquad T_2(4.1) = 2.02484375,

while 4.1=2.0248456…\sqrt{4.1} = 2.0248456\ldots.

Maclaurin polynomial

Definition A Maclaurin polynomial is a Taylor polynomial with center a=0a = 0,

Tn(x)=∑k=0nf(k)(0)k!xk.T_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(0)}{k!} x^k.

In plain words It is the special case centered at the origin, which is the most common choice when ff is well behaved at 00.

Example Every derivative of exe^x is exe^x, which equals 11 at 00. So the Maclaurin polynomial of degree 33 is

T3(x)=1+x+x22+x36.T_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}.

At x=0.1x = 0.1 it gives 1.1051666…1.1051666\ldots, and e0.1=1.1051709…e^{0.1} = 1.1051709\ldots. You can reproduce this in the Taylor polynomial explorer by choosing exe^x with degree 33 and x=0.1x = 0.1, and its error readout shows the gap of about 4.25×10−64.25 \times 10^{-6}.

Lagrange remainder

Definition The remainder is Rn(x)=f(x)−Tn(x)R_n(x) = f(x) - T_n(x). Taylor’s theorem with Lagrange remainder says the following. Let ff be n+1n + 1 times differentiable on an open interval II containing aa. Then for each x∈Ix \in I with x≠ax \neq a there is a number zz strictly between aa and xx such that

Rn(x)=f(n+1)(z)(n+1)!(x−a)n+1.R_n(x) = \frac{f^{(n+1)}(z)}{(n + 1)!} (x - a)^{n+1}.

For n=0n = 0 this is the mean value theorem.

In plain words The error looks exactly like the next term of the polynomial, except that the derivative is taken at some unknown point between aa and xx.

Example For exe^x with n=3n = 3, a=0a = 0 and x=0.1x = 0.1, there is a zz in (0,0.1)(0, 0.1) with

R3(0.1)=ez24(0.1)4.R_3(0.1) = \frac{e^z}{24}(0.1)^4.

Since 1<ez<e0.11 < e^z < e^{0.1}, the error lies between about 4.167×10−64.167 \times 10^{-6} and 4.605×10−64.605 \times 10^{-6}. The true error is about 4.25×10−64.25 \times 10^{-6}.

Integral remainder

Definition Let f(n+1)f^{(n+1)} be continuous on an interval containing aa and xx. Then

Rn(x)=∫axf(n+1)(t)n!(x−t)n dt.R_n(x) = \int_a^x \frac{f^{(n+1)}(t)}{n!} (x - t)^n \, dt.

For n=0n = 0 this is the fundamental theorem of calculus,

f(x)=f(a)+∫axf′(t) dt,f(x) = f(a) + \int_a^x f'(t) \, dt,

and the general case follows by integrating by parts nn times.

In plain words This form gives the error exactly as an integral, with no unknown point in it. It needs a little more smoothness than the Lagrange form.

Example For exe^x with n=1n = 1 and a=0a = 0,

R1(x)=∫0xet(x−t) dt=[et(x−t)]0x+∫0xet dt=−x+ex−1,R_1(x) = \int_0^x e^t (x - t) \, dt = \Bigl[e^t (x - t)\Bigr]_0^x + \int_0^x e^t \, dt = -x + e^x - 1,

which is exactly ex−(1+x)e^x - (1 + x). At x=1x = 1 the error is e−2≈0.718e - 2 \approx 0.718.

Derivative bounds on the interval

Definition To estimate Rn(x)R_n(x) from either form you need a number MM with

∣f(n+1)(t)∣≤Mfor every t between a and x,\bigl\lvert f^{(n+1)}(t) \bigr\rvert \le M \quad \text{for every } t \text{ between } a \text{ and } x,

or for every tt in a fixed interval ∣t−a∣≤d\lvert t - a \rvert \le d that contains xx. The bound must hold on the whole interval, not only at aa, because the point zz in the Lagrange form is unknown.

In plain words You do not know where zz is, so bound the next derivative everywhere it could be.

Example For ln⁡x\ln x on [1,1.5][1, 1.5] we have f′′(t)=−1t2f''(t) = -\frac{1}{t^2}, so ∣f′′(t)∣≤1\lvert f''(t) \rvert \le 1 with the largest value at t=1t = 1. For sin⁡x\sin x every derivative is ±sin⁡x\pm \sin x or ±cos⁡x\pm \cos x, so M=1M = 1 works on any interval for every nn.

Taylor’s inequality

Definition Let ff be n+1n + 1 times differentiable on [a−d,a+d][a - d, a + d], where d>0d > 0, and suppose ∣f(n+1)(t)∣≤M\bigl\lvert f^{(n+1)}(t) \bigr\rvert \le M for all tt in that interval. Then

∣Rn(x)∣≤M(n+1)!∣x−a∣n+1for all x with ∣x−a∣≤d.\lvert R_n(x) \rvert \le \frac{M}{(n + 1)!} \lvert x - a \rvert^{n+1} \qquad \text{for all } x \text{ with } \lvert x - a \rvert \le d.

In plain words The error is at most the bound on the next derivative, times the distance to the center to the power n+1n + 1, divided by (n+1)!(n + 1)!.

Example For sin⁡x\sin x at a=0a = 0 the polynomials T3T_3 and T4T_4 are both x−x36x - \frac{x^3}{6}, since sin⁡(4)(0)=0\sin^{(4)}(0) = 0. Using n=4n = 4 and M=1M = 1,

∣sin⁡0.5−(0.5−0.536)∣≤0.55120≈0.000260.\left\lvert \sin 0.5 - \left(0.5 - \frac{0.5^3}{6}\right) \right\rvert \le \frac{0.5^5}{120} \approx 0.000260.

The actual error is 0.4794255−0.4791667≈0.0002590.4794255 - 0.4791667 \approx 0.000259, just under the bound.

Check yourself

  1. Find the Taylor polynomial of degree 22 of ln⁡x\ln x at a=1a = 1, and use it to estimate ln⁡1.2\ln 1.2.
Show the answer

The values are f(1)=0f(1) = 0, f′(1)=1f'(1) = 1 and f′′(1)=−1f''(1) = -1, so

T2(x)=(x−1)−(x−1)22.T_2(x) = (x - 1) - \frac{(x - 1)^2}{2}.

Then T2(1.2)=0.2−0.02=0.18T_2(1.2) = 0.2 - 0.02 = 0.18, while ln⁡1.2≈0.1823\ln 1.2 \approx 0.1823.

  1. Bound the error of ex≈1+x+x22e^x \approx 1 + x + \frac{x^2}{2} for 0≤x≤0.50 \le x \le 0.5.
Show the answer

Here n=2n = 2 and f′′′(t)=et≤e0.5<2f'''(t) = e^t \le e^{0.5} < 2 on [0,0.5][0, 0.5]. Taylor’s inequality gives

∣R2(x)∣≤23!(0.5)3=124≈0.042.\lvert R_2(x) \rvert \le \frac{2}{3!}(0.5)^3 = \frac{1}{24} \approx 0.042.
  1. What is the Maclaurin polynomial of degree 33 of cos⁡x\cos x?
Show the answer

The derivatives at 00 are 1,0,−1,01, 0, -1, 0, so T3(x)=1−x22T_3(x) = 1 - \frac{x^2}{2}. The cubic coefficient is 00.

How this lesson connects

It also uses polynomial approximation and remainder.

Resources for this lesson