Main content

## Integral Calculus

### Course: Integral Calculus > Unit 5

Lesson 12: Lagrange error bound# Worked example: estimating eˣ using Lagrange error bound

AP.CALC:

LIM‑8 (EU)

, LIM‑8.C (LO)

, LIM‑8.C.1 (EK)

Lagrange error bound (also called Taylor remainder theorem) can help us determine the degree of Taylor/Maclaurin polynomial to use to approximate a function to a given error bound. See how it's done when approximating eˣ at x=1.45.

## Want to join the conversation?

- At2:15, we say M = e^2. I have no idea how we determined this. Is it just experience? I understand the interval 0 < x <= 2 contains x & C, but why not 1 < x <= 10? What is the logic behind e^2?(50 votes)
- If you use the larger interval, then your max on the interval is at e^10. That's a larger number than e^2, and thus, a worse bound. We choose [0,2] because it has the least upper bound we can get that has all the necessary values in the interval.(29 votes)

- At2:21, why is zero part of the bound; can't it be 1.45?(25 votes)
- I believe the bound could be 1.45 <= x <= 2. I'm not really sure why he chose to write 0 at the lower end of this bound. It doesn't really matter since e^x is increasing over this entire domain. We are concerned with finding the largest M that is within our bound, so that is going to be e^2 regardless of whether we choose the lower end of the bound to be 0 or 1.45.(9 votes)

- Is there another way to find the nth term necessary to have an error below a certain value (as in without using trial and error) ?(8 votes)
- If we do many problems in estimations, we will find the right numbers faster.

There is a swedish word for this, 'ögonmått', which translates to eye measurement.

If we practice many times on the similar problems, we will do it with ease.

The bulletproof way of estimating the nth term of the Lagrange error is to rewrite e^x with sigma notation.

This sigma notation comes from the elementary Maclaurin expansion of e*x:

