Skip to contentSkip to lesson map

Taylor Polynomials

Status
Updates coming
Reading
Supplemental Reading
Lesson map

Objectives

  1. Compute a Taylor polynomial of a given degree, centered at a given input, by hand and in R; understand that a linear approximation is a degree-one Taylor polynomial.
  2. Understand how a Taylor polynomial uses derivatives to match certain behaviors of a function at a given input (value, slope, concavity, etc.).
  3. Use a Taylor polynomial to estimate a function value at a given input, and compute the error, by hand and in R.
  4. Understand how the degree and the distance from the “center” affect accuracy.

1. Computing a Taylor Polynomial

Objective. Compute a Taylor polynomial of a given degree, centered at a given input, by hand and in R; understand that a linear approximation is a degree-one Taylor polynomial.

For a whole number nn, the notation f(n)f^{(n)} means the nnth derivative of ff, with f(0)=ff^{(0)} = f. The number n!n! (“nn factorial”) is the product n⋅(n−1)⋯2⋅1n \cdot (n-1) \cdots 2 \cdot 1, with 0!=10! = 1 and 1!=11! = 1. For example, 2!=22! = 2, 3!=63! = 6, and 4!=244! = 24.

Definition 1 (Taylor polynomial).

Let ff have nn derivatives at x=ax = a. The degree nn Taylor polynomial of ff centered at x=ax = a is the polynomial TnT_n of degree at most nn whose value and first nn derivatives at x=ax = a match those of ff:

Tn(x)=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+f′′′(a)3!(x−a)3+⋯+f(n)(a)n!(x−a)n. T_n(x) = f(a) + f'(a)(x - a) + \frac{f''(a)}{2!}(x - a)^2 + \frac{f'''(a)}{3!}(x - a)^3 + \dots + \frac{f^{(n)}(a)}{n!}(x - a)^n.

The function f(x)=∣x∣f(x) = |x| has no degree 1 Taylor polynomial centered at x=0x = 0, because the definition requires one derivative at x=0x = 0 and f′(0)f'(0) does not exist. The average rates of change of ∣x∣|x| near 0 are 1 from the right and −1-1 from the left (Lesson 25 section 2).

Definition 2 (Center).

The center of TnT_n is the input aa at which ff and every derivative in TnT_n are evaluated.

In T1(x)=f(4)+f′(4)(x−4)T_1(x) = f(4) + f'(4)(x - 4) evaluated at x=4.2x = 4.2, the input 4.2 is not the center, because ff and its derivative are evaluated at 4 and 4.2 enters only through the factor x−4x - 4.

A Taylor polynomial centered at x=0x = 0 is also called a Maclaurin polynomial.

The degree 1 Taylor polynomial is the linear approximation of Lesson 30 section 1:

T1(x)=f(a)+f′(a)(x−a)=L(x). T_1(x) = f(a) + f'(a)(x - a) = L(x).

To compute the degree nn Taylor polynomial TnT_n of ff centered at x=ax = a by hand:

  1. Take the derivatives of ff up to the nnth.
  2. Evaluate ff and each derivative at the center aa.
  3. For each kk from 0 to nn, divide the kkth derivative’s value by k!k! and multiply by (x−a)k(x - a)^k.
  4. Add the n+1n + 1 terms.

Example 1

Find the degree 3 Taylor polynomial centered at x=0x = 0 of

f(x)=ex. f(x) = e^x.
ShowHide solution

By the definition of a Taylor polynomial with n=3n = 3 and a=0a = 0, the degree 3 Taylor polynomial centered at x=0x = 0 is

T3(x)=f(0)+f′(0)x+f′′(0)2!x2+f′′′(0)3!x3. T_3(x) = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \frac{f'''(0)}{3!}x^3.

Every derivative of exe^x is exe^x. By the definition of center, evaluate ff and its first three derivatives at a=0a = 0:

f(0)=f′(0)=f′′(0)=f′′′(0)=e0=1. f(0) = f'(0) = f''(0) = f'''(0) = e^0 = 1.

Substitute the four values into the formula for T3T_3:

T3(x)=1+1⋅x+12!x2+13!x3=1+x+x22+x36. T_3(x) = 1 + 1 \cdot x + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}.

Example 2

Find the degree 1 and degree 2 Taylor polynomials centered at x=4x = 4 of

f(x)=x. f(x) = \sqrt{x}.
ShowHide solution

