Worked example: estimating e_ using Lagrange error bound | AP Calculus BC | Khan Academy
Estimating e to the 1.45 using a Taylor polynomial about x equal 2, what is the least degree of the polynomial that assures an error smaller than 0.001?
In general, if you see a situation like this where we're talking about approximating a function with a Taylor polynomial centered about some value and we want to know, well, how many terms do we need? What degree do we need to bound the error? That's a pretty good clue that we're going to be using the Lagrange error bound or Taylor's remainder theorem.
And just as a reminder of that, this is a review of Taylor's remainder theorem. It tells us that the absolute value of the remainder for the nth degree Taylor polynomial is going to be less than this business right over here. Now, n is the degree of our polynomial that we're in question, so that's the n. The x is the x value at which we are calculating that error; in this case, it's going to be this 1.45. And c is where our Taylor polynomial is centered.
But what about our M? Well, M is an upper bound on the absolute value of the (n + 1)th derivative of our function. That might seem like a mouthful, but when we actually work through the details of this example, it'll make it a little bit more concrete.
So for this particular thing we're trying to estimate, we're trying to estimate e to the x. So I could write f of x—let me write this this way—so f(x) is equal to e to the x, and we're trying to estimate f of 1.45.
And let's just, to get the bound here to figure out what M is, let's just remind ourselves that, well, the first derivative of this is going to be e to the x. The second derivative is going to be e to the x. The nth derivative is going to be e to the x. The (n + 1)th derivative is going to be e to the x. So the (n + 1)th derivative of f is going to be e to the x, which is convenient.
These types of problems are very, very hard if it's difficult to bound the (n + 1)th derivative. Well, this we know—we know that e to the x, and I could even say the absolute value of this, but this is going to be positive, is going to be less than or equal to, let's say, this is going to be less than or equal to e^2 for 0 < x ≤ 2. e to the x isn't bounded over the entire domain. For x going to infinity, e to the x will also go to infinity. But here I set up an interval. I've set up an interval that contains the x we care about.
Remember, the x we care about is 1.45, and it also contains where our function is centered. Our function is centered at 2, so we know we're bounded by e^2. So we can say we can use e^2 as our M. We can use e^2 as our M; we were able to establish this bound.
And so, doing that, we can now go straight to the Lagrange error bound. We can say that the remainder of our nth degree Taylor polynomial—we want to solve for n; we want to figure out what n gives us the appropriate bound evaluated at 1.45—when x is 1.45, is going to be less than or equal to the absolute value of our M, which is e^2 over (n + 1)! times (1.45 - 2) raised to the (n + 1) power.
Now, 1.45 - 2, that is -0.55, so let me just write that. So this is 0.55 to the (n + 1) power. And we want to figure out for what n is all of this business going to be less than 0.001? Let's do a little bit of algebraic manipulation here.
This term is positive; this is going to be positive; this right over here, or this part of it, not, it's not an independent term, but this e^2 is going to be positive, and (n + 1)! is going to be positive. The negative (0.55) to some power is going to flip between being positive or negative, but since we're taking the absolute value, we could write it this way.
We could write e^2 since we're taking the absolute value times (0.55) to the (n + 1) over (n + 1)! has to be less than 0.001. Or, since we want to solve for n, let's divide both sides by e^2, so we could write—let's find the n where (0.55)^(n + 1) over (n + 1)! is less than 0.001 over e^2.
Now, to play with this, we're going to have to use a calculator. Remember, we're from this point going to try larger and larger n's until we get an n that makes this true, and we want to find the smallest possible n that makes this true. But let's get out our calculator so that we can actually do this.
So first, I'm just going to figure out what is 0.001 divided by e^2. So make sure it's cleared out. So let's take e^2; I'm going to take its reciprocal and then I'm going to multiply that times 0.001.
So times 0.001 is equal to—so it's about, so I'll say, so it's three zeros, and this is a 10,000th and then 35, so it's three zeros, so I'll say 0.000136. So this needs to be less than 0.000123, and I'll say 0.000136; if I can find an n that is less than this, then I am in good shape.
Actually, let me say it's less than 0.000135. I want to be less than that value, then I can be, then I will be in good shape. This is a little bit more than 0.000135, but if I can find an n where that is less than this, then I'm in good shape.
So let me write this: (0.55)^(n + 1) over (n + 1)! So let's try out some n's, and I'm going to have to get my calculator out. So let's see, did I do that right? Yeah, 0.000135. If we get something below this, then we're in good shape, because this is even less than that.
All right, so let's do it. Let's see what this is equal to when—I don't know—when n is equal to 2. I could start at n equals 1, n equals 2, n equals 3, but the more n the further. If n equals 2 is good enough, then I might try n equal 1, but if n equals 2 isn't good enough, then I'm going to go to n equal 3 or n equal 4.
So let's start with—actually, let's just start with n equals 3. So if n equals 3, it's going to be (0.55)^4 divided by 4!. Let's see that. Let's do that. So (0.55)^4 is equal to—and then divided by 4! So divided by 4! is 24, so that's nowhere near low enough.
So let's try n equal 4. If n equals 4, then it's going to be this to the 5th power divided by 5!. So (0.55)^5 is equal to—and then divided by 5! is 120. Divided by 120 is equal to—that we're almost there with n equals 4. I'm guessing that n equals 5 will do the trick.
So for n equals 5, so let's clear this out. So for n equals 5, we're going to raise to the 6th power and divide by 6!. And so let's just remind ourselves what 6! is—720. I could have actually done that in my head, but anyway.
All right, so let's see—(0.55) to the—remember our n is 5, so we're going to raise to the 6th power—then we're going to divide by 720. Divided by 720 is equal to—and this number for sure is less than this number right over here. We got four zeros before this, three after the decimal; here we only have three.
So when n equals 5, it got us sufficiently low enough. This remainder is going to be sufficiently low; it's going to be less than this value right over here.
So what is the least degree of the polynomial that assures an error smaller than 0.001? The answer is 5. If n is 5, we're definitely going to be under this.