2.5 Taylor Series, Intro • In basically every scientic eld, we need to approximate things. • Taylor Series are the most basic and one of the most useful ways of approximating functions. They give 'the best' polynomial approximation to a function at a given point. • The Taylor series to f (x) at x=a ∞ X is the series f (n) (a) · n=0 [The 0th derivative is just ◦ ◦ The series looks like The k th P∞ n=0 ∗ f where f (n) is the nth derivative of f. f .] (x − a)2 (x − a)3 + f 000 (a) · + ···. 2 6 x = a is the series up to the k th power in other words, Tk (x) = f (a) + f 0 (a) · (x − a) + f 00 (a) · Taylor polynomial for (n) (x − a)n , n! f (x) at (x − a)n (a) · . n! You might recognize the formula for the tangent line to y = f (x) at x = a as being the linear (degree-1) Taylor polynomial. • Example: The Taylor series to n, ex since f (x) = ex at x=0 1+x+ x3 x4 x2 + + + ··· 2! 3! 4! , since x− x3 x5 x7 + − + ··· 3! 5! 7! . f (n) (x) = ex for all is nice. • Example: The Taylor series to f (x) = sin(x) • Example: The Taylor series to f (x) = cos(x) Example: The Taylor series to f (x) = 1 1−x x=0 at at is x=0 at can be obtained by dierentiating the series for • is sin(x) x=0 1− is x4 x6 x2 + − + ··· 2! 4! 6! . Observe that this series term-by-term. is 1 + x + x2 + x3 + · · · , as can be seen by dierenti- ating, or by recognizing the geometric series formula. ◦ • NOTE: You should memorize (or be able to rederive on the spot) these four Taylor series. Example: The Taylor series to 6 it is just • x4 − 8 f (x) = x3 sin(x) at is just x3 times the series for sin(x). In other words, 10 x x x + − + ··· 3! 5! 7! ex sin(x) at x = 0is obtained by using the distributive out the se law3to multiply 2 3 4 5 7 x x x x x x x ries for e with the series for sin(x). Explicitly: 1+x+ + + + ··· · x − + − + −··· 2! 3! 4! 3! 5! 7! 2 2 3 2 x x x x x5 can be written as 1+x+ + ··· ·x+ 1 + x + + ··· · − + 1+x+ + ··· · +···, 2! 2! 3! 2! 5! x3 x3 x4 x5 x5 x6 x7 which is in turn x + x2 + + ··· + − − − + ··· + + + + · · · + · · · . Com2! 3! 3! 2! · 3! 5! 5! 2! · 5! Example: The Taylor series to bining terms of the same degree yields the series • x=0 Example: The Taylor series to cos(x). x + x2 + x3 x5 − + ··· 3 30 . sin(2x) = 2 sin(x) cos(x) can be obtained by multiplying the series for sin(x) and But far better is just to plug 2x into the series for sin(x) to get 2x − (2x)3 (2x)5 (2x)7 + − + ··· 3! 5! 7! . 2.6 • Taylor Series, Error Estimation One question, which we skip over in this class, is when an innite Taylor series actually converges to the original function. Sometimes the Taylor series converges to the function for all values of ◦ Sometimes the Taylor series converges to the function for some but not all values of 1 , 1−x ◦ if x like for x like for f (x) = |x| < 1. Sometimes the Taylor series almost never converges to the function like for has all terms in its Taylor series equal to zero at • f (x) = ex . ◦ f (x) = e−1/x , which actually x = 0. But we do like using nite Taylor series i.e., Taylor polynomials to approximate functions, and we have a theorem on how good the approximation is. • Theorem (Taylor's Remainder Theorem): If value b, we have in the interval ◦ • |Tk (b) − f (b)| ≤ M · Tk (x) is the Taylor polynomial for k+1 |b − a| (k + 1)! , where M is a constant such f (x) at x = a, then for any (k+1) that f (x) ≤ M for all x [a, b]. The proof of the theorem is essentially repeated integration of the Mean Value Theorem. Note that Taylor series can give us another way to evaluate certain series if we recognize that some series is actually a Taylor series evaluated at some point, we might be able to gure out what function it's the Taylor series to, and thus determine the value of the series. We can use this theorem to approximate numbers to fairly good accuracy, as in these examples. • Example: Approximating ◦ ln(2). ln(1 + x) at x = 0 is x − We can compute that the Taylor series for dierentiation. ◦ We can also see that the ◦ Therefore, for maximum (k + 1)st derivative of ln(1 + x) by repeated (−1) · (−2) · · · (−k) · (1 + k)−(k+1) . f (x) = ln(1 + x), a = 0, and b = 1, we see that on [0, 1] the function f (k+1) (x) takes its absolute value at x = 0, where it is equal to |(−1) · (−2) · · · (−k)| = k! So we can take M = k! to see that |Tk (1) − ln(2)| ≤ k! · ◦ is x2 x3 x4 x5 + − + −···, 2 3 4 5 So what this means is, if we take the sum 1− 1k+1 1 = (k + 1)! k+1 1 1 1 1 1 (−1)k + − + − + ··· + , 2 3 4 5 6 k it is within 1 k+1 of ln(2). ◦ For example, if we take ln(2) = 0.6931, ◦ k = 99, our result says that 1− 1 1 1 1 + − +···− = 0.6982 2 3 4 99 is within 0.01 of which indeed it is. [Of course, I needed a computer to nd this.] Note that the Alternating Series Test would have given us this same error bound, but it wouldn't have told us what the limit of this series actually was. ◦ Also note that the above application of the Remainder Theorem proves that ∞ X (−1)k k=1 it says that the • k th partial sum is within Example: Approximating √ 1.01 1 k+1 of ln(2). to six decimal places by hand. k = ln(2) , since