Taylor Series Professor Richard Blecksmith richard@math.niu.edu Dept. of Mathematical Sciences Northern Illinois University http://math.niu.edu/ richard/math230 These notes are taken from Calculus Vol I, by Tom M. Apostol, 1966. 1. Power Series An infinite series of the form a 0 +a 1 (x a)+a 2 (x a) 2 + +a n (x a) n + is called a power series in x a. This series is also written as a n (x a) n Note that the index n starts at 0. Given values of a and the coefficients a n, the question is: For what values of x does this series converge? 2. Interval of Convergence With each power series is associated an interval centered at a, called the interval of convergence such that the series converges absolutely for every x inside this interval, and diverges outside the interval. Sincethecenterofthisintervalisa, theintervalofconvergenceis(a r,a+r) for some number r. 1
2 The number r is called the radius of convergence. It is possible for r to be infinity, in which case the power series converges for all values of x. The behavior of the series at the endpoints a r and a+r of the interval of convergence cannot be predicted in advance. The series f(x) = a n (x a) n 3. Power Series Expansion is said to represent the function f in the interval of convergence and is called the power series expansion of f about a. For many power series that occur in practice, the radius of convergence can be determined by using either the ratio test or the root test. Given power series x n n!. Find the radius r of convergence. Hint: Ratio test 4. Example 1. 5. Example 2. Given power series n 2 3 n x n. Find the radius r of convergence. Hint: Root test What happens at the endpoints of the interval of convergence?
3 6. Example 3. The series x n has radius of convergence 1, by the ratio test. It diverges at both endpoints x = 1 and x = 1, so the interval of convergence is the open interval ( 1,1). 7. Example 4. The series x n /n 2 also has radius of convergence 1 by the ratio test. n=1 It converges at both endpoints x = 1 and x = 1, since the series 1/n 2 converges (by the integral test or else view this as a p-series). Here the interval of convergence is the closed interval [ 1, 1]. Given a function f(x). 8. Taylor polynomial TheTaylorpolynomialofdegreengeneratedbyf(x)isthepolynomialP(x) which satisfies the conditions P(0) = f(0) P (0) = f (0) P (0) = f (0) P (0) = f (0). P (n) (0) = f (n) (0).
4 9. Coefficients of Taylor polynomial Let P(x) = a 0 +a 1 x+a 2 x 2 +a 3 x 3 + +a n x n P(0) = a 0 = f(0) = a 0 = f(0) P (x) = a 1 +2a 2 x+3a 3 x 2 + +na n x n 1 P (0) = a 1 = f (0) = a 1 = f (0) P (x) = 2a 2 +3 2x+ +n(n 1)a n x n 2 P (0) = 2a 2 = f (0) = a 2 = f (0) 2 P (x) = 3 2 1a 3 +4 3 2a 4 x+ +n(n 1)(n 2)a n x n 2 P (0) = 3!a 3 = f (0) = a 3 = f (0) 3! P (4) (0) = 4!a 4 = f (4) (0) = a 4 = f(4) (0) 4!.. P (n) (0) = n!a n = f (n) (0) = a n = f(n) (0) n! 10. Taylor polynomial We denote the Taylor polynomial of degree n by T n (x). The Taylor polynomial T n (x) of degree n which agrees with f(x) and its first n derivatives evaluated at a = 0 is n f (k) (0) T n (x) = x n k! k=0 When k = 0 note that f(0) (0) 0! = f(0). The Taylor polynomial is that one and only polynomial of degree n which satisfies the conditions: T n (0) = f(0) T n(0) = f (0) T n(0) = f (0) T (n) n (0) = f (n) (0)
5 11. General Taylor polynomial In the same way we can show that there is exactly one polynomial T n (x) = T n (x;a) = n a k (x a) n k=0 which agrees with f and its first n derivatives at the point x = a. Each coefficient a k of T n (x) is given by the formula a k = f(k) (a) k! 12. Taylor series If we extend the Taylor polynomial out to infinity we get the Taylor Series for f(x): T(x) = a n (x a) n where each coefficient a n is given by the formula a n = f(n) (a) n! When a = 0 these series are sometimes called Maclaurin series. Note that the nth Taylor polynomial T n (x) is the partial sum of the Taylor Series T(x). 13. Taylor series for e x Let f(x) = e x Since f (n) (x) = e x, f (n) (0) = e 0 = 1. Thus the Taylor Series for e x is
6 1+x+ 1 2 x2 + 1 3! x3 + + 1 n! xn + 14. Taylor series for sin x Let f(x) = sinx. Its derivatives are f (x) = cosx. f (x) = sinx. f (x) = cosx. f (4) (x) = sinx. At this point the derivatives repeat: sinx, cosx, sinx, cosx Evaluating these four functions at 0: f(0) = sin0 = 0 f (0) = cos0 = 1 f (0) = sin0 = 0 f (0) = cos0 = 1 These values repeat: 0, 1, 0, 1 15. Taylor polynomial for sin x The Taylor series for f(x) = sinx is f(0)+ f (0) 1! x+ f (0) 2! x 2 + f (0) 3! x 3 + f(4) (0) 4! x 4 + f(5) (0) 5! x 5 + f(6) (0) 6! x 6 + f(7) (0) 7! x 7 + sinx = 0+ 1 1! x+ 0 2! x2 + 1 3! x3 + 0 4! x4 + 1 5! x5 + 0 6! x6 + 1 7! x7 + Omitting the zero terms sinx = x 1! x3 3! + x5 5! x7 7! + +( 1) n 1 x2n 1 (2n 1)! +
7 16. Taylor polynomial for cos x By a similar method, the Taylor series for f(x) = cosx is cosx = 1 x2 2! + x4 4! x6 6! + +( 1) n x2n (2n)! + 17. The Calculus of Power Series Assume a function f(x) is represented by the power series f(x) = a n (x a) n in an open interval (a r,a+r). Then 1. f(x) is continuous in this interval, 2. the derivative of f(x) inside the interval of convergence may be computed by differentiating the series term by term, and 3. the integral of f(x) over any closed subinterval of (a r,a+r) may be computed by integrating the series term by term. 18. Illustration Here are the Taylor Series for our three favorite functions: e x = 1+ x 1! + x2 2! + x3 3! + x4 4! + + xn n! + sinx = x x3 + x5 x7 n 1 x2n 1 + +( 1) + 1! 3! 5! 7! (2n 1)! cosx = 1 x2 2! + x4 4! x6 6! + +( 1) n x2n (2n)! + Differentiate the Taylor series for e x term by term? What property of e x do you see? Differentiate the Taylor series for sin x term by term? What property of sinx do you see?
8 Differentiate the Taylor series for cos x term by term? What property of cosx do you see? 19. Two Uses of Series There are two important uses of Taylor Series: The first major use is in Computation How do you think the sin, cos, e x button on your calculator work? Do calculators store 8-digit trig tables? I don t think so. Calculators (and computers) perform the basic arithmetics operations: +,,,. SousingaTaylorseriestocalculatef(x)isanobviousmatchofmathematics and technology. Mostcalculatorsdisplay8to10digits, butuse3moreforroundingpurposes. The question is: how many terms do we need to use to obtain the necessary accuracy. 20. C program to compute e x Exp(double x) // compute e^x { double t=1; double s=1; int n; for (n=1;n<=17;n++) { t *= x / (double)n; s += t; printf("%2d. %19.15lf %19.15lf\n", n,t,s); } }
9 21. Computation of e We can use this program to compute e = Exp(1) The values of t are 1/n! for n = 1,2,3,...,17 The sums of the t values are stored in s The known value of e to 75 places is 2.718281828459045235360287471352662497757247093699959574966967627724076630353 The three columns of data represent n t = 1/n! s = 1+ n k=1 t n 22. C program output 1. 1.00000000000000 2.00000000000000 2. 0.50000000000000 2.50000000000000 3. 0.16666666666667 2.66666666666667 4. 0.04166666666667 2.70833333333333 5. 0.00833333333333 2.71666666666667 6. 0.00138888888889 2.71805555555556 7. 0.00019841269841 2.71825396825397 8. 0.00002480158730 2.71827876984127 9. 0.00000275573192 2.71828152557319 10. 0.00000027557319 2.71828180114638 11. 0.00000002505211 2.71828182619849 12. 0.00000000208768 2.71828182828617 13. 0.00000000016059 2.71828182844676 14. 0.00000000001147 2.71828182845823 15. 0.00000000000076 2.71828182845899 16. 0.00000000000005 2.71828182845904 23. Computation of e When we use the power series for e 1 out to degree 16 we get the estimate e 2.71828182845904 How good is this estimate?
10 That is, what is the error in using the 16th Taylor polynomial T 16 (1) to approximate e? Put another way, let E n (x) = e x T n (x) the error in estimating e x with the nth polynomial T n (x). The next theroem tells us an upper bound for E n (x). 24. Error for Taylor series Assume the (n + 1)st derivative of f satisfies the inequalitites f (n+1) (t) M for all t in some interval containing a. Then for every x in this interval we have the following estimate on the error E n (x) in approximating f(x) by the nth Taylor polynomial: E n (x) M x a n+1 (n+1)! 25. Estimating E 16 (1) Let f(x) = e x. Since all derivatives of e x are just e x, the derivative f (n+1) (x) = e x satisfies the inequalities 1 = e 0 f (n+1) (x) e 1 3 on the interval [0,1]. Thus we can take M = 3 in the error estimate. Just put a = 0, x = 1, and M = 3 into the error formula E n (x) M x a n+1 (n+1)! to get E n (1) 3 1 (n+1)!
11 E 16 (1) < 3 17! = 8.43 10 15 So the 16th Taylor polynomial T 16 (1) = 2.71828182845904 appoximates e to 15 digits. 26. Second use of Taylor Series Besides computation, we can use Taylor series to solve integrals. It can be shown that the integral e x2 dx has no solution using a finite number of basic operations, +,,, and compositions involving real numbers, trig functions, exponential and logarithmic functions, and power functions (including roots). But you can integrate e x2 using Taylor series. In fact, it s easy. Start with e x x n = n! Replace x with x 2 e x2 = x 2n n! Now integrate term by term 27. The impossible made easy
12 28. Finding Taylor Series For the functions e x, sinx, and cosx it was easy to find all the derivatives and evaluate them at 0. Sometimes this is not always the case. It is often necessary to use clever manipulations to obtain the Taylor series for stubborn functions. 29. First Tricky Example Find the Taylor series for f(x) = ex +e x. 2 This function is called the hyperbolic cosine and is written f(x) = cosh(x). To find its Taylor series we add the series expansions for e x and e x : e x = 1+ x 1! + x2 2! + x3 3! + x4 xn + + 4! n! + e x = 1 x 1! + x2 2! x3 3! + x4 4! +( 1)nxn n! + So (e x +e x )/2 = 1+ x2 2! + x4 x2n + + 4! 2n! + 30. Second Tricky Example 1+x Find the Taylor series for f(x) = ln 1 x. By rules of logs, f(x) = 1 2 (ln(1+x) ln(1 x)) The Taylor series for ln(1 x) is obtained by integrating the geometric series 1 1 x = x n
13 term by term: x n+1 ln(1 x) = n+1 31. Second Tricky Example Cont d When we replace x by x in 1 1 x = xn, we get 1 1+x = ( 1) n x n Integrating this last series term by term gives ln(1+x) = ( 1) n xn+1 n+1 The rest is easy. 32. Final Tricky (Killer) Example Find the Taylor series expansion of f(x) = sinxcosx If we multiply the series expansions of sinx = x x3 + x5 x7 n 1 x2n 1 + +( 1) + 1! 3! 5! 7! (2n 1)! times cosx = 1 x2 2! + x4 4! x6 6! + +( 1) n x2n (2n)! + we are doing a FOIL calculation where each series has infinitely many terms. Not easy. If we try to find all the derivatives of f(x) we run into problems. Try it.
14 33. Killer Problem Made Easy Find the Taylor series expansion of f(x) = sinxcosx Use the double angle trig identity sin2x = 2cosxsinx or cosxsinx = 1 sin2x 2 Piece of cake. 34. Porky Pig Quotation That s all, folks.