The degree 2 Taylor polynomial centered at x=4x = 4 is

T2(x)=f(4)+f′(4)(x−4)+f′′(4)2!(x−4)2, T_2(x) = f(4) + f'(4)(x - 4) + \frac{f''(4)}{2!}(x - 4)^2,

and T1T_1 is its first two terms. With f(x)=x1/2f(x) = x^{1/2}, f′(x)=12x−1/2f'(x) = \tfrac{1}{2}x^{-1/2}, and f′′(x)=−14x−3/2f''(x) = -\tfrac{1}{4}x^{-3/2}, evaluate at the center:

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

Substitute the three values into the formula for T2T_2:

T2(x)=2+14(x−4)+−1/322!(x−4)2=2+14(x−4)−164(x−4)2. T_2(x) = 2 + \frac{1}{4}(x - 4) + \frac{-1/32}{2!}(x - 4)^2 = 2 + \frac{1}{4}(x - 4) - \frac{1}{64}(x - 4)^2.

Its first two terms give

T1(x)=2+14(x−4). T_1(x) = 2 + \frac{1}{4}(x - 4).

The polynomial T1T_1 is the linear approximation of x\sqrt{x} when x=4x = 4, because it is L(x)=f(a)+f′(a)(x−a)L(x) = f(a) + f'(a)(x - a) with a=4a = 4.

Example 3

Find the degree 3 Taylor polynomial centered at x=1x = 1 of

f(x)=ln⁡x. f(x) = \ln x.
ShowHide solution

The derivative is f′(x)=1x=x−1f'(x) = \tfrac{1}{x} = x^{-1}, and the power rule gives f′′(x)=−x−2=−1x2f''(x) = -x^{-2} = -\tfrac{1}{x^2} and f′′′(x)=2x−3=2x3f'''(x) = 2x^{-3} = \tfrac{2}{x^3}. Evaluate at the center:

f(1)=ln⁡1=0,f′(1)=11=1,f′′(1)=−112=−1,f′′′(1)=213=2. f(1) = \ln 1 = 0, \qquad f'(1) = \frac{1}{1} = 1, \qquad f''(1) = -\frac{1}{1^2} = -1, \qquad f'''(1) = \frac{2}{1^3} = 2.

Substitute the four values into the formula for T3T_3:

T3(x)=0+1(x−1)+−12!(x−1)2+23!(x−1)3=(x−1)−(x−1)22+(x−1)33. T_3(x) = 0 + 1(x - 1) + \frac{-1}{2!}(x - 1)^2 + \frac{2}{3!}(x - 1)^3 = (x - 1) - \frac{(x - 1)^2}{2} + \frac{(x - 1)^3}{3}.

Example 4

Find the degree 2 Taylor polynomial centered at x=0x = 0 of

f(x)=e2x. f(x) = e^{2x}.
ShowHide solution

By the chain rule, f′(x)=2e2xf'(x) = 2e^{2x} and f′′(x)=4e2xf''(x) = 4e^{2x}. Evaluate at the center:

f(0)=e0=1,f′(0)=2e0=2,f′′(0)=4e0=4. f(0) = e^0 = 1, \qquad f'(0) = 2e^0 = 2, \qquad f''(0) = 4e^0 = 4.

Substitute the three values into the formula for T2T_2:

T2(x)=1+2x+42!x2=1+2x+2x2. T_2(x) = 1 + 2x + \frac{4}{2!}x^2 = 1 + 2x + 2x^2.

Taylor polynomials in R. The command D(f(x) ~ x) returns the derivative, and D(f(x) ~ x & x) returns the second derivative (Lesson 29 section 5). Each added & x gives one more derivative: the third derivative is D(f(x) ~ x & x & x). The command factorial(k) returns k!k!. Build the Taylor polynomial with makeFun from the derivative values.

Example 5

Find the degree 3 Taylor polynomial centered at x=0x = 0 of

f(x)=ex f(x) = e^x

in R, and plot it with ff.

ShowHide solution

Define ff and its first three derivatives, and evaluate each at the center 0. Used R.

f = makeFun(exp(x) ~ x)
df = D(f(x) ~ x)
d2f = D(f(x) ~ x & x)
d3f = D(f(x) ~ x & x & x)
c(f(0), df(0), d2f(0), d3f(0))
[1] 1 1 1 1

Build T3T_3 from the four values with makeFun, and plot it in orange over the graph of ff.

