Math 473: Practice Problems for Test 1, Fall 011, SOLUTIONS Show your work: 1. (a) Compute the Taylor polynomials P n (x) for f(x) = sin x and x 0 = 0. Solution: Compute f(x) = sin x, f (x) = cos x, f (x) = sin x, f (x) = cos x, f (4) (x) = sin x, and then the pattern repeats. So the derivative f (n) (x) depends only on the value of n%4 (the remainder of n divided by 4 in Java notation). So we have n%4 f (n) (x) f (n) (0) 0 sin x 0 1 cos x 1 sin x 0 3 cos x 1 Assuming n is odd, the n th Taylor polynomial P n (x) is given by P n (x) = f(0) + f (0)x + f (0)! = 0 + x + 0 + ( 1) x3 3! + = x x3 3! + ± xn n! x + f (0) 3! x 3 + + f (n) (0) x n n! (If n is even, the last term is ± xn 1 (n 1)!.) (b) Show that the remainder term R n (x) = f(x) P n (x) satisfies R n (x) x n+1 Solution: The remainder term is given by R n (x) = f (n+1) (ξ(x)) x n+1, (n + 1)! where ξ(x) is between 0 and x. But by the formulas above for the derivatives of sin x, we know f (n+1) (ξ(x)) 1 always. This clearly implies R n (x) = f (n+1) (ξ(x)) x n+1 (n + 1)! x n+1
(c) Find the smallest value of n so that P n (0.) approximates sin(0.) with error less than 10 6. Show your work. Solution: We want to ensure R n (0.) 10 6. Part (b) above shows R n (0.) 0.n+1 Compute for the first few values of n: n 0. n+1 (n+1)! 1 0.0 0.00133333 3 0.00006667 4 0.0000067 5 0.00000009 So we see that for n = 5, R n (0.) 0.00000009 < 10 6. (d) For the value of n from part (c), compute P n (0.) and sin(0.). What is the actual (absolute) error? Solution: For n = 5, P n (x) = x x3 + x5, and 3! 5! P n (0.) = 0. 0.3 6 + 0.5 10 0.198669333 My calculator approximates The actual absolute error is sin(0.) 0.198669331 P 5 (0.) sin(0.) 0.000000003 (This doesn t quite add up because of the calculator s rounding.). Approximate π by /7. What is the absolute error? What is the relative error? Solution: /7 3.14857143, while the absolute error The relative error is /7 π 0.00164489 /7 π π 0.00040449
3. Let f(x) = x 3 x 5, [a, b] = [0, ]. How many iterations of the Bisection Method are required to ensure the approximation p n is within 10 4 of a root? Justify your answer. You do not have to compute the approximation. Solution: Check f(a) = f(0) = 5 < 0 and f(b) = f() = 1 > 0. Since f is continuous, the bisection method will converge to a root p. The absolute error To ensure we may solve for n to find So we must have n 15. p n p b a n = 1 n. p n p = 1 n 10 4, 1 n 10 4, (1 n) log 4 log 10 = 4, 1 n 4 log, n 4 log 1, n 4 log + 1 14.88 4. Will the Bisection Method applied to f(x) = tan x and initial interval [a, b] = [1, ] converge to a root? Why or why not? To which value, if any, will the Bisection Method converge? Solution: tan x has roots only at integer multiples of π, and so there is no root of tan x in [1, ]. So the Bisection Method cannot converge to a root. On the other hand, it is easy to check tan 1 > 0 and tan < 0. Thus we can proceed with the Bisection Method, even though there is no root. The Bisection Method only measures the signs of function values, not whether they are getting closer to zero. This fact will allow us to find lim n p n.
The main fact we use is that tan x > 0 for all x [1, π ), while tan x < 0 for all x ( π, ]. So for the purposes of the Bisection Method, tan x changes its sign only once in [1, ], from positive to negative at x = π. Since the Bisection Method only sees the sign of the function values, it behaves as if the root is at π. (The only case this could possibly mess up is if a p n = π. This is impossible since for a 1 = 1, b 1 =, the p n are all rational numbers (with denominator n in fact), while π is irrational.) So the Bisection Method converges lim n p n = π. 5. If g(x) = cos x x, and [a 1, b 1 ] = [0, 1], use the Bisection Method to compute p 3. Show your work. Solution: Compute So p 3 = 0.375. n a n p n b n f(a n ) f(p n ) f(b n ) 1 0 0.5 1 1 0.14 1.4597 0 0.5 0.5 1 0.46891 0.14 3 0.5 0.375 0.5 0.46891 0.14 6. Consider Newton s Method with p 0 = and k(x) = x 3 6x 1. Compute up to p 4. Is the method converging to a root? Solution: Compute k (x) = 3x 6, and so Compute p n+1 = p n k(p n) k (p n ) = p n p3 n 6p n 1. 3p n 6 n p n f(p n ) f (p n ) 0 5 6 1.833333333 4.74537037 18.08333333.570916539 0.56761184 13.888355 3.59896369 0.01908869 13.011691 4.58918508 The method is converging to a root, since we can inspect p 3 p 4 < 0.001 is quite small. Moreover, the function value f(p 3 ) is also quite close to 0.
7. What happens if we apply Newton s method to h(x) = 1 x and p 0 = 1? What is lim n p n? Why? (Draw a picture at least to explain your answer.) Solution: In this case, we have h (x) = 1 x, and p n+1 = p n h(p n) h (p n ) = p n 1 p n 1 p n = p n + p n = p n. For p 0 = 1, we get p n = n. So p n as n. This limit can also be intuited from the fact that the graph y = h(x) has the x-axis as a horizontal asymptote. 8. (Bonus): We consider Newton s Method on a polynomial f(x) of degree. Find coefficients of the polynomial so that f(0) =, for p 0 = 0, then p 1 = and p is undefined. Solution: Set f(x) = ax + bx + c. We re asked to find a, b, c. Since f(0) =, this implies a 0 + b 0 + c = and thus c =. Moreover, = p 1 = p 0 f(p 0) f (p 0 ) = 0 f (0). We can solve for f (0) to find f (0) = 1. Since f (x) = ax + b, this implies b = 1. Finally, the condition that p = p 1 f(p 1) = f() f (p 1 ) f () only happen when f () = 0. But Solving for a, we find a = 1 4. Altogether, we have 0 = f () = a + b = 4a 1. f(x) = 1 4 x x +. is undefined can