Worked example: estimating sin(0.4) using Lagrange error bound | AP Calculus BC | Khan Academy
Estimating the sign of 0.4 using a McLaurin polynomial, what is the least degree of the polynomial that assures an error smaller than 0.001?
So, what are we talking about here? Well, we could take some function and estimate it with an Nth degree McLaurin polynomial. In fact, we could talk more generally about a Taylor polynomial, but let's just say this is an Nth degree McLaurin polynomial.
But this isn't going to be a perfect approximation; there's going to be some error or some remainder. So, we could call this the remainder of that Nth degree McLaurin polynomial, and it's going to be dependent for any given x.
Now, if we want to use the specifics of this exact problem, we could phrase it this way: we want to say, look, if we're taking the sign of 0.4, this is going to be equal to our McLaurin, our Nth degree McLaurin polynomial evaluated at 0.4 plus whatever the remainder is for that Nth degree McLaurin polynomial evaluated at 0.4.
What we really want to do is figure out for what n, what is the least degree of the polynomial? So, what is—let me do this in a different color—so we want to figure out what is the smallest n such that the remainder of our Nth degree McLaurin polynomial evaluated at 0.4 is less than this number, is less than 0.001.
So, this is just another way of rephrasing the problem. The way that we can do it is we can use something called the Lagrange error bound. We have other videos that prove it; this is often also called Taylor's remainder theorem.
I'll first write it out, and I'll try to explain it while I write it out, but it'll actually become a lot more concrete when we work it out. So, Taylor's remainder theorem tells us, or Lagrange error bound tells us that if we're—that if the n+1th derivative of our function, so F, so this is our n+1th derivative of our function, if the absolute value of that is less than or equal to some M for an open interval containing where our polynomial is centered.
In this case, it's zero. We're going to use the McLaurin case, so it's containing zero, and the x that—or z—and x, the x that we care about in this particular video is 0.4. But I'll say it generally for any x.
So, if this is true, if our n+1th derivative of our function, if the absolute value of it is less than or equal to M over an open interval containing where we're centered—this would be C if we're talking about the general case—and X, so this x right over here, then this is the part that's useful.
We can say that the remainder is bounded; the remainder for that Nth degree polynomial—so this is the n+1th derivative. If that's bounded, then we can say the remainder for the Nth degree polynomial that approximates our function is going to be less than or equal to that M times x to the n+1 or times, yeah, * x to the n+1 over (n+1) factorial.
So, how do we apply that to this particular problem? Well, think about the derivatives of sine. We know that the absolute value of sine is less than or equal to one, its derivative is cosine of x, the absolute value of that is going to be bounded, is going to be less than or equal to one.
So, no matter how many times we take the derivative of sine of x, the absolute value of that derivative is going to be less than or equal to one. So, we could write generally that for this particular f(x), so let's say for this particular f(x) right over here, we could say that the absolute value of f, the absolute value of the n+1th derivative evaluated at any x, is going to be less than or equal to one.
And this is the case for where f is sine, where f is sine of x, and this is actually going to be true over any interval. It doesn't even have to be over some type of a restricted interval where we can do this.
So, we know that this is our M. We know that this is our M, that sine and its derivatives are all bounded by—or their absolute values are bounded by one. And so then we have our M, and we can apply the Lagrange error bound.
So, we can say that the remainder of our Nth degree McLaurin approximation at 0.4—so our x in this particular case is 0.4—we don't have to do it generally for any x here; it's going to be less than or equal to our M, which is one, so I won't even write that down.
Our x is 0.4, so 0.4 to the (n+1) over (n+1) factorial, and we're taking the absolute value of this whole thing. This is Lagrange error bound, and we want to figure out if we can figure out a situation where this is less than 0.001.
Then this for sure is going to be less than 0.001 because the remainder is less than this—or less than or equal to this—which is less than that.
So, how do we do that? How do we figure out the smallest n where this is going to be true? Well, we can just try out some n's and keep increasing until this thing actually becomes smaller than that thing.
So, let's do it! All right, I'm going to set up a table here. So let me make it relatively cleanly. So, let's do this: this is going to be our n, and then this is going to be—this is going to be 0.4 to the (n+1) over (n+1) factorial.
So, let's try it when n is equal to 1. Well, then this is going to be 0.4 to the 2, so it's 0.4 squared over 2 factorial. This is 0.16 over 2, which is equal to 0.08. That's definitely not less than 0.001.
So, let's try n equal 2. When n equal 2, it's going to be 0.4 to the 3rd power over 3 factorial, and that's equal to—what is that? I'm going to need three digits behind the decimal—0.064 over 6. Well, this is a little bit more than 0.01, so this isn't where—n isn't large enough yet.
So let's try 3. This is going to be 0.4 to the (3 + 1), so that's going to be to the 4th power over 4 factorial. And let's see, that is going to be equal to—let's see, we're going to have four digits behind the decimal—so 0.256 over 24. This is—we're almost there. This is a little bit—this is going to be a little bit more than 0.001, so that doesn't do the trick for us.
So, I'm guessing already that n equals 4 is going to do the trick, but let's verify that. So, this is going to be 0.4 to the 5th power over 5 factorial. And what is this equal to? Let's see, 4 to the 5th is 1024, and I'm going to have five numbers behind the decimal, and I'm going to divide it by five factorial, which is 120.
And let's see, this right over here—yes, this for sure is less than 0.001. This is definitely less than a thousandth right over here, so we see that when n is equal to four, so we can say that the remainder for our fourth degree polynomial, fourth degree McLaurin polynomial evaluated at x equal 0.4 is for sure going to be less than 0.001.
So, there you go; that is the least degree of the polynomial that assures an error smaller than 0.001.