T3 = makeFun(f(0) + df(0)*(x - 0) + d2f(0)/factorial(2)*(x - 0)^2
+ d3f(0)/factorial(3)*(x - 0)^3 ~ x)
plotFun(f(x) ~ x, xlim = range(-3, 3))
plotFun(T3(x) ~ x, add = TRUE, col = "darkorange")

The R steps are the hand steps of Example 1. The line c(f(0), df(0), d2f(0), d3f(0)) prints f(0)f(0), f′(0)f'(0), f′′(0)f''(0), and f′′′(0)f'''(0). In the definition of T3, the term d2f(0)/factorial(2)*(x - 0)^2 is R’s form of the term f′′(0)2!(x−0)2\frac{f''(0)}{2!}(x - 0)^2. With the four values equal to 1, T3 is the polynomial T3(x)=1+x+x22+x36T_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} of Example 1.

The figure in section 2 shows the same two graphs for −2≤x≤2-2 \le x \le 2: exe^x is the solid black curve, and T3T_3 is the orange dotted curve. The figure also shows the degree 1 and degree 2 Taylor polynomials T1T_1 and T2T_2 of exe^x.

The center in makeFun. Write the center as a number. Inside makeFun, a letter such as a in place of 4 becomes a second input of the function:

> T1 = makeFun(f(4) + df(4)*(x - a) ~ x)
> T1(4.2)
Error in T1(4.2) : argument "a" is missing, with no default

Lesson map

2. Matching the Behavior of a Function

Objective. Understand how a Taylor polynomial uses derivatives to match certain behaviors of a function at a given input (value, slope, concavity, etc.).

Theorem 3 (Matching at the center).

Let ff have nn derivatives at x=ax = a. At the center x=ax = a, the Taylor polynomial TnT_n has the same value as ff and the same first nn derivatives:

Tn(a)=f(a),Tn′(a)=f′(a),Tn′′(a)=f′′(a),…,Tn(n)(a)=f(n)(a). T_n(a) = f(a), \qquad T_n'(a) = f'(a), \qquad T_n''(a) = f''(a), \qquad \dots, \qquad T_n^{(n)}(a) = f^{(n)}(a).

The table lists the behavior that TnT_n and ff share at aa under each matched condition.

Condition at the centerBehavior matchedShared by TnT_n and ff at aa
Tn(a)=f(a)T_n(a) = f(a)valueboth graphs pass through (a,f(a))(a, f(a))
Tn′(a)=f′(a)>0T_n'(a) = f'(a) > 0slopeboth increasing at aa
Tn′(a)=f′(a)<0T_n'(a) = f'(a) < 0slopeboth decreasing at aa
Tn′′(a)=f′′(a)>0T_n''(a) = f''(a) > 0concavityboth concave up at aa
Tn′′(a)=f′′(a)<0T_n''(a) = f''(a) < 0concavityboth concave down at aa

The slope rows apply when n≥1n \ge 1, and the concavity rows apply when n≥2n \ge 2.

The graph of T1T_1 is the tangent line to the graph of ff at (a,f(a))(a, f(a)), because T1T_1 matches value and slope. When f′′(a)≠0f''(a) \neq 0, the graph of T2T_2 has the same concavity as the graph of ff at x=ax = a, because T2T_2 also matches the second derivative. The polynomial Tn+1T_{n+1} matches one more derivative than TnT_n.

The figure shows exe^x with its degree 1, 2, and 3 Taylor polynomials centered at x=0x = 0; the degree 3 polynomial is the T3T_3 of Example 1.

Figure

The function f(x)=e−xf(x) = e^{-x} shows the decreasing case. Its derivatives f′(x)=−e−xf'(x) = -e^{-x} and f′′(x)=e−xf''(x) = e^{-x} give f(0)=1f(0) = 1, f′(0)=−1<0f'(0) = -1 < 0, and f′′(0)=1>0f''(0) = 1 > 0. The Taylor polynomials centered at x=0x = 0 are

T1(x)=1−x,T2(x)=1−x+x22. T_1(x) = 1 - x, \qquad T_2(x) = 1 - x + \frac{x^2}{2}.

Both graphs fall through (0,1)(0, 1) with e−xe^{-x}, and T2T_2 is concave up there like e−xe^{-x}.

Figure