e^x=1+x+x^2/2+x^3/3!+...+[[[x^n/n!]]]+O(x^(n+1)

The next last part x^n/n! is the important bit here, because it will determine the Lagrange error.

So we can rewrite the Lagrange error for e^2 as following:

e^x= Σ(x^n/n!) from n=0 to infinity, so e^2=Σ(2^n/n!) from n=0 to N.

With this method you can see what the value of N should be to see if the error will be smaller than 10^-3.

When you got your N, use N terms in the Maclaurin expansion of e^x to get your estimate!

This is the general way of finding estimates for e^x that I was taught.

If we want to use other elementary functions like cosine, logarithms, polynomials or arcus we can use their Maclaurin expansions to find the Lagrange error instead.

I hope this was a little helpful!(6 votes)

- Why didn't Sal take out his trusty Ti-85?(11 votes)
- I found this video helpful but I am still confused about natural log Lagrange error bounds. Could you please do a video featuring a natural log problem? The hints often show an additional step at the end, removing the z^(n+1) from the equation, since the equation without z is greater. My answers using z seem like they would be more accurate? (but are showing as wrong due to the final step removing z inexplicably for the hint's calculations).(8 votes)
- I used to struggle with the same problem, here's how you could tackle it.

You are given the expression for the n-th derivative of the natural log function at the very beginning of the exercise, use this information to find the (n+1)th derivative of natural log of x (simply substitute n+1 for every n in the expression).

Recall from the lesson "Taylor polynomial reminder" that this expression gives you M, the upper bound of the error function. (https://www.khanacademy.org/math/ap-calculus-bc/bc-series-new/bc-10-12/v/proof-bounding-the-error-or-remainder-of-a-taylor-polynomial-approximation)

M is the**maximum**value of the (n+1)th derivative over the interval of interest: it's a function of n and has z as a parameter. Since M is the maximum you want to**make it as big as possible**, and since z can take any value between 1 and 1.6 you pick one: being z in the denominator you want it as small as possible.

This seemed counter intuitive to me, if M is the the upper bound for the error function i should make it as small as possible, shouldn't I?

Well, for the Lagrange inequality to be valid in the first place, you need to have the maximum possible value of M.

Hope this helps.(2 votes)

- What does the error .001 really mean. Is it the physical difference between the b and a in the Tailor series or is it the area of the difference between the curves at a and b.(6 votes)
- It is the maximum difference between the curves at b. In other words, if you want to use a Taylor polynomial, p(x), centered at a to approximate a function, f(x), then you would need to know f(a) and f'(a) and f''(a) and so on. The real value of this is that you can use p(x) to get approximate values for f(b). But these will be approximate. The maximum error - which is the difference between f(b) and p(b) - is 0.001 (in this case since you can set the maximum error to any number necessary based on your application).(2 votes)

- Hi, I got stuck on the practice problem estimating ln(1.6), I used the hints, and followed the remainder down to:

Rn(1.6) </= 0.6^(n+1)/((n+1)*z^(n+1))

... I used z = 1.6, was I supposed to use 1 because the P(x) is centered at x=1 in this case? or are we supposed to choose z = the lowest x value on the interval of approximation?

Cheers, K(4 votes)- Hey Keiran Lond,

Here's the steps to using Langrage's Error Bound;

1. Find an expression for the (n + 1)th derivatie of f(x) (or whatever the function is).

2. Find the maximum value for the (n+1)th derivative of f(z) for any z between x and c.

3. Lagrange Bound for Error assures that;`| M |`

|Rn,c(x)| <= |*_________** (x - c)^(n + 1)|

| (n+1)! |

3. Where M is the maximum value of the (n+1)th derivative of f(z) for any z between x and c. "c" is where the series is centered at (0 if Macluarin Series) and x is the plugged in value were's approximating.

4. Plug in M, x, and c for that equation, and simplify.

5. Find the lowest number of terms (n) that evaluates the expression to less than the error bound.

NOTE: The z is the value which returns the greatest value M, in the interval of the respective function.

Hope this helps,

- Convenient Colleague

Also, I think that the variables used in the different functions are sometimes changed or swapped, which can get confusing. If you can follow along my examples it should work fine (at least it does for me!).(6 votes)

- What's the point of finding the Maclaurin series error if we end up using the function itself evaluated at x=2, i.e: e^2. If we end up needing to use that, we might as well plug in e^1.45 in a calculator so we don't need to deal with the error.(5 votes)
- My first instinct was to say that while it's not too hard to quite accurately find the value of e^2 by hand (just do 2.71828^2) I have no idea how you'd do e^1.45, you'd probably have to do something like (e^(1/20))^29 which is... a little time consuming lol

Great question btw!(2 votes)

- So for this question it was really convenient that the derivative of e^x is just e^x, so when you find the M value, all you have to do was input the c value into the nth derivative, which would always be e^x. But when working with something not as convenient, like ln(x), can you do the same thing, but instead of inputting the c value into ln(x) you use the nth derivative of ln(x)?(4 votes)
- At1:42, Sal finds the n+1th derivative of e^x, which is e^x. But what if it wasn't something like e^x? What if we had ln(x) where we didn't know what the maximum value of the n+1th derivative was? How would we do a problem like that?(2 votes)
- The ln's (n+1)th derivative equals; (-1)^(n) * n!/z^(n+1)

Then, depending on how many terms we use we can solve for the z which gives us the greatest value between c <= z <= x.

Hope this helps,

- Convenient Colleague(1 vote)

## Video transcript

- [Instructor] Estimating
e to the 1.45 using a Taylor polynomial about x equals two, 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 wanna 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, and it tells us that the
absolute value of the remainder for the nth degree Taylor polynomial, it's gonna be less than this
business right over here. Now, n is the degree of our polynomial that 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, our M is an upper
bound on the absolute value of the n plus oneth
derivative of our function. And 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 of 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 while the first derivative of this is going to be e to the x, the second derivative
is gonna be e to the x, the nth derivative is gonna be e to the x, the n plus oneth derivative
is gonna be e to the x. So the n plus oneth
derivative of f is gonna be, is gonna be e to the x which is convenient. These types of problems
are very, very hard if it's difficult to bound
the n plus oneth derivative. Well this we know, we know that e the x, we know that e the x, and I can even say the absolute value of this,
but this is gonna be positive, is going to be less than or equal to, let's say this is gonna be
less than or equal to e squared for zero is less than x is less than or equal to two. e the x isn't bounded over the entire, for over its entire domain. If x goes 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 two. So we know we're bounded by e squared, so we can say, we can
use e squared as our M. We can use e squared as our M. We're able to establish this bound. And so doing that, we can now go straight to LaGrange error bound. We can say, we can say that the remainder of our nth degree Taylor polynomial, we wanna solve for n. We wanna 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, our M is e squared, e squared over, over n plus one factorial times 1.45, that's our x that we care about, that's where we're calculating the error, we're trying to bound the error, minus where we're centered, minus two to the n plus oneth power. Now 1.45 minus two, that is negative 0.55. So let me just write that. So this is, this is negative 0.55 to the n plus oneth power. And we wanna figure out for
what n is all of this business, is all of this business
gonna be less than 0.001. Well let's do a little bit of
algebraic manipulation here. This term is positive,
this is gonna be positive. This right over here, or this part of it, it's not an independent term, but the e to the squared
is gonna be positive, n plus one factorial is gonna be positive, the negative 0.55 to some power, that's gonna flip between
being positive or negative. But since we're taking the absolute value, we could write it this way. We could write e squared, e squared, since we're taking
the absolute value times 0.55 to the n plus one over
n plus one factorial has to be less than, has
to be less than 0.001. Or, since we want to solve for n, let's divide both sides by e squared. So we could write, we could write, let's find the n where 0.55 to the n plus oneth power over n plus one factorial is less than, is less than 0.001 over e squared. Now to play with this, we're
gonna have to use a calculator. From this point we're just
gonna try larger and larger ns until we get an n that makes this true. And we wanna find the smallest possible n that makes this true. But let's get out our calculators
so that we can actually, so that we can actually do this. So, first I'm just gonna figure out what is 1/1000 divided by e squared. So make sure it's cleared out. So let's take e squared, I'm gonna take its reciprocal, and then I'm gonna
multiply that times 1/1000. So times .001 is equal to, so it's about, so I'll say, so it's three zeroes, this is a 10/1000, and then three five. So it's three zeroes, so
I'll say one three six. So this needs to be less than
zero point one two three, then I'll say one three six. If I can find an n that is less than this, then I'm in, then I am in good shape. Actually let me say this. Less than one three five, I
wanna be less than that value, then I can be, then I
will be in good shape. This is a little bit
more than one three five, 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 to the n plus one over n plus one factorial. So let's try out some ns. And I'm gonna have to
get my calculator out. So, let's see, did I do that right? Yeah, .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 two. I can start at n equals one,
n equals two, n equals three, but if n equals two is good enough, then I might try n equals one. But if n equals two isn't good enough, then I'm gonna go to n equals
three or n equals four. So let's start with, actually let's just start
with n equals three. So if n equals three, it's gonna
be 0.55 to the fourth power divided by four factorial. So let's use that, let's do that. So 0.55 to the fourth power is equal to that divided by four factorial. So divided by four factorial is 24. So that's nowhere near low enough. So let's try n equals four. If n equals four, then it's
gonna be this to the fifth power divided by five factorial. So 0.55 to the fifth power is equal to, and then divided by five factorial is, five factorial is 120. Divided by 120 is equal to that. We're almost there with n equals four. I'm guessing that n equals
five will do the trick. So for n equals five,
let's clear this out. So for n equals five, we're
gonna raise to the sixth power and divide by six factorial. And so let's just remind ourselves what six factorial is, 720. In fact, I could've done that in my head. But anyway. All right, so let's see. We're gonna go 0.55 to
the, remember, n is five, so we're gonna raise to the sixth power, to the sixth power, and then we're gonna divide by 720, divided by 720 is equal to, and this number for sure is less than this number right over here. We've got four zeroes before
this three after the decimal, here we only have three. So when n equals five, it got
us sufficiently low enough, this remainder is going
to be sufficiently low, it's gonna be less than
this value right over here. So, what is the least
degree of the polynomial that assures an error smaller than 1/1000? The answer is five, our n, if n is five, we're definitely gonna be under this.