Tangent lines and Taylor polynomials A theme in calculus is that of approximating a nonlinear function by a linear one. Goal =⇒ to approximate the graph of f near a with a line �(x) that has the same value and the same slope as f does at a The tangent line to f at a satisfies these conditions. Using the point-slope form of a line, we can write down an equation for it: y − y0 = m(x − x0 ) �(x) f (a) f � (a) a Thus, the equation for the tangent line �(x) is �(x) = f (a) + f �(a)(x − a). This is a function of x — f (a), f �(a), and a are numbers! Remark For values of x near a, the tangent line approximates the original function. In fact, it is the unique linear function that has the same function value f (a) and derivative f �(a) at the point a, so in this sense, it is the best linear approximation to f at a. Example Find the tangent line to f (x) = We have f �(x) = line is 1 √ , 2 x √ x near a = 100. so f (100) = 10 and f �(100) = �(x) = 10 + Math 30G - Prof. Kindred - Lecture 7 1 20 . Thus, the tangent 1 (x − 100). 20 Page 1 Example Estimate √ 103 (without a calculator). Using our equation for the tangent line from the previous example, we have √ 1 103 = f (103) ≈ �(103) = 10 + (103 − 100) = 10.15 . 20 √ (Note that the actual value is 103 is 10.1489...) Question Can we get a better approximation? Not with a line, but we can do better if we approximate using a quadratic. Consider P2(x) = f (a) + f �(a)(x − a) + C(x − a)2 � �� � � �� � � �� � 2nd-order �(x)=P1 (x) linear approx. quadratic improvement where C is to be determined. We have • P2(a) = f (a) • P2� (a) = f �(a) since P2� (x) = f �(a) + 2C(x − a) • We want P2��(a) = f ��(a), and since P2��(x) = C, we need to set f ��(a) C= . 2 Thus, f ��(a) P2(x) = f (a) + f (a)(x − a) + (x − a)2 2 is the best quadratic approximation to f at a. � Math 30G - Prof. Kindred - Lecture 7 Page 2 Question Then let What about the best cubic approximation to f at a? f ���(a) P3(x) = P2(x) + (x − a)3. � 3! �� � cubic improvement Exercise: check that P3 and f have the same value at a, as well as the same 1st, 2nd, and 3rd derivatives at a. Let’s generalize this to a kth order polynomial. Definition The kth order Taylor polynomial of f (x) at the point a is f ��(a) f (k)(a) 2 Pk (x) = f (a) + f (a) + (x − a) + · · · + (x − a)k . 2! k! This kth degree polynomial has the same value and first k derivatives as f does at x = a. � Example Approximate sin x near x = 0 by a 3rd-order Taylor poly. We have so f (x) = sin x =⇒ f (0) = 0, f �(x) = cos x =⇒ f �(0) = 1, f ��(x) = − sin x =⇒ f ��(0) = 0, f ���(x) = − cos x =⇒ f ���(0) = −1, f ��(0) f ���(0) 2 P3(x) = f (0) + f (0) + (x − 0) + (x − 0)3 2! 3! 1 = 0 + 1 · x + 0 · x2 − · x3 6 � x3 = x− 6 Math 30G - Prof. Kindred - Lecture 7 Page 3 Note that because of the pattern of the derivatives of sin x, we can see that x3 x5 x7 P7(x) = x − + − 3! 5! 7! How good are these approximations? Question How close is Pn(x) to f (x)? Define En(x) = f (x) − Pn(x). (We can think of this as the “error” or “remainder”.) Theorem (Taylor’s theorem). If f (x) is of class C n+1, then for each x, there exists a c ∈ (a, x) such that f (n+1)(c) En(x) = (x − a)n+1. (n + 1)! While this is an exact formula for the error, the value of c is unknown. However, we do know that a < c < x so this helps us bound En(x). 3 Example For sin x near the point 0, we found P3(x) = x − x6 . Using Taylor’s theorem, we have � (4) � � � � f (c) � � � sin c 4� 4� � � |E3(x)| = � (x − 0) � = � x 4! 4! � | sin c| 4 = |x| 24 |x|4 ≤ since | sin c| ≤ 1. 4! Math 30G - Prof. Kindred - Lecture 7 Page 4 Now, let’s check this error bound for the approximation of sin 1. We have 13 sin 1 ≈ 1 − = 0.83 6 and our error bound in this case is |E3(1)| ≤ 1 = 0.0416. 24 We see that our actual error, sin 1 − 0.83 ≈ 0.0081, is less than 0.0416. Math 30G - Prof. Kindred - Lecture 7 Page 5 3rd-order Taylor polynomial for sin(x) at 0