Factorial coefficients. Let AA be the coefficient of (x−a)k(x - a)^k in TnT_n. The kkth derivative of A(x−a)kA(x - a)^k is k! Ak!\,A, and each of the remaining terms of TnT_n has kkth derivative 0 at x=ax = a. For a term of lower degree, the kkth derivative is 0. For a term of higher degree, the kkth derivative still has a factor x−ax - a, which is 0 at x=ax = a. As a result, Tn(k)(a)=k! AT_n^{(k)}(a) = k!\,A, and matching f(k)(a)f^{(k)}(a) requires k! A=f(k)(a)k!\,A = f^{(k)}(a). The coefficient of (x−a)k(x - a)^k is therefore f(k)(a)k!\tfrac{f^{(k)}(a)}{k!}.

Example 6

The degree 2 Taylor polynomial of a function ff centered at x=2x = 2 is

T2(x)=5−3(x−2)+4(x−2)2. T_2(x) = 5 - 3(x - 2) + 4(x - 2)^2.

Find f(2)f(2), f′(2)f'(2), and f′′(2)f''(2). Determine whether ff is increasing or decreasing at x=2x = 2, and whether it is concave up or concave down there.

ShowHide solution

By the definition of a Taylor polynomial, the coefficient of (x−2)k(x - 2)^k is f(k)(2)k!\tfrac{f^{(k)}(2)}{k!}. The constant term is f(2)=5f(2) = 5, and the coefficient of x−2x - 2 is f′(2)=−3f'(2) = -3. Since the coefficient of (x−2)2(x - 2)^2 is f′′(2)2!=4\tfrac{f''(2)}{2!} = 4,

f′′(2)=2!⋅4=8. f''(2) = 2! \cdot 4 = 8.

The function ff is decreasing at x=2x = 2, because f′(2)<0f'(2) < 0. It is concave up there, because f′′(2)>0f''(2) > 0.

Example 7

Find the degree 4 Taylor polynomial centered at x=0x = 0 of

f(x)=cos⁡x. f(x) = \cos x.

Then explain why it has no odd powers of xx.

ShowHide solution

The derivatives of cos⁡x\cos x are f′(x)=−sin⁡xf'(x) = -\sin x, f′′(x)=−cos⁡xf''(x) = -\cos x, f′′′(x)=sin⁡xf'''(x) = \sin x, and f(4)(x)=cos⁡xf^{(4)}(x) = \cos x. Evaluate ff and its first four derivatives at the center:

f(0)=cos⁡0=1,f′(0)=−sin⁡0=0,f′′(0)=−cos⁡0=−1,f′′′(0)=sin⁡0=0,f(4)(0)=cos⁡0=1. f(0) = \cos 0 = 1, \quad f'(0) = -\sin 0 = 0, \quad f''(0) = -\cos 0 = -1, \quad f'''(0) = \sin 0 = 0, \quad f^{(4)}(0) = \cos 0 = 1.

Substitute the five values into the formula for T4T_4:

T4(x)=1+0x+−12!x2+03!x3+14!x4=1−x22+x424. T_4(x) = 1 + 0x + \frac{-1}{2!}x^2 + \frac{0}{3!}x^3 + \frac{1}{4!}x^4 = 1 - \frac{x^2}{2} + \frac{x^4}{24}.

The odd powers drop out because the odd-order derivatives f′(0)f'(0) and f′′′(0)f'''(0) are both 0 at the center.

Example 8

Find the degree 2 Taylor polynomial centered at x=π2x = \tfrac{\pi}{2} of

f(x)=sin⁡x. f(x) = \sin x.
ShowHide solution

With f′(x)=cos⁡xf'(x) = \cos x and f′′(x)=−sin⁡xf''(x) = -\sin x, evaluate ff and its first two derivatives at the center, where sin⁡π2=1\sin\tfrac{\pi}{2} = 1 and cos⁡π2=0\cos\tfrac{\pi}{2} = 0:

f ⁣(π2)=1,f′ ⁣(π2)=cos⁡π2=0,f′′ ⁣(π2)=−sin⁡π2=−1. f\!\left(\tfrac{\pi}{2}\right) = 1, \qquad f'\!\left(\tfrac{\pi}{2}\right) = \cos\tfrac{\pi}{2} = 0, \qquad f''\!\left(\tfrac{\pi}{2}\right) = -\sin\tfrac{\pi}{2} = -1.

Substitute the three values into the formula for T2T_2:

