Taylor’s Polynomials & LaGrange Error Review QuickTime™ and a decompressor are needed to see this picture. Maclaurin Series: (generated by f at x0 ) f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! If we want to center the series (and it’s graph) at some point other than zero, we get the Taylor Series: Taylor Series: (generated by f at xa ) f a f a 2 3 P x f a f a x a x a x a 2! 3! x 2 x 4 x 6 x8 x10 P x 1 2! 4! 6! 8! 10! y cos x 1 -5 -4 -3 -2 -1 0 1 2 3 4 5 -1 The more terms we add, the better our approximation. Hint: On the TI-89, the factorial symbol is: example: y cos 2 x Rather than start from scratch, we can use the function that we already know: 2x 2x 2x 2x 2x P x 1 2! 4! 6! 8! 10! 2 4 6 8 10 When referring to Taylor polynomials, we can talk about number of terms, order or degree. x2 x4 cos x 1 2! 4! This is a polynomial in 3 terms. It is a 4th order Taylor polynomial, because it was found using the 4th derivative. It is also a 4th degree polynomial, because x is raised to the 4th power. x2 The 3rd order polynomial for cos x is 1 , but it is 2! degree 2. x3 term dropsrequired out when the to third derivative. AThe recent AP exam theusing student know the difference order degree. Thisbetween is also the 2ndand order polynomial. There are some Maclaurin series that occur often enough that they should be memorized. They are on your formula sheet, but today we are going to look at where they come from. Maclaurin Series: (generated by f at x0 ) f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 1 1 1 x 1 x f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! f n x 1 x 1 1 x 2 2 1 x 3 6 1 x 4 24 1 x 5 List the function and its derivatives. f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 1 1 1 x 1 x f n x 1 x 1 1 x 2 2 1 x 3 6 1 x 4 24 1 x 5 f n 0 List the function Evaluate and column its one 1 derivatives. 1 for x = 0. 2 2 3! 3 4! 4 1 1x x x x 1 x 2! 3! 4! 1 2 6 3! 24 4! 1 1 x x 2 x3 x 4 1 x This is a geometric series with a = 1 and r = x. 1 We could generate this same series for with 1 x polynomial long division: 1 x x x 2 1 x 3 1 1 x x 2 xx 2 x x 2 x3 3 x f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 1 1 1 x 1 x f n 0 f n x 1 x 1 1 x 2 1 x 2 3 1 1 2 6 1 x 6 3! 4 24 1 x 5 24 4! 1 2 2 3! 3 4! 4 1 1x x x x 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. We wouldn’t expect to use the previous two series to evaluate the functions, since we can evaluate the functions directly. They do help to explain where the formula for the sum of an infinite geometric comes from. We will find other uses for these series, as well. A more impressive use of Taylor series is to evaluate transcendental functions. f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! cos x f n x f n 0 cos x 1 sin x 0 cos x 1 sin x 0 cos x 1 1 2 0 3 1 4 cos x 1 0 x x x x 2! 3! 4! x2 x4 x6 cos x 1 2! 4! 6! Both sides are even functions. Cos (0) = 1 for both sides. f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! sin x f n x f n 0 sin x 0 cos x 1 sin x 0 cos x 1 sin x 0 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! Both sides are odd functions. Sin (0) = 0 for both sides. 1 1 x2 If we start with this function: and substitute x 2 for x 1 1 x x 2 x3 x 4 1 x 1 2 4 6 8 1 x x x x , we get: 1 x 2 This is a geometric series with a = 1 and r = -x2. If we integrate both sides: 1 2 4 6 8 dx 1 x x x x dx 1 x2 x3 x5 x 7 tan x x 3 5 7 1 This looks the same as the series for sin (x), but without the factorials. f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! 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 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 2 6 3! e f 0 2 f 0 3 P x f 0 f 0 x x x 2! 3! x f n x f n 0 ex 1 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 p Finding Truncation Error in a Taylor Polynomial Graph the function y1 = ln (1 + x) and it’s corresponding Taylor Polynomial x2 x3 x4 x5 y2 = x + + 2 3 4 5 Finding Truncation Error in a Taylor Polynomial Graph the function y1 = ln (1 + x) and it’s corresponding 2 3 4 5 Taylor Polynomial y 2 = x - x + x - x - x 2 3 4 5 Finding Truncation Error in a Taylor Polynomial To find the error between the functions, graph y3 = abs (y2 – y1). Finding Truncation Error in a Taylor Polynomial To find the error between the functions, graph y3 = abs (y2 – y1). Where is the error the smallest? Use Table to see where truncation error is least on (-1,1) Finding Error in a Taylor Polynomial Graph the function y1 = sin x and it’s corresponding Taylor Polynomial y = x - x6 and find the interval in which the 3 2 Taylor polynomial is accurate to the thousandths place. Finding Error in a Taylor Polynomial The third order Taylor Polynomial for y = sin x is accurate to the thousandths place on the interval (-.65, .65). Graph y3 = abs (y1(x) – y2(x)), and y4 = .001. Taylor series are used to estimate the value of functions (at least theoretically - now days 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. For a geometric series, this is easy: ex. 2: 1 1,1 . Use 1 x x x to approximate 2 over 1 x 2 4 6 Since the truncated part of the series is: x8 x10 x12 , x8 the truncation error is x x x , which is . 2 1 x 8 10 12 When you “truncate” a number, you drop off the end. Of course this is also trivial, because we have a formula that allows us to calculate the sum of a geometric series directly. 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. 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. Note that this looks just like the next term in the series, but “a” has been replaced by the number “c” in f n 1 c . This seems kind of vague, since we don’t know the value of c, but we can sometimes find a maximum value for f n 1 c . Lagrange Form of the Remainder Rn x c x a n1 n 1! f n 1 If M is the maximum value of between a and x, then: Taylor’s Inequality M n 1 Rn x xa n 1! f n 1 x on the interval Note this is not This is that called Taylor’s the formula that is in Inequality. our book. It is from another textbook. ex. 2: Prove that k 0 1 k x 2 k 1 2k 1! , which is the Taylor series for sin x, converges for all real x. Since the maximum value of sin x or any of it’s derivatives is 1, for all real x, M = 1. Rn x 1 n 1! x0 n 1 Taylor’s Inequality M n 1 Rn x xa n 1! n 1 x n 1! n 1 x lim 0 n n 1! so the series converges. ex. 5: x2 Find the Lagrange Error Bound when x is used 2 to approximate ln 1 x and x 0.1 . f x ln 1 x f x 1 x 1 f x 1 x 2 f x 2 1 x 3 x2 f x 0 x R2 x 2 2 On the interval .1,.1 , 1 x 3 decreases, so its maximum value occurs at the left end-point. M 2 1 .13 2 3 2.74348422497 .9 f 0 f 0 2 f x f 0 x x R2 x 1 2! Remainder after 2nd order term ex. 5: 2 x Find the Lagrange Error Bound when x is used to 2 approximate ln 1 x and x 0.1 . Taylor’s Inequality M n 1 Rn x xa n 1! 2 On the interval .1,.1 , 1 x 3 decreases, so its maximum value occurs at the left end-point. 2.7435 .1 Rn x 3! 3 Rn x 0.000457 Lagrange Error Bound M 2 1 .13 2 3 2.74348422497 .9 x2 x error 2 Error is x ln 1 x .1 .0953102 .1 .1053605 .105 .095 .000310 .000361 less than error bound. Example using Taylor’s Theorem with Remainder For approximately what values of x can you replace sin x by 3 x with an error magnitude no greater than 1 x 10-3 ? x3! Since f 5 c = cos c 1, then 5 R 4 (x) x 5! x x 5 1 x 10 - 3 .12 .65 Taylor’s Theorem with Remainder Taylor’s Theorem with Remainder works well with the functions y = sin x and y = cos x because |f (n+1)(c)| ≤ 1. lim R n (x) = f c x n + 1! n+1 n n 1 n 1 x lim 0 n (n 1)! Note: Factorial growth in the denominator is larger than the exponential growth in the numerator. 100n 100 Ex : lim = n n+1 ! 1 100 2 100 ... 3 100 100 100 101 ... 100 ... 7 10 Since | Rn(x)| 0 then the Taylor Series converges as n →