9.7 and 9.10 Taylor Polynomials and Taylor Series Suppose we wanted to find a fourth degree polynomial of the form: P x a0 a1 x a2 x2 a3 x3 a4 x 4 that approximates the behavior of f x ln x 1 at x 0 If we make f (0) = P(0), f’(0) = P’(0), f’’(0) = P’’(0), and so on, then we would have a pretty good approximation. P x a0 a1 x a2 x2 a3 x3 a4 x 4 f x ln x 1 f x ln x 1 P x a0 a1 x a2 x2 a3 x3 a4 x 4 f 0 ln 1 0 P 0 a0 P x a1 2a2 x 3a3 x2 4a4 x3 1 f x 1 x 1 f 0 1 1 f x a0 0 P 0 a1 1 1 x 1 f 0 1 1 2 a1 1 P x 2a2 6a3 x 12a4 x2 P 0 2a2 1 a2 2 f x 2 P x 6a3 24a4 x 1 1 x 3 P 0 6a3 f 0 2 f 4 f x 6 4 1 1 x 0 6 4 P P 4 4 2 a3 6 x 24a4 0 24a4 6 a4 24 1 2 2 3 6 4 P x 0 1x x x x 2 6 24 This is called the Taylor Polynomial of degree 4. x 2 x3 x 4 P x 0 x ln x 1 2 3 4 If we plot both functions, we see that near zero the functions match very well! 5 4 3 2 0.5 f x 1 -5 -4 -3 -2 -1 0 -1 1 1 2 3 4 5 -1 -2 -0.5 0 0.5 -0.5 -3 -4 P x -5 Our polynomial has the form: or: 0 1x -1 1 2 2 3 6 4 x x x 2 6 24 f 0 2 f 0 3 f 4 0 4 f 0 f 0 x x x x 2 6 24 f 0 f 0 f 0 2 f 0 3 f 4 0 4 x x x x 0! 1! 2! 3! 4! 1 Theorem n a ( x c ) If f (x) is represented by a power series n n 0 f ( n ) (c ) for all x in an open interval I containing c, then an n! Definition f ( n ) (c ) n ( x c ) The series of the form n ! n 0 f c f c f c 2 3 f c x c x c x c 1! 2! 3! is called the Taylor Series for f (x) at c. If c = 0, then the series is called the Maclaurin series for f . Example Find the Maclaurin series for f x cos x f x sin x f ( x) cos x f 0 1 f x sin x f 0 0 f 0 0 f f x cos x f 0 1 4 4 x cos x f 0 1 1 -5 -4 1 2 0 3 1 4 cos x 1 0 x x x x 2! 3! 4! x 2 x 4 x 6 x8 x10 cos x 1 2! 4! 6! 8! 10! -3 -2 -1 0 -1 1 2 3 4 5 Example Find the Maclaurin series for f ( x) cos 2 x Rather than start from scratch, we can use the function that we already know: x 2 x 4 x 6 x8 x10 cos x 1 2! 4! 6! 8! 10! cos 2 x 1 2x 2! 2 2x 4! 4 2x 6! 6 2x 8 8! 2x 10 10! Example Find the Taylor series for y cos x at x 2 f x cos x f x sin x f 1 2 f 0 2 f x sin x f 1 2 f 4 f x cos x f 0 2 x cos x f 4 0 1 P x 0 1 x x x 2 2! 2 3! 2 2 3 3 5 x x 2 2 P x x 2 3! 5! 0 2 Example Find the Maclaurin series for f n x f n 0 sin x 0 cos x 1 sin x 0 cos x 1 sin x 0 f ( x) sin x 0 2 1 3 0 4 sin x 0 1x x x x 2! 3! 4! x3 x5 x 7 sin x x 3! 5! 7! Example 1 f ( x ) Find the Maclaurin series for 1 x f n 0 f n x 1 x 1 1 x 2 2 1 x 3 6 1 x 4 24 1 x 5 1 1 2 6 3! 24 4! f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 1 2 3! 4! 1 1x x 2 x 3 x 4 1 x 2! 3! 4! 1 1 x x 2 x3 x 4 1 x This is a geometric series with a = 1 and r = x. Example Find the Maclaurin series for f ( x) ln 1 x f n x f n 0 ln 1 x 0 1 x 1 1 1 x 2 1 x 2 3 6 1 x 4 1 2 6 3! f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 1 2 2 3 3! 4 ln 1 x 0 1x x x x 2! 3! 4! x 2 x3 x 4 ln 1 x x 2 3 4 Example Find the Maclaurin series for f n x f n 0 ex 1 f ( x) e x f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 1 2 1 3 1 4 e 1 1x x x x 2! 3! 4! x ex 1 ex 1 ex 1 ex 1 x 2 x3 x 4 e 1 x 2! 3! 4! x Euler’s Formula An amazing use for infinite series: 2 3 4 x x x e x 1 x 2! 3! 4! Substitute xi for x. xi 2 xi 3 xi 4 xi 5 xi 6 e 1 xi 2! 3! 4! 5! 6! xi x 2i 2 x3i 3 x 4i 4 x5i 5 x 6i 6 e 1 xi 2! 3! 4! 5! 6! xi x 2 x3i x 4 x5i x 6 e 1 xi Factor out the i terms. 2! 3! 4! 5! 6! xi 2 4 6 x x x x3 x5 xi e 1 i x 2! 4! 6! 3! 5! 2 4 6 x x x x3 x5 xi e 1 i x 2! 4! 6! 3! 5! This is the series for cosine. e xi cos x i sin x This is the series for sine. Let x ei cos i sin ei 1 i 0 i e 1 0 This amazing identity contains the five most famous numbers in mathematics, and shows that they are interrelated. Taylor series are used to estimate the value of functions (at least theoretically - nowadays we can usually use the calculator or computer to calculate directly.) An estimate is only useful if we have an idea of how accurate the estimate is. When we use part of a Taylor series to estimate the value of a function, the end of the series that we do not use is called the remainder. If we know the size of the remainder, then we know how close our estimate is. 1 2 4 6 Ex: Use 1 x x x to approximate over 1,1 . 1 x2 8 x the truncation error is x8 x10 x12 , which is . 2 1 x When you “truncate” a number, you drop off the end. Taylor’s Theorem with Remainder If f has derivatives of all orders in an open interval I containing a, then for each positive integer n and for each x in I: f a f n a 2 f x f a f a x a x a x a n Rn x 2! n! Lagrange Form of the Remainder Rn x c x a n1 n 1! f n 1 Remainder after partial sum Sn where c is between a and x. This is also called the remainder of order n or the error term. Lagrange Form of the Remainder Note that this looks just Rn x like the next term in the c x a n1 n 1! f n 1 series, but “a” has been replaced by the number “c” in f If M is the maximum value of between a and x, then: f n 1 x n 1 c . on the interval Taylor’s Inequality M n 1 Rn x xa n 1! This is called Taylor’s Inequality. x2 Find the Lagrange Error Bound when x is used 2 to approximate ln 1 x and x 0.1 . x2 f x 0 x R2 x 2 f x ln 1 x 1 f x 1 x f x 1 x 2 f x 2 1 x 3 2 On the interval .1,.1 , 1 x 3 decreases, so its maximum value occurs at the left end-point. M Remainder after 2nd order term 2 1 .13 2 2.74348422497 .9 3 f 0 f 0 2 f x f 0 x x R2 x 1 2! x ln 1 x 2.7435 .1 3 Rn x 3! 0.000457 Lagrange Error Bound x2 x 2 error .095 .000310 .1 .0953102 .1 .1053605 .105 .000361