T2(x)=1+0(x−π2)−12!(x−π2)2=1−12(x−π2)2. T_2(x) = 1 + 0\left(x - \tfrac{\pi}{2}\right) - \frac{1}{2!}\left(x - \tfrac{\pi}{2}\right)^2 = 1 - \frac{1}{2}\left(x - \tfrac{\pi}{2}\right)^2.

Since f′(π2)=0f'\bigl(\tfrac{\pi}{2}\bigr) = 0 and f′′(π2)<0f''\bigl(\tfrac{\pi}{2}\bigr) < 0, the function sin⁡x\sin x has a maximum at x=π2x = \tfrac{\pi}{2}. The polynomial T2T_2 shares its value, slope, and concavity there. On the graph, T2T_2 is a parabola that is concave down like sin⁡x\sin x. It passes through the maximum point (π2,1)\bigl(\tfrac{\pi}{2}, 1\bigr) with a horizontal tangent line there.

Figure

Lesson map

3. Estimating a Value and Its Error

Objective. Use a Taylor polynomial to estimate a function value at a given input, and compute the error, by hand and in R.

For an input bb near the center, the value Tn(b)T_n(b) estimates f(b)f(b).

Definition 4 (Error).

The error of the estimate Tn(b)T_n(b) is the distance between the true value and the estimate:

error=∣f(b)−Tn(b)∣. \text{error} = \left| f(b) - T_n(b) \right|.

The distance ∣T2(b)−T1(b)∣|T_2(b) - T_1(b)| between two estimates is not an error, because an error is the distance from the true value f(b)f(b).

Example 9

For f(x)=xf(x) = \sqrt{x} centered at x=4x = 4, the degree 1 and degree 2 Taylor polynomials are

T1(x)=2+14(x−4),T2(x)=2+14(x−4)−164(x−4)2. T_1(x) = 2 + \frac{1}{4}(x - 4), \qquad T_2(x) = 2 + \frac{1}{4}(x - 4) - \frac{1}{64}(x - 4)^2.

Estimate 4.2\sqrt{4.2} with each, and compute the error of each estimate.

ShowHide solution

By the definition of error, the error of an estimate is

error=∣f(b)−Tn(b)∣. \text{error} = \left| f(b) - T_n(b) \right|.

Both errors are computed with the true value at full precision, 4.2=2.04939015…\sqrt{4.2} = 2.04939015\ldots from a calculator. Evaluate T1T_1 at b=4.2b = 4.2, then compute its error:

T1(4.2)=2+14(0.2)=2.05,error=∣2.04939015…−2.05∣≈0.000610. T_1(4.2) = 2 + \frac{1}{4}(0.2) = 2.05, \qquad \text{error} = |2.04939015\ldots - 2.05| \approx 0.000610.

Evaluate T2T_2 at b=4.2b = 4.2, then compute its error:

T2(4.2)=2+14(0.2)−164(0.2)2=2.05−0.000625=2.049375, T_2(4.2) = 2 + \frac{1}{4}(0.2) - \frac{1}{64}(0.2)^2 = 2.05 - 0.000625 = 2.049375,
error=∣2.04939015…−2.049375∣≈0.000015. \text{error} = |2.04939015\ldots - 2.049375| \approx 0.000015.

Example 10

For f(x)=e2xf(x) = e^{2x} centered at x=0x = 0, the degree 2 Taylor polynomial is

T2(x)=1+2x+2x2. T_2(x) = 1 + 2x + 2x^2.

Estimate e0.2e^{0.2} with T2T_2, and compute the error.

ShowHide solution

The input for the estimate is b=0.1b = 0.1, because

e0.2=e2(0.1)=f(0.1). e^{0.2} = e^{2(0.1)} = f(0.1).

Evaluate T2T_2 at b=0.1b = 0.1:

T2(0.1)=1+2(0.1)+2(0.1)2=1+0.2+0.02=1.22. T_2(0.1) = 1 + 2(0.1) + 2(0.1)^2 = 1 + 0.2 + 0.02 = 1.22.

With the true value e0.2=1.22140276…e^{0.2} = 1.22140276\ldots from a calculator, the error is

∣1.22140276…−1.22∣=0.00140276…≈0.001403. |1.22140276\ldots - 1.22| = 0.00140276\ldots \approx 0.001403.

Example 11

