Current time:0:00Total duration:8:47

# Worked example: estimating sin(0.4) using Lagrange error bound

## Video transcript

- [Instructor] Estimating sine of 0.4 using a Maclaurin polynominal,
what is the least degree of the polynominal 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 Maclaurin polynomial, in fact, we could talk more generally about a Taylor polynominal,
but let's just say this is an nth degree
Maclaurin polynomial, but this isn't going to be
a perfect approximation, there's going to be some
error or some remainder. And so we could call this the remainder of that nth degree Maclaurin 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 sine of 0.4 this is going to be
equal to our Maclaurin, our nth degree Maclaurin
polynomial evaluated at 0.4 plus whatever the remainder is for that nth degree Maclaurin
polynomial evaluated at 0.4, and 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, what is the smallest n such that the remainder of our nth degree Maclaurin
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. And the way that we
can do it is we can use something called the Lagrange error round and we have other videos that prove it, this is often also called
Taylor's Remainder Theorem. And 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 Legrange error bound tells us that if the n plus oneth
derivative of our function, so f, so this is our n
plus oneth derivative of our function, if the
absolute value of that is less than or equal to some M for an open interval, open interval, containing where our polynomial is centered, in this case it's zero, we're
gonna use the Maclaurin case, so it's containing zero, and the x, or zero and x, the x that we care about in this particular video is 0.4, but I'll say generally for any x, so if this is true, if our
n plus oneth 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, and this is the Legrange, 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 plus oneth derivative, 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 plus one, over n plus one 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 of x, so let's say, for this particular
f of x right over here, we could say that the absolute value of the n plus oneth
derivative, evaluated 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, that sine and its
derivatives are all bounded, or their absolute values
are bounded by one. And so them we have our M and we can apply the Legrange error bound, so we can say that the remainder of our nth
degree Maclaurin 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, is going to be less than or equal to, our M is one, so I won't
even write that down, our x is 0.4, 0.4 to the n plus one, to the n plus one, over
n plus one factorial. And we're taking the absolute
value of this whole thing. This is Legrange 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 ns and keep increasing until this thing actually
becomes smaller than that thing. So let's do it, all right,
I'm gonna set up a table here. So let me do it relatively cleanly. So let's do, this is going to be our n, and then this is going to be, this is going to be 0.4 to the n plus one, over n plus one factorial, so let's try it when n is equal to one. Well then this is going
to be 0.4 to the two, so it's 0.4 squared over two factorial, this is 0.16 over two, which is equal to 0.08, that's definitely not less than one thousandth here. So let's try n equals
two, when n equals two, it's gonna be 0.4 to the third power, over three factorial, and that's equal to, what is that, zero point, I'm gonna need three
digits behind the decimal, 0.064 over six, well,
this is a little bit more than 0.01, so our n
isn't large enough yet. So let's try three, so
this is going to be 0.04 to the three plus one,
so that's going to be to the fourth power, over four factorial, and let's see, that is
going to be equal to, this is going to be, let's
see, we're gonna have four digits behind the decimal, so 0.0256 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 four is gonna do the trick,
but let's verify that. So this is going to be
0.04, or 0.4, I should say, to the fifth power, over five factorial, and what is this equal to? Let's see, four to the fifth is 1024, I'm gonna have five
numbers behind the decimal and I'm gonna 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
Maclaurin polynomial, evaluated at x equals 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 one thousandth.