<<

MATH 231E LECTURE 1B: INTRODUCTION TO TAYLOR AND TAYLOR

Motivating Problem. Find a practical method for calculating ex, sin(x),... Often you have an accuracy in mind (e.g “to five decimal places”). Taylor polynomials and give you a way to estimate the value of a f near a real a, if you know the of f at a. Let f be a function, and let a be a . Let n ≥ 0 be an integer. Definition 1. The degree n (or nth order) Taylor to f at a is f (2)(a) f (3)(a) f (n)(a) T (x) = f(a) + f 0(a)(x − a) + (x − a)2 + (x − a)3 + ··· + (x − a)n. n 2! 3! n! Example 2. 0 T1(x) = f(a) + f (a)(x − a) is called the ‘ to f at a’. In the following picture, the blue curve is the graph y = f(x). The red line is the line at (a, f(a)). It has f 0(a), so in point-slope form its is y − f(a) = f 0(a)(x − a) which you could also write y = f(a) + f 0(a)(x − a).

That’s T1. It is also called the ‘first-order’ or the ‘degree one’ Taylor polynomial approxima- tion.

f a

H L

a

Date: August 2009; revised August 2012. 1 Here are some important properties of Tn.

a) Tn is a polynomial of degree at most n [usually the degree is n, but it is less than n if f (n)(a) happens to equal 0] (k) (k) b) Tn (a) = f (a) if k ≤ n [so Tn has the same derivatives as f at x = a, up to order n] (k) c) Tn (a) = 0 if k > n [taking more than n derivatives gives zero, because Tn has degree at most n] Sometimes we will be interested in displaying only some of the terms in an approximation, but keeping track of the terms which are not shown. We will use . In order to explain this notation we need to recall some basic facts about the behavior of functions. Example 3. When x is close to 0, ..., x4 is much smaller than x3, x3 is much smaller than x2, x2 is much smaller than x = x1, x is much smaller than 1 = x0. Similarly, for any real number a, when x is close to a, ...,(x − a)4 is much smaller than (x − a)3, (x − a)3 is much smaller than (x − a)2, (x − a)2 is much smaller than x − a, x − a is much smaller than 1.

We will write O((x − a)k) to refer to any terms in a Taylor polynomial or Taylor series at a which involve (x − a)k, (x − a)k+1,(x − a)k+2, and so on. Notice that all of these terms are much smaller than (x − a)k−1, provided that x is very close to a. Let’s illustrate with some examples. Example 4. What is the degree 2 Taylor polynomial of the expression x2 1 + x + + O(x3)? 2 x2 Answer: The degree 2 Taylor polynomial is 1 + x + 2 . Example 5. What is the degree 1 Taylor polynomial of the expression x2 1 + x + + O(x3)? 2 Answer: The degree 1 Taylor polynomial is 1 + x. Example 6. What is the degree 3 Taylor polynomial of the expression x2 1 + x + + O(x3)? 2 Answer: It’s impossible to say. The term O(x3) in this expression represents any sum of terms involving x3, x4, x5, or higher powers of x. We cannot identify the coefficient of x3.

We use this notation to check property (c) of Taylor polynomials on page 2. First, compute f 00(a) f (3)(a) T 0 (x) = f 0(a) + 2(x − a) + 3(x − a)2 + O((x − a)3). n 2! 3! Substituting x = a into this formula shows that 0 0 Tn(a) = f (a), since all of the terms x − a,(x − a)2, O((x − a)3) are equal to zero when x = a. For the second , we find f (3)(a) T 00(x) = f 00(a) + 3 · 2(x − a) + O((x − a)2). n 3! This time, substituting x = a gives 00 00 Tn (a) = f (a). Question 7. What happens at the next stage. . . ? Example 8. f(x) = ex, a = 0. Here’s a table of derivatives of ex at 0 : k f (k)(x) f (k)(0) 0 ex 1 1 ex 1 2 ex 1 3 ex 1 n ex 1 So 1 1 1 T (x) = 1 + 1(x − 0) + (x − 0)2 + (x − 0)3 + ··· + (x − 0)n n 2! 3! n! x2 x3 xn = 1 + x + + + ··· + . 2! 3! n! Example 9. f(x) = sin(x), a = 0, n = 5. Here’s a table of derivatives of sin(x) at 0 : k f (k)(x) f (k)(0) 0 sin x 0 1 cos x 1 2 − sin x 0 3 − cos x −1 4 sin x 0 5 cos x 1 (there’s a pattern: every fourth line is the same). For example, 1 1 x3 x5 T (x) = 0 + x + 0 − x3 + 0 + x5 = x − + . 5 3! 5! 3! 5! Notice there are only odd powers of x : T5 is odd, just like the function. Remark 10. In the previous example, when f(x) = sin(x), we have

