Math 104 Section 101 Notes for 2013/11/19-26

Report 2 Downloads 82 Views
Math 104 Section 101 Notes for 2013/11/19-26

November 26, 2013 Remark 1. These notes cover the material of the classes dedicated to approximation.

1

Linear Approximation

Using derivatives, we can find good approximations for how functions behave near a point √ where it is easy to find their value. For example, suppose we would like to find 101. We know it should be close to 10, but it is a little higher since 101 > 100 and the square root is an increasing function, and the question is how much higher than 10 it is. In cases like this, we can apply the derivative formula in reverse. Since f 0 (a) = lim

x→a

f (x) − f (a) x−a

it follows that when x is “close to” a, we have f 0 (a) ≈

f (x) − f (a) x−a

Now we get rid of the fraction and obtain f (x) − f (a) ≈ f 0 (a)(x − a) and then moving f (a) to the other side, we have f (x) ≈ f (a) + f 0 (a)(x − a) Definition 2. Let f (x) be a differentiable function, and suppose that x − a is small. Given f (a) and f 0 (a), we call f (a) + f 0 (a)(x − a) the linear approximation of f (x). We will postpone the question of how good the approximation after some examples. √ Example 3. √ Let us find an approximate value for 101. We have a = 100, x = √ 101, f (x) = x, f 0 (x) = 1/2 x. So f (a) = 10 and f 0 (a) = 1/20. Therefore, by the linear approximation formula, we have √ 1 1 101 ≈ 10 + (101 − 100) = 10 + = 10.05 20 20 √ Checking this on a calculator gives 101 ≈ 10.04988, a difference of 0.00012. 1

√ Example 4. Let us find an approximate value√for 5 30, using the knowledge that √ 5 32 = 2. We have a = 32, x = 30, f (x) = 5 x, f 0 (x) = 1/5x4/5 . So f (a) = 2 and f 0 (a) = 1/(5 · 324/5 ) = 1/(5 · 16) = 1/80. Therefore we have √ 5

1 1 (30 − 32) = 2 − = 1.975 80 40 √ Checking this on a calculator gives 5 30 ≈ 1.97435, a difference of 0.00065. 30 ≈ 2 +

Example 5. Let us find an approximate value for e0.1 . We know that e0 = 1, so we use a = 0, f (x) = ex , f 0 (x) = ex , and f (a) = f 0 (a) = 1. We use x = 0.1. So e0.1 ≈ 1 + 1 · (0.1 − 0) = 1.1. Checking this on a calculator gives e0.1 ≈ 1.10517, a difference of 0.00517. Observe that this is much larger than the difference observed in the previous two examples, even though here x − a = 0.1 whereas in the previous examples it was 1 and 2. Example 6. Let us find an approximate value for ln 1.2. We know that ln 1 = 0 and if f (x) = ln x then f 0 (x) = 1/x; we have a = 1, x = 1.2, f (a) = 0, f 0 (a) = 1. So ln 1.2 ≈ 0 + 1 · (1.2 − 1) = 0.2. The actual answer, based on a calculator, is ln 1.2 ≈ 0.18232, a difference of 0.01768, again a relatively large difference. Note that in the case of e0.1 , the approximation is an underestimate, whereas in all other cases it is an overestimate. This can be seen to be a matter of concavity. Consult the following graph:

There are tangents at two points. At the point on the left, the curve is concave down, and the tangent is above the graph. At the point on the right, the curve is concave up, and the tangent is below the graph. Just as the process of taking the derivative is analogous to approximating the tangent line by secant lines, so is linear approximation analogous to approximating secant lines with tangent lines. It is generally true, and can be proven, that if f 00 (a) > 0 then near a linear approximation will give underestimates, and if f 00 (a) < 0 then linear approximation will give overestimates. If a is an inflection point, then linear approximation will give underestimates when f is concave up between a and x and overestimates when it is concave down. It remains to be seen how good the approximation is. We have, 2

Proposition 7. Let f (x) be twice differentiable, and let M be the maximum value of |f 00 (x)| for x between c and a. Then |f (c) − (f (a) + f 0 (a)(c − a))| ≤ M

(c − a)2 2