For f(x)=xf(x) = \sqrt{x} centered at x=4x = 4, estimate 4.2\sqrt{4.2} with the degree 1 and degree 2 Taylor polynomials in R, and compute the error of each estimate.

ShowHide solution

Build both Taylor polynomials from the derivatives of ff at 4, evaluate each at x=4.2x = 4.2, and compute each error. Used R.

f = makeFun(sqrt(x) ~ x)
df = D(f(x) ~ x)
d2f = D(f(x) ~ x & x)
T1 = makeFun(f(4) + df(4)*(x - 4) ~ x)
T2 = makeFun(f(4) + df(4)*(x - 4) +
d2f(4)/factorial(2)*(x - 4)^2 ~ x)
T1(4.2)
[1] 2.05
T2(4.2)
[1] 2.049375
abs(f(4.2) - T1(4.2))
[1] 0.0006098468
abs(f(4.2) - T2(4.2))
[1] 1.515319e-05

The lines T1(4.2) and T2(4.2) compute the estimates, and each line with abs() computes the error ∣f(4.2)−Tn(4.2)∣|f(4.2) - T_n(4.2)| of the definition. The estimates and the errors match Example 9: T1(4.2)=2.05T_1(4.2) = 2.05 with error about 0.000610, and T2(4.2)=2.049375T_2(4.2) = 2.049375 with error about 0.000015.

Scientific notation. R prints a very small number in scientific notation: 1.515319e-05 means 1.515319×10−5≈0.000015151.515319 \times 10^{-5} \approx 0.00001515.

Lesson map

4. Degree, Distance, and Accuracy

Objective. Understand how the degree and the distance from the “center” affect accuracy.

An estimate is more accurate than another when its error is smaller. The table gives the error ∣eb−Tn(b)∣|e^b - T_n(b)|, rounded to four significant digits, for the Taylor polynomials of exe^x centered at x=0x = 0. Every derivative of exe^x is 1 at x=0x = 0. As a result, each entry is the distance between ebe^b and Tn(b)=1+b+b22!+⋯+bnn!T_n(b) = 1 + b + \frac{b^2}{2!} + \dots + \frac{b^n}{n!}.

∣eb−Tn(b)∣|e^b - T_n(b)|b=0.1b = 0.1b=0.5b = 0.5b=1b = 1b=2b = 2
T1T_10.0051710.14870.71834.389
T2T_20.00017090.023720.21832.389
T3T_30.0000042510.0028880.051621.056
T4T_40.000000084740.00028380.0099480.3891

Degree. Near the center, a higher-degree polynomial matches more derivatives of ff at the center and often gives a smaller error. Each column of the exe^x table shows this.

