Polynomials only use addition and multiplication, so we can evaluate them by hand. But there's no obvious way to compute a value like cos0.3 by hand. To estimate it, we can look for a polynomial that stays close to cosx near 0. Our closest tool so far is the tangent line at 0, the linear approximation f(0)+f′(0)x. Since cos0=1 and −sin0=0, the tangent line at 0 is just y=1.
But near 0,cosx is less than 1 on both sides. Its second derivative at 0 is −1, so it's concave down there. The tangent line y=1 has second derivative 0, so it can't be concave down.
cos0=1,−sin0=0→y=1
(cosx)′′x=0=−cos0=−1,(1)′′=0
To make our approximation concave down like cosx, we can add higher powers of x, and choose the coefficients so each new term matches one more derivative of cosx at 0.
cosx≈□+□x+□x2+□x3+□x4,□=?
cosx≈□+□x+□x2+□x3+□x4,□=?
Match derivatives at 0 to find a fourth-degree polynomial for cosx
Text solution
Value at 0Substituting x=0 makes every term with an x equal 0, so only the constant box is left.
□=cos0=1
Each derivative keeps one boxDifferentiating k times turns the powers below xk into 0, and the powers above still have an x, so at x=0 only the xk box is left, times the numbers the power rule brought down. For the second derivative:
2⋅1□=−cos0=−1→□=−21
The other boxesThe first and third derivatives of cosx at 0 are −sin0=0 and sin0=0, so those boxes are 0. The fourth brings down 4⋅3⋅2⋅1.
4⋅3⋅2⋅1□=cos0=1→□=241
The numbers in front of each box are factorials. For the xk term, differentiating k times multiplies its box by k(k−1)⋯1, which is k!. So the box for xk is the kth derivative of cosx at 0, divided by k!.
2!=2⋅1=2,3!=3⋅2⋅1=6,4!=4⋅3⋅2⋅1=24,0!=1!=1
Matching the value and the first four derivatives gives P4(x), the Taylor polynomial of degree 4 for cosx at 0. It stays close to cosx much farther from 0 than the tangent line does.
P4(x)=1−2!x2+4!x4=1−2x2+24x4
Since the x3 box is 0, the degree-3 Taylor polynomial P3(x) is the same as P2(x). Degree 3 means the highest power allowed is x3, not that there must be four separate terms.
P3(x)=1−2x2+0⋅x3=1−2x2=P2(x)
2
The Taylor polynomial for any function
For cosx, we matched each derivative at 0 by choosing the number in front of each power of x. We can do the same thing for any function f near 0.
Differentiating xk exactly k times gives k!, and every other term becomes 0 when we plug in x=0. So the kth derivative of the polynomial at 0 is just k! times the coefficient of xk. Matching that to f(k)(0) means the coefficient of xk is k!f(k)(0). We write f(4) for the fourth derivative.
Let's try this on ex. The derivative of ex is always ex, and e0=1. So every derivative at 0 is 1, which means every coefficient is k!1. None of them are 0, so unlike cosx, every power of x appears.
f(0)=f′(0)=f′′(0)=f′′′(0)=e0=1
P3(x)=1+x+2!x2+3!x3=1+x+2x2+6x3
For sinx, the derivatives at 0 cycle through 0,1,0,−1,0,1. Because every even derivative at 0 is 0, all the even-power terms are 0. That leaves only the odd powers, with alternating signs.
sin0=0,cos0=1,−sin0=0,−cos0=−1,sin0=0,cos0=1
P5(x)=x−3!x3+5!x5=x−6x3+120x5
A Taylor polynomial centered at 0 is also called a Maclaurin polynomial.
Does increasing the degree always add a term?
3
Centering at a number other than 0
We can't build a polynomial for lnx at 0:ln0 isn't defined, and neither is its derivative x1 at 0. At x=1, though, ln1=0, so let's build our polynomial around 1 instead, in powers of x−1.
lnx≈□+□(x−1)+□(x−1)2+□(x−1)3near x=1,□=?
lnx≈□+□(x−1)+□(x−1)2+□(x−1)3near x=1,□=?
Powers of x−1 do at x=1 what powers of x did at 0: each one becomes 0, so only the first box remains. With plain powers of x, every power of 1 is 1, and all the boxes would get added together.
Powers of x − 1
□+□(x−1)+□(x−1)2+□(x−1)3x=1=□
Powers of x
□+□x+□x2+□x3x=1=□+□+□+□
Find the third-degree Taylor polynomial for lnx about x=1
Text solution
Derivatives at 1As at 0, the kth derivative at 1 keeps only the (x−1)k box, times k!. So we need the derivatives of lnx at 1.
Each new degree stays close to lnx farther from 1. At 0.8, the true value is ln0.8≈−0.22314, so with just three terms the estimate agrees to about three decimal places.
For any center a, powers of x−a work the same way. Plugging in a makes each (x−a)k equal 0, and the kth derivative of (x−a)k is k!, so the coefficient in front of (x−a)k is always k!f(k)(a).
We leave P3 in powers of x−1 rather than expanding it, because the coefficient of each (x−1)k shows k!f(k)(1) directly.
4
Reading derivatives from a Taylor polynomial
That rule also works backwards. Suppose we're given a Taylor polynomial for f about 2, but no formula for f. We can still find f and its derivatives at 2, and use them to decide whether f has a local maximum there.
Find f(2),f′(2),f′′(2) and f′′′(2) from P3(x)=5−3(x−2)2+4(x−2)3, and decide if f has a local maximum at 2
P3(x)=5−3(x−2)2+4(x−2)3
f(2)=?f′(2)=?
f′′(2)=?f′′′(2)=?
local maximum at x=2?
Text solution
Multiply each coefficient by k!The coefficient of (x−2)k is k!f(k)(2), so f(k)(2) is k! times it. There's no (x−2) term, so f′(2)=0. And f′′(2) is −6, not −3.
f(2)f′(2)f′′(2)f′′′(2)=5=0=2!⋅(−3)=−6=3!⋅4=24
Second Derivative TestThe tangent line at x=2 is horizontal and f is concave down there, so f has a local maximum at x=2.
f′(2)=0,f′′(2)=−6<0
We can also see the maximum in the polynomial itself. Near 2, the cubic term is tiny next to the squared term: at x=2.1, we subtract 0.03 and add only 0.004. So P3(x) looks almost exactly like the downward-opening parabola 5−3(x−2)2, which has its highest point at (2,5).
5
How far off a Taylor polynomial can be
We can use the second-degree Taylor polynomial for ex about 0 to estimate e0.2.
P2(x)P2(0.2)=1+x+2x2=1+0.2+0.02=1.22
But we don't know the exact value of e0.2, which is the reason we're estimating it in the first place. So how far off can 1.22 be? On the graph, the error is the length of the vertical segment at x=0.2, from the polynomial up to the curve y=ex.
Find a bound on the error of P2(0.2)=1.22 as an estimate of e0.2
Text solution
The error is the first term left outStopping at degree 2 leaves out 3!e0x3. The error at 0.2 is that term with e0 changed to ec, for some c between 0 and 0.2.
e0.2−P2(0.2)=3!ec(0.2)3
Why: degree 0 and the Mean Value TheoremAt degree 0, the first term left out is f′(a)(x−a), and the Mean Value Theorem makes the error that same term with the derivative at c.
P0(x)f(x)−f(a)=f(a)=f′(c)(x−a)
Bound ec by M=3We can't find c, because it's different for each x. If it were the same, ex would be a cubic. But ex is increasing, so ec is at most e0.2.
ec≤e0.2<e<3,M=3
e0.2−1.22≤3⋅3!(0.2)3=63⋅0.008=0.004
So without knowing e0.2, we know 1.22 is off by at most 0.004. The true value is about 1.2214, so the actual error, about 0.0014, is well within the bound.
This upper bound is called the Lagrange error bound. We replace the unknown derivative with M, a number at least as large as the size of that derivative between the center and x. For a degree-2 polynomial, the error is at most M times the distance to the center cubed, divided by 3!.
e0.2−P2(0.2)≤M⋅3!(0.2)3
6
Overestimate or underestimate, and finding M
In Section 3, the third-degree Taylor polynomial for lnx about 1 estimated ln0.8 as −0.22267. Is that estimate too high or too low, and how far off can it be? To find out, we look at the first term we left out, which has the fourth derivative of lnx, the derivative of t32.
lnt,t1,−t21,t32,f(4)(t)=−t46
Check whether P3(0.8) overestimates or underestimates ln0.8, and bound the error
Text solution
The sign of the errorc is between 0.8 and 1, so it's positive and −c46 is negative. (−0.2)4 is positive, so the error is negative, and P3(0.8) is an overestimate.
ln0.8−P3(0.8)=−c46⋅4!(−0.2)4<0
ln0.8−P3(0.8)=−c46⋅4!(−0.2)4<0
P3(0.8)>ln0.8
The size of the errorTake absolute values, and replace ∣f(4)(c)∣ with M, the largest value of t46 on [0.8,1].
Finding M is the step to remember. As t increases, t46 decreases, so on [0.8,1] it's largest at the left end, t=0.8. We round 14.6 up to M=15, and the error is at most 0.001. In fact, ln0.8≈−0.22314, so the actual error is about −0.00048.
To estimate ln1.2 instead, the interval is [1,1.2].t46 is still largest at the left end, but now the left end is the center, so M=6.
x=1.2:on [1,1.2]
t46M≤146=6=6
Some functions make M easy. For sinx and cosx, every derivative is ±sint or ±cost, so its absolute value is at most 1, and we can always choose M=1.
Is the next derivative always largest in size at x?
7
Approximating e to within 0.001
The error bound can also tell us how many terms we need. Let's find the lowest-degree Taylor polynomial for ex about 0 that gives e with an error under 0.001. Since e=e1, we're evaluating the polynomial at x=1, and we'll test degrees one by one.
Find the lowest-degree Taylor polynomial for ex about 0 that gives e with error under 0.001
e−Pn(1)<0.001
lowest n=?
Text solution
M=3 at every degreeEvery derivative of ex is ex, which is increasing, so on [0,1] it's at most e, and e<3.
f(k)(t)=et≤e1<3,M=3
Test degreesFor degree n, the bound is 3 times the first term left out at x=1. Degree 6 is the first one under 0.001.
Check with P6(1)Since e=2.71828…, the actual error is about 0.0002.
P6(1)=1+1+21+61+241+1201+7201≈2.7181
P6(1)=1+1+21+61+241+1201+7201≈2.7181
M stayed 3 for every degree only because every derivative of ex is ex. For a function like lnx, each new degree brings a different derivative and a new value for M.
To center a Taylor polynomial at a, write it in powers of x−a. The coefficient of (x−a)k is k!f(k)(a), because differentiating (x−a)kk times brings down k!, and every other term is 0 at x=a. When a=0, these powers are just powers of x.
Degree and missing terms
cosx:P3(x)=P2(x)=1−2x2
cosx:P3(x)=P2(x)=1−2x2
The degree is the highest power of x−a allowed, not the number of terms. For cosx at 0, the third derivative is 0, so the x3 term is 0 and P3(x) is the same polynomial as P2(x).
Reading derivatives from a polynomial
5−3(x−2)2+4(x−2)3:f′(2)=0,f′′(2)=2!⋅(−3)=−6
5−3(x−2)2+4(x−2)3:f′(2)=0f′′(2)=2!⋅(−3)=−6
To find f(k)(a) from a Taylor polynomial about a, multiply the coefficient of (x−a)k by k!. If a power up to the polynomial's degree is missing, that derivative at a is 0. In 5−3(x−2)2+4(x−2)3, the x−2 term is missing, so f′(2)=0. That makes x=2 a critical point, and because f′′(2)=−6<0, the graph is concave down and f has a local maximum at 2.
The Lagrange error bound
e0.2−P2(0.2)=3!ec(0.2)3≤3⋅3!(0.2)3
The error from stopping at degree n is the first term left out, with its derivative evaluated at some unknown number c between the center a and x. Because we don't know c, we replace ∣f(n+1)(c)∣ with an upper bound M. So the size of the error is at most M(n+1)!∣x−a∣n+1.
Choosing M
M must be at least as large as the absolute value of the next derivative everywhere between the center a and x. If ∣f(n+1)∣ is decreasing across the interval, its largest value is at the left end. If it's increasing, its largest value is at the right end. Any larger number works for M, so we can round up to a simple value. For sinx and cosx, every derivative has absolute value at most 1, so M=1 always works.
Deciding if an estimate is too high or too low
The sign of the error comes from the first term left out, (n+1)!f(n+1)(c)(x−a)n+1, with c between the center a and x. If that term is negative, then f(x)−Pn(x)<0, so Pn(x)>f(x) and the estimate is an overestimate. If that term is positive, the estimate is an underestimate. For ln0.8 with center 1, the fourth derivative −c46 is negative and (−0.2)4 is positive, so the error is negative. That means P3(0.8)>ln0.8, so the estimate is an overestimate.
Finding the least degree for a target error
To find the least degree that guarantees an error under a given target, test degrees n=1,2,3,… one by one until M(n+1)!∣x−a∣n+1 is less than the target. For ex, every derivative is ex, so the same bound M=3 works for every degree on [0,1]. For lnx, each higher degree brings a new derivative, so find a new M at each step.
8
Practice
Enter exact values unless a problem asks for a decimal.
1
Find the first three nonzero terms of the Taylor polynomial for f(x)=cos2x about x=0.
The chain rule gives (cos2x)′=−2sin2x. What is (cos2x)′′?
If you got 1−2x2+24x4 Check the chain rule. Each derivative brings out a factor of 2, so (cos2x)′′ is −4cos2x, not −cos2x.
If you got 1−4x2+16x4 Remember to divide each derivative by k! to get the coefficient of xk.
Find the derivatives at 0Differentiate cos2x using the chain rule until there are three nonzero values at x=0.
Build the polynomialThe odd-power terms are 0 because their derivatives are 0 at x=0, so we just divide −4 by 2! for the x2 term and 16 by 4! for the x4 term.
1+2!−4x2+4!16x4=1−2x2+32x4
2
A function f has f(2)=3,f′(2)=−2,f′′(2)=5 and f′′′(2)=12. (a) Write the third-degree Taylor polynomial for f about x=2, and use it to approximate f(2.2). (b) Given that ∣f(4)(x)∣≤9 for 2≤x≤2.2, find a bound on the error of the approximation in (a).
If you got 2.896 Check the coefficients in the polynomial. Remember to divide f′′(2) by 2! and f′′′(2) by 3!.
For a degree-3 polynomial, what power of (x−2) and which factorial appear in the first term left out?
If you got 0.0024 Check the factorial in the error bound. For a third-degree polynomial, the first term left out uses 4!, not 3!.If you got 0.003 Check the power of (x−2) in the error bound. For a third-degree polynomial, the first term left out has power 4, not 3.
Build the polynomialThe center is 2, so the terms are powers of x−2, with each derivative at 2 divided by k!.
Bound the errorThe polynomial has degree 3, so the first term left out uses the fourth derivative and 4!.
f(2.2)−P3(2.2)≤9⋅4!(0.2)4=249⋅0.0016=0.0006
3
P3(x)=1+6(x+1)2−5(x+1)3 is the third-degree Taylor polynomial for f about x=−1. (a) Does f have a local maximum, a local minimum, or neither at x=−1? (b) Write the second-degree Taylor polynomial for f′ about x=−1, and use it to estimate f′(−0.9).
What value of x makes x+1=0, and what are f′(−1) and f′′(−1)?
The derivatives of f′ are f′′ and f′′′. What are their values at −1?
If you got 0.575 Check how you read derivatives from the coefficients. The coefficient of (x+1)k is k!f(k)(−1), so multiply each coefficient by k!.
If you got 12(x−1)−15(x−1)2 Check the center. The polynomial uses powers of x+1, which is 0 at x=−1, not x=1.
Find the center and derivativesThe terms use powers of x+1, so the center is −1, and we multiply each coefficient by k! to get f(k)(−1).
x+1=0→x=−1
f′(−1)f′′(−1)f′′′(−1)=0=2!⋅6=12=3!⋅(−5)=−30
Apply the Second Derivative TestSince f′(−1)=0 and the second derivative is positive, f has a local minimum at −1.
f′(−1)=0,f′′(−1)=12>0
Build the polynomial for f′We can build the polynomial from the derivatives of f′, or differentiate P3(x) directly.
Use the second-degree Taylor polynomial for ex about x=0 to estimate e−0.3. (a) Find a Lagrange error bound for this estimate. (b) Is the estimate greater than or less than e−0.3?
The function et is increasing on [−0.3,0]. At which point is it largest?
If you got 0.0033 Check where et is largest on [−0.3,0]. Because et is increasing, its maximum is at t=0, where e0=1.
In the exact error 3!ec(−0.3)3, is (−0.3)3 positive or negative?
If you got less than e−0.3 Check the sign of e−0.3−P2(−0.3). The factor (−0.3)3 is negative, so the true value minus the estimate is negative.
Plug x=−0.3 into the second-degree polynomial 1+x+2x2.
P2(−0.3)=1−0.3+2(−0.3)2=1−0.3+0.045=0.745
Bound the errorOn [−0.3,0], the third derivative et is increasing, so its maximum is at t=0, where e0=1.
f′′′(t)=et≤e0=1 on [−0.3,0],M=1
e−0.3−P2(−0.3)≤1⋅3!(0.3)3=60.027=0.0045
Find the sign of the errorIn the expression for the error, ec is positive and (−0.3)3 is negative, so the true value minus the estimate is negative.
e−0.3−P2(−0.3)=3!ec(−0.3)3<0c between −0.3 and 0
0.745>e−0.3
Comparing with the true value e−0.3≈0.74082 shows the actual error is about 0.0042, which is less than the bound 0.0045.
e−0.3≈0.74082,0.745−0.74082≈0.0042≤0.0045
5
A function f has f(2)=3,f′(2)=−2 and f′′(2)=5. Let g(x)=∫2xf(t)dt. Write the third-degree Taylor polynomial for g about x=2.
What is g′(x), and what is g(2)=∫22f(t)dt?
If you got 3+3(x−2)−(x−2)2+65(x−2)3 Check the value of g(2). The integral from 2 to 2 is 0, so the constant term is 0, not f(2).
If you got g′(2)=−2 Check which derivative is which. g′(x)=f(x), so g′(2)=f(2)=3, not f′(2).
Find the derivatives of g at 2Differentiating g(x)=∫2xf(t)dt gives g′(x)=f(x), so each derivative of g is the derivative of f one order lower.
g′(x)g′′(x)g′′′(x)=f(x)=f′(x)=f′′(x)
g(2)g′(2)g′′(2)g′′′(2)=∫22f(t)dt=0=3=−2=5
Plug these values into the Taylor formula about 2.