Proof. (For completeness) We will assume that c > a and that f (c) ≥ f (a) + f 0 (a)(c − a); the other cases are similar. We put M = max{f 00 (x) : a ≤ x ≤ c}. We will compare the function f (x) with a quadratic function based on f (a), f 0 (a), and M ; the quadratic function will necessarily have worse approximation. We use, Lemma 8. Let f (x) and g(x) be differentiable, with f (a) = g(a), and f 0 (x) ≤ g 0 (x) whenever a ≤ x ≤ b. Then f (x) ≤ g(x) whenever a ≤ x ≤ b. Proof. The function g(x) − f (x) satisfies g(a) − f (a) = 0 and g 0 (x) − f 0 (x) ≥ 0 when a ≤ x ≤ b. Then g(x) − f (x) is an increasing function when a ≤ x ≤ b, so g(x) − f (x) ≥ 0 when a ≤ x ≤ b, or in other words f (x) ≤ g(x). Note that we can apply the lemma twice: if f (x) and g(x) are twice differentiable, f (a) = g(a) and f 0 (a) = g 0 (a), and f 00 (x) ≤ g 00 (x), then by the lemma f 0 (x) ≤ g 0 (x) and then again f (x) ≤ g(x). So let g(x) = M (x−a)2 /2+f 0 (a)(x− a) + f (a). We have g(a) = f (a) since the terms with x − a vanish; we also have g 0 (x) = M (x − a) + f 0 (a) so g 0 (a) = f 0 (a). Finally, g 00 (x) = M ≥ f 00 (x) for a ≤ x ≤ c by the definition of M . So by applying the lemma twice, we get that g(c) ≥ f (c). Now, f (c) − (f (a) + f 0 (a)(c − a)) ≥ 0 by assumption. In the other direction, f (c) ≤ g(c) = M (c − a)2 /2 + f 0 (a)(c − a) + f (a), so f (c) − (f (a) + f 0 (a)(c − a)) ≤ M (c − a)2 /2 as required. √ Let us return to the four examples above. In the case of 101, we have f 00 (x) = −1/4x3/2 , and this attains its maximum absolute value when x is minimized, i.e. at x = a = 100; we compute M = |f 00 (a)| = 1/(4 · 1003/2 ) = 1/4000. We also have x − a = 1. So the error bound is M (x − a)2 /2 = 1/8000 = 0.000125. This is quite close to the actual error of 0.00012. In the case of ln 1.2, we have f 00 (x) = −1/x2 , and this against attains its maximum absolute value when x is minimized, i.e. at x = a = 1; we compute M = |f 00 (a)| = 1, and then (x − a) = 0.2, so the error bound is 1 · 0.22 /2 = 0.02, which is also fairly close to the actual error of 0.01768. Unfortunately, in the other two cases the maximum absolute value of f 00 is not at a, which means the computations can get more involved. In the case of √ 5 30, we have f 00 (x) = −4/25x9/5 , whose maximum absolute value is when x is minimized, √ i.e. x = 30. Instead of trying to compute exact answers, we can guess that 5 30 > 1.9 at least (on a calculator, 1.95 = 24.76099 < 30), and set M < 4/25 · 1.99 ≈ 4/25 · 322 < 1/2000. Now (x − a)2 /2 = 22 /2 = 2, so the error term is at most 2/2000 = 0.001. To simplify the computations as well as further improve the bounds, we can use higher derivatives. 3

2

Polynomial Approximation