T2(x) = 0 + x + 0 = x. We say that “sin x equals x to degree 2, or second order”. Similarly, 1 1 T (x) = 0 + x + 0 − x3 = x − x3. 3 3! 6 1 3 We say that “sin x equals x − 6 x to degree 3, or third order”. Example 11. f(x) = cos x, a = 0, n = 6. k f (k)(x) f (k)(0) 0 cos x 1 1 − sin x 0 2 − cos x −1 3 sin x 0 4 cos x 1 5 − sin x 0 6 − cos x −1 Again, every fourth line is the same. We have 1 1 1 T (x) = 1 − x2 + x4 − x6. 6 2! 4! 6! Remark 12. As in the previous remark, this time we say that “cos x = 1 − x2/2 to third 2 order”, since T3(x) = 1 − x /2. Example 13. f(x) = 1/x = x−1, a = 1, n = 4. This time we cannot use a = 0. (Why not?!) Here’s a table of derivatives of 1/x at 1 : k f (k)(x) f (k)(1) 0 x−1 1 1 −x−2 −1 2 2x−3 2 3 −3!x−4 −3! 4 4!x−5 4! We have 2 3! 4! T (x) = 1 − 1(x − 1) + (x − 1)2 − (x − 1)3 + (x − 1)4 4 2! 3! 4! = 1 − (x − 1) + (x − 1)2 − (x − 1)3 + (x − 1)4. Series. For many functions f, and many choices of a and x, it turns out that Tn(x) −→ f(x) as n −→ ∞. Then we say the “Taylor series converges to f(x)”. Later on we will learn how mathematicians make sense of the notion of convergence for many different kinds of objects, including series with infinitely many terms. For now, we will write such Taylor series using big O notation. Here are some examples: x2 x3 x2 xn ex = 1 + x + + + O(x4) = 1 + x + + ··· + + O(xn+1) 2! 3! 2! n! x3 x5 x3 x5 x2k+1 sin x = x − + + O(x7) = x − + − · · · + (−1)k + O(x2k+3) 3! 5! 3! 5! (2k + 1)! x2 x4 x2 x4 x2k cos x = 1 − + + O(x6) = 1 − + − · · · + (−1)k + O(x2k+2) 2! 4! 2! 4! (2k)! 1 = 1 − (x − 1) + (x − 1)2 − (x − 1)3 + O((x − 1)4) x = 1 − (x − 1) + (x − 1)2 − (x − 1)3 + ··· + (−1)n(x − 1)n + O((x − 1)n+1)

The last series for 1/x obviously cannot be valid at x = 0. It is also false at x = 2. (Try it!) In fact, the for 1/x given above is only valid for 0 < x < 2.

Things you can do with series.

1. Numerical approximation. Use a degree two (also called “second order” or “quadratic”) Taylor polynomial to estimate cos(0.1). We’ll use a = 0 since this is near to x = 0.1 and we know the Taylor polynomial for cosine when a = 0. We find (0.1)2 cos(0.1) ≈ 1 − = 1 − 0.005 = 0.995. 2 Computed with a calculator to six places after the decimal point, we have cos(0.1) = 0.995004 ...

2. Graphical approximation. Here are some illustrative graphs of polynomial to sin x at a = 0. (You might want to try the same thing yourself, with the cosine function, or with ex, or your favorite function.)

T1(x) = x 1 T (x) = x − x3 3 3! 1 1 T (x) = x − x3 + x5 5 3! 5! 1 1 1 T (x) = x − x3 + x5 − x7 7 3! 5! 7! This is the linear approximation, T1. The graph of sin is blue, the linear approximation is red. Graphically, sin x ' T1(x) = x when x is near a = 0 (say, when |x| . π/6).

1

-2 Π -Π Π 2 Π

-1

This is the third order approximation, T3. Again the graph of sin is blue, the approximation 3 is red. Graphically, sin x ' T3(x) = x − x /3! when x is near a = 0 (say, when |x| . π/3).

1

-2 Π -Π Π 2 Π

-1 Fifth order.

1

-2 Π -Π Π 2 Π

-1

Seventh order.

1

-2 Π -Π Π 2 Π

-1 Just for fun, here’s the 13th order approximation. The red plot is the approximation. Notice that we finally have 5 roots, but after that the approximation blows up.

1

-2 Π -Π Π 2 Π

-1

What you cannot do with Taylor series. The trigonometric meaning of sine and cosine is hidden by the Taylor series. For example, putting x = π/2 into the series for cos x must give cos π/2 = 0, but one cannot see that result just from looking at the series!

Exercise. Find the quadratic (second order) Taylor polynomial approximation to f(x) = sin x about the point π a = . 4