If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

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

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 the sine function.

Want to join the conversation?

  • mr pink red style avatar for user Leonard
    The MacLaurin expansion of sin(x) is x - x^3/3! + x^5/5! - x^7/7! + x^9/9! ...

    The polynomial of degree 4 is actually identical to the the polynomial of degree 3 because the coefficient of x^4 is 0. Shouldn't the answer to the exercise be 3 instead of 4?
    (37 votes)
    Default Khan Academy avatar avatar for user
    • primosaur ultimate style avatar for user linkesy34
      While what you said is technically true, what Sal is doing in the is using the error function to evaluate the absolute maximum error bound of the function. You are not supposed to know before hand that the coefficient fourth degree polynomial is 0, the error function is basically just telling you to what degree polynomial you need to take Maclaurin polynomial to be completely sure that the error is within certain bounds. It is always gonna be an overestimate since it is taking the absolute maximum that the error could be, not what actually is.
      (31 votes)
  • mr pants teal style avatar for user yash.kick
    I agree with Sal that no matter how many times we take the derivative of sin, it's absolute value will always be between 0 and 1 and so the value of "M" will be 1 but isn't Sal ignoring the fact that we have to only consider an open interval containing 0 and 0.4, in that case if the n+1'th derivative of sinx is (+or-)sinx again depending on value of 'n' then if we look in the interval of 0 and 0.4 then the absolute value of sinx will not lie between 0 and 1 but it will lie between 0 and sin(0.4)..........

    So isn't something WRONG here??
    (25 votes)
    Default Khan Academy avatar avatar for user
    • leafers sapling style avatar for user Sri Dhar
      SIn(0.4 ) = 0.389..(the range of M is from 0 to 0.389) and cos(0.4) = 0.921...(the range is from 1 to 0.921). The (n+1)th derivative of f(x) could be either (+or-)cosx or (+or-)sinx. But we are sure that the value of M is always less than 1.
      *Edit:*
      What we have to take for M is the maximum possible value in the interval (x=0 to x=0.4). But we are not sure if its cosx or sinx in the n+1 th derivative. So we take M=1. It is gonna be less precise if it is sinx and more precise if it is cosx.
      (26 votes)
  • blobby green style avatar for user earl kraft
    We know that sin x is < or = to 1 over the whole domain, but might one find a smaller M for the open interval between -0.0001 and 0.40001? If we use an M larger than necessary, could it cause us to specify a higher degree polynomial than necessary?
    (7 votes)
    Default Khan Academy avatar avatar for user
  • piceratops tree style avatar for user Panyam Nikil
    how do we solve the final inequality Sal arrives at (at ) without trial and error?
    do we just take log on both sides and solve for n?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Mahmood Salah
    In the previous video "Taylor polynomial remainder (part 2)" the right hand side of the remainder equation is without the absolute value, while in @ the right hand side is with the absolute value. Why?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user An Intellectual
    wait so i am confusion
    why is the M equal to one in this particular situation?
    i know that the graph of sine is bounded by 1, so does that make M always equal to 1 in these kind of problems?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Adam Thai
      Because whatever x is, sin(x) and cos(x) is always bounded by 1, yes, it would make M equals 1 in this kind of problems. You might think sin(x) on (0, 0.4) much less than 1 but the derivative of sin(x) is ccos(x) which has quite close value to 1 in the above interval. Whereas this is not really precise, it's good enough
      (4 votes)
  • blobby green style avatar for user bakula.darko4
    In the previous video the remainder theorem formula is shown to have (x-a) and not just x over an interval between a and b. I am assuming it is just x because the interval is between 0 and 0.4, hence, a is 0?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • starky ultimate style avatar for user Michele Franzoni
    I don't fully understand the reasoning behind picking M = 1, even after reading all the other questions and answers about it.

    To find M we need to look for the (n+1)th derivative of the function sin(x) at 0.4. If n is odd then the (n+1)th derivative will be either cos(0.4) or -cos(0.4), which gives +-0.92. If n is odd the (n+1)th derivative is +-sin 0.4, giving 0.39, so the maximum value of M seems to be 0.92. Of course we can choose 1 as a maximum and still have a useful estimate, but it would be a little less precise, and i don't see the reason why i should do so.
    (4 votes)
    Default Khan Academy avatar avatar for user
  • sneak peak blue style avatar for user HazixtheDruid
    Where does the condition that n+1th derivative of f(x) has to be less than or equal to M for an open interval including 0 and x come from? Why won't this work for other intervals?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • sneak peak blue style avatar for user HazixtheDruid
    How can we find the Lagrange error bound over an interval(the minimum degree taylor polynomial for which the error will be less than some value within the interval)?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      Basically it looks at the highest value in that interval and wants to make that highest value less than some determined value, that way all other points in that interval will have even less error. let me know if that doesn't make sense.
      (2 votes)

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.