√ Let us keep with the example of 5 30. If we erroneously try to compute f 00 (32) as our M , even though |f 00 (30)| > |f 00 (32)|, we obtain f 00 (32) = −4/25 · 329/5 = −4/25 · 512 = −1/3200. So if we try to use it to obtain a bound, we get (32 − 30)2 /2 · 3200 = 1/1600 = 0.000625, versus an √ actual error of 0.00065. This is very close, just like in the cases of ln 1.2 and 101 the actual error is barely less than the largest allowable error. This suggests that we can obtain even better approximations if we allow terms based on the second derivative. Definition 9. Suppose f (x) is twice differentiable, and x − a is small. We call f (a) + f 0 (a)(x − a) + f 00 (a)(x − a)2 /2 the quadratic approximation of f (x). √ Example 10. The quadratic approximation of 5 30 is 2 − 1/40 − 1/1600 = √ 1.974375. To the same six-digit precision, 5 30 evaluates to 1.97435, a difference of 0.000025. Example 11. Let us compute an approximate value for cos 0.1. We use a = 0 and f (x) = cos x. We have f 0 (x) = − sin x; since f 0 (a) = − sin 0 = 0, the linear approximation would just be f (a) = cos 0 = 1. Using quadratic approximation we can resolve this to greater precision, using f 00 (x) = − cos x, with f 00 (a) = − cos 0 = −1. So cos 0.1 ≈ cos 0 + (− sin 0)(0.1) + (− cos 0)(0.1)2 /2 = 1 + 0 − 1 · 0.01/2 = 0.995. The actual answer, to seven decimal digits, is 0.9950042. Example 12. Let us compute an approximate value for e0.1 that is better than that we can obtain by linear approximation. All derivatives of ex are ex , and at a = 0 they all evaluate to e0 = 1. By the quadratic approximation formula, we have e0.1 ≈ 1 + 1 · 0.1 + 1 · 0.12 /2 = 1.105. Recall that the approximate value to five decimal digits is 1.10517, improving our error to just 0.00017. Just as the linear approximation error term depends on the second derivative, the error term for quadratic approximation depends on the third derivative. We can imitate the proof of the proposition in the previous section to show that the error term is at most M (x − a)3 /3!, where M is now the maximum of the third derivative between a and x. Assuming quadratic approximation is an underestimate and x > a, this follows from the inequality, using the lemma, f (x) ≤ g(x) with g(x) = M (x − a)3 /3! + f 00 (a)(x − a)2 /2 + f 0 (a)(x − a) + f (a). Note that g 0 (x) = M (x−a)2 /2+f 00 (a)(x−a)+f 0 (a), so g 00 (x) = M (x−a)+f 00 (a), so g 000 (x) = M , as required. Remark 13. Linear approximation is an overestimate when f 00 < 0 between x and a and an underestimate when f 00 > 0 between x and a. With quadratic approximation we also need to worry about whether x > a or the reverse, essentially since the error term M (x − a)3 /3! is negative when x < a. If x > a then quadratic approximate is an overestimate when f 000 < 0 and an underestimate < a then the reverse is true. In the above examples, the when f 000 > 0; if x √ third derivative of 5 x is 36/125x14/5 > 0, so we have an overestimate since x = 30 < 32 = a; the third derivative of cos x is (− cos x)0 = sin x, and between 0 and 0.1 this is positive, so we have an underestimate; and the third derivative of ex is ex , which is always positive, so since 0.1 > 0 we get an underestimate. 4

Example 14. Let us compute an error bound for the quadratic approximation of cos x. We need a bound on f 000 (x) = sin x when 0 < x < 0.1. In this case, 0.1 is a suitable bound: the √ cos x is an underestimate, √ quadratic approximation for and so using sin x = 1 − cos2 x we get sin x ≤ 1 − 0.09952 < 0.1. So we use M = 0.1 and (x − a) = 0.1 to obtain that the error bound is at most 0.1 · 0.13 /3! = 1/60000. This rounds to 0.0000167, four times the actual error. The reason for the discrepancy is that f 000 (x) isn’t near 0.1 on the entire interval, but only near the endpoint x = 0.1, while at the other endpoint it is zero, which reduces the error. Remark 15. If f 00 (a) = 0, then the linear and the quadratic approximation are the same. All this means is that the error term will come from the error term of quadratic approximation, which for small x − a is much smaller than the error term of linear approximation. Example 16. Let us approximate sin 0.2 and find the error term. We use a = 0, f (x) = sin x, and x = 0.2. We have f 0 (x) = cos x, f 00 (x) = − sin x, and f 000 (x) = − cos x. Note that f 00 (0) = 0, so the linear and quadratic approximations are the same: sin 0.2 ≈ 0 + (cos 0)(0.2 − 0) = 0.2. The error term has M = 1, since | − cos x| ≤ 1 for all x and − cos 0 = −1. So the error term is 1 · 0.23 /6 = 1/750. In fact sin 0.2 ≈ 0.19866933, and the error term is 0.0133067 to seven decimal digits; this is about 1/751.5, very close to 1/750. We can naturally extend quadratic approximation to cubic approximation, and higher-order approximation. Definition 17. Suppose f (x) is n times differentiable. We call f (a) + f 0 (a)(x − a) + f 00 (a)

(x − a)n (x − a)2 + . . . + f (n) (a) 2 n!

the nth-degree polynomial approximation of f (x). Proposition 18. Suppose f (x) is n + 1 times differentiable. The error term in nth degree polynomial approximation of f (c) is at most M (c − a)n+1 /(n + 1)! where M is the maximum of |f (n+1) (x)| for x between a and c. If n is odd or c > a then the approximation is an underestimate if f (n+1) (x) > 0 between a and c and an overestimate if f (n+1) (x) < 0; if n is even and c < a then the reverse is true. Remark 19. If f (x) is infinitely differentiable, we can write it as an infinite series f (a) + f 0 (a)(x − a) + . . . + f (n) (a)

(x − a)n + ... n!

and for many functions, including nearly all ones we have seen that aren’t defined piecewise, it will approximate the function well as long as the infinite series is well-defined. This is called a Taylor series (sometimes a Maclaurin series if a = 0). This will prove important in second-semester calculus. For our purposes, we sometimes steal the terminology and refer to nth-degree polynomial approximation as the nth Taylor polynomial.

5