An added term with coefficient 0 leaves the error unchanged. For cos⁡x\cos x centered at x=0x = 0, the polynomials satisfy T3=T2T_3 = T_2, because f′′′(0)=0f'''(0) = 0 (Example 7).

Far from the center, a higher degree can give a larger error. For ln⁡x\ln x centered at x=1x = 1, the error at b=3b = 3 grows with each added degree. One more derivative of f(x)=ln⁡xf(x) = \ln x from Example 3 is f(4)(x)=−6x−4f^{(4)}(x) = -6x^{-4}, with f(4)(1)=−6f^{(4)}(1) = -6. The degree 4 term is therefore −64!(x−1)4=−(x−1)44\frac{-6}{4!}(x - 1)^4 = -\frac{(x - 1)^4}{4}. At b=3b = 3, the factor x−1x - 1 is 2. Substitute 2 for x−1x - 1 in each polynomial:

T1(3)=2,T2(3)=2−222=0,T3(3)=0+233=83,T4(3)=83−244=−43. T_1(3) = 2, \qquad T_2(3) = 2 - \frac{2^2}{2} = 0, \qquad T_3(3) = 0 + \frac{2^3}{3} = \frac{8}{3}, \qquad T_4(3) = \frac{8}{3} - \frac{2^4}{4} = -\frac{4}{3}.

With ln⁡3=1.098612…\ln 3 = 1.098612\ldots from a calculator, the estimates and their errors are:

T1T_1T2T_2T3T_3T4T_4
Tn(3)T_n(3)202.667−1.333-1.333
∣ln⁡3−Tn(3)∣|\ln 3 - T_n(3)|0.90141.0991.5682.432

Distance from the center. At a fixed degree, an input farther from the center often gives a larger error, as each row of the exe^x table shows. The error of T4T_4 grows from about 0.00000008474 at b=0.1b = 0.1 to about 0.3891 at b=2b = 2.

Example 12

For f(x)=ln⁡xf(x) = \ln x centered at x=1x = 1, the degree 3 Taylor polynomial is

T3(x)=(x−1)−(x−1)22+(x−1)33. T_3(x) = (x - 1) - \frac{(x - 1)^2}{2} + \frac{(x - 1)^3}{3}.

Estimate ln⁡(1.1)\ln(1.1), ln⁡(1.5)\ln(1.5), and ln⁡(2)\ln(2) with T3T_3, and determine which estimate is most accurate.

ShowHide solution

For each input bb, substitute bb into T3T_3, then compute the error with the true value ln⁡(b)\ln(b) from a calculator. For b=1.1b = 1.1,

T3(1.1)=0.1−0.122+0.133=0.1−0.005+0.000333…=0.095333…,error=∣0.095310…−0.095333…∣≈0.000023.\begin{align*} T_3(1.1) &= 0.1 - \frac{0.1^2}{2} + \frac{0.1^3}{3} = 0.1 - 0.005 + 0.000333\ldots = 0.095333\ldots,\\ \text{error} &= |0.095310\ldots - 0.095333\ldots| \approx 0.000023. \end{align*}

For b=1.5b = 1.5,

T3(1.5)=0.5−0.522+0.533=0.5−0.125+0.041666…=0.416666…,error=∣0.405465…−0.416666…∣≈0.011202.\begin{align*} T_3(1.5) &= 0.5 - \frac{0.5^2}{2} + \frac{0.5^3}{3} = 0.5 - 0.125 + 0.041666\ldots = 0.416666\ldots,\\ \text{error} &= |0.405465\ldots - 0.416666\ldots| \approx 0.011202. \end{align*}

For b=2b = 2,

T3(2)=1−122+133=1−0.5+0.333333…=0.833333…,error=∣0.693147…−0.833333…∣≈0.140186.\begin{align*} T_3(2) &= 1 - \frac{1^2}{2} + \frac{1^3}{3} = 1 - 0.5 + 0.333333\ldots = 0.833333\ldots,\\ \text{error} &= |0.693147\ldots - 0.833333\ldots| \approx 0.140186. \end{align*}

The estimate of ln⁡(1.1)\ln(1.1) is the most accurate, because it has the smallest error. The input 1.1 is also the input closest to the center 1. On the graph, each error is the vertical gap between ln⁡x\ln x and T3T_3 at bb: too small to see at b=1.1b = 1.1 and b=1.5b = 1.5, and visible at b=2b = 2.

Figure

Example 13

For f(x)=cos⁡xf(x) = \cos x centered at x=0x = 0, the degree 2 and degree 4 Taylor polynomials are

T2(x)=1−x22,T4(x)=1−x22+x424. T_2(x) = 1 - \frac{x^2}{2}, \qquad T_4(x) = 1 - \frac{x^2}{2} + \frac{x^4}{24}.

Estimate cos⁡(1)\cos(1) with each, and determine which degree gives the more accurate estimate.

ShowHide solution

For each polynomial, substitute b=1b = 1, then compute the error with the true value cos⁡(1)=0.540302…\cos(1) = 0.540302\ldots from a calculator. For T2T_2,

T2(1)=1−122=0.5,error=∣0.540302…−0.5∣≈0.040302.\begin{align*} T_2(1) &= 1 - \frac{1^2}{2} = 0.5,\\ \text{error} &= |0.540302\ldots - 0.5| \approx 0.040302. \end{align*}

For T4T_4,

T4(1)=1−122+1424=1−0.5+0.041666…=0.541666…,error=∣0.540302…−0.541666…∣≈0.001364.\begin{align*} T_4(1) &= 1 - \frac{1^2}{2} + \frac{1^4}{24} = 1 - 0.5 + 0.041666\ldots = 0.541666\ldots,\\ \text{error} &= |0.540302\ldots - 0.541666\ldots| \approx 0.001364. \end{align*}

The degree 4 estimate is more accurate: its error 0.001364 is about 130\tfrac{1}{30} of the error 0.040302 of T2T_2. The polynomial T4T_4 also matches two more derivatives of cos⁡x\cos x at the center than T2T_2 does.

Lesson map

Found a mistake, a broken tool or something unclear? Report a problem