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

Taylor & Maclaurin polynomials intro (part 1)

A Taylor series is a clever way to approximate any function as a polynomial with an infinite number of terms. Each term of the Taylor polynomial comes from the function's derivatives at a single point. Created by Sal Khan.

Want to join the conversation?

  • piceratops ultimate style avatar for user thiasJA
    How could we apply this to a real world case?
    (140 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Nicolas Soria
      Have you ever wondered how a calculator is able to give you a value for sine at any value, while you're stuck memorizing just the important ones? You can use this concept to do things like approximate trig functions like sine or cosine for any value. Computers can find the sum for a polynomial series with, say, 1000 terms in a snap and give an accurate approximation of that function. I find Taylor series to be very clever.
      (502 votes)
  • blobby green style avatar for user melcor3
    what dose a 3rd derivative represent? the first derivative is the slope of the tangent line. the second derivative is the degree that the tangent line of one point differs from the tangent line of a point next to it. so is there any basis for having a third derivative other then using it in a Maclauren series?
    (11 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user RagnarG
      The way I think of it is;
      1st derivative: rate of change of the function. (which is equal to the slope in any given point on the graph)
      2nd derivative: rate of change of the 1st derivative. (which, when focused on a specific point, is equal to the changing rate of the slope in that point which is what you said)
      3rd derivative: rate of change of the 2nd derivative (I guess this would be the acceleration of the slope change in a point)
      4th derivative: rate of change of the 3rd derivative (and here I just give up trying to relate the derivatives to the original function)
      5th derivative: you guessed it - rate of change of the 4th derivative.

      And so on... To me it's just one of those things you simply have to accept that you can't rely on your visualisation skills to understand it. Like a 5-dimensional space, try imagining what that looks like. Still, it's not difficult to calculate the distance between two points in it for example, by just accepting the space as "a space where a point requires 5 coordinates to specify it's location".
      (32 votes)
  • blobby green style avatar for user dingo6541
    Why at do we use n! in the denominator instead of just the n. I understood up to the second derivative why we introduce 1/2 but then on the third it I do not understand why we have 1/3! as this is 1/6 and not 1/3 which means that it will not cancel out. I hope you understand my questions.
    Thank you very much for your help :)
    (12 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Sid
      For the second derivative, it's not 1 / 2 it's really 1 / 2!
      It's just that 2! happens to be equal to 2.

      The factorial works well for repeated differentiation:
      d/dx x^5 / 5! = x^4 / 4!
      d/dx x^4 / 4! = x^3 / 3!
      d/dx x^3 / 3! = x^2 / 2!
      d/dx x^2 / 2! = x / 1!
      d/dx x / 1! = 1 / 0!
      d/dx 1 / 0! = 0
      (9 votes)
  • blobby green style avatar for user Joshua Martin
    at about , Sal adds an "x" after f '(0). Why?
    (9 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user owahid2
      It's so p'(0) still equals f'(0) after he takes the derivative of his expression f(0)+f'(0)x. If the x wasn't there, then the f'(0) would end up equaling zero when he took the derivative, just as the f(0) did. Reviewing power rule may be helpful in clarifying this.
      (16 votes)
  • leaf green style avatar for user Kayalvizhi
    what is the difference between a polynomial and a function ? dont we write the function of x as a polynomial?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user thesergcan
      If it is a polynomial, then it is a function. This is not true the other way around (If its a function, then it is a polynomial). However, the distinction Sal is trying to make in this video is that we can approximate a function using a talyor series which looks like a polynomial. The key here is that we can approximate functions such as sin(x) or cos(x), or ln(x). Clearly, these functions are not polynomials, but they can be written as a talyor series which when you "expand it" looks like a polynomial with x raised to some power, thus functions can be approximated to look like polynomial.

      I hope this distinction makes a little more sense.
      (9 votes)
  • blobby green style avatar for user Jenna
    At why is it (1/2) multiplied by (1/3)? According to Sal's logic from before, shouldn't it just have been (1/3)? I know there was an answer to this question later on, but I didn't understand at all from that... ><
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user ArDeeJ
      We want p´´´(c) to be equal to f´´´(c).
      Let's look at that one term.
      p(c) = terms + f´´´(c) * 1/(2*3) * x^3
      Let's look at its first derivative.
      p´(c) = terms + f´´´(c) * 1/(2*3) * 3 * x^2
      p´(c) = terms + f´´´(c) * 1/2 * x^2
      Let's take the second derivative.
      p´´(c) = term + f´´´(c) * 1/2 * 2 * x^1
      p´´(c) = term + f´´´(c) * x
      Then let's take the third derivative.
      p´´´(c) = f´´´(c) * 1 * x^0
      p´´´(c) = f´´´(c)

      You have to have both 1/2 and 1/3 so that the coefficients eventually cancel each other out.
      (9 votes)
  • blobby green style avatar for user phuoc truong huynh
    i can't visualize why when we add new term of new polynomial then the new curve nearer the old curve !
    (3 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      Well, by analogy, think of trying to identify a specific person without saying their name. Instead, you will just be listing off facts about that person. Each fact you list off will eliminate a certain number of persons, until you eventually have enough descriptions that only one human on earth meets all the qualifications.

      Really, that is all we are doing here. We are adding more and more facts about the original function. And, we're doing it in such a way that it does not interfere with previously established facts. While with this method we might need infinitely many facts added together to get a perfect match, very often we are not interested in the entire domain of the function, but just a particular region. Given that, we only need enough facts for the estimate to be pretty good for the region we're interested in.
      (11 votes)
  • mr pink red style avatar for user Enya Hsiao
    I don't really understand the intuition of these series, I mean, the mechanisms seem perfect and comprehensible, but why can we be confident that P(x) which is expanded at the point zero, would fit into all x when n approaches infinity? we are just evaluating it at zero!
    (7 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user John Shahki
    Why are Taylor series so important and how can they help with representing series?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      Amongst other things, they are very good at modeling functions that are exceedingly difficult to work with or calculate. Suppose you were an engineer and you had to add 50 functions that were rather complicated. If it were the case that they all met the conditions for Maclaurin or Taylor, then you might elect to use Maclaurin or Taylor to be able to add them more practically.
      (6 votes)
  • leaf blue style avatar for user Aneirin (Nye) Rhys Potter
    Why is 0! = to 1
    (3 votes)
    Default Khan Academy avatar avatar for user

Video transcript

I've draw an arbitrary function here. And what we're going to try to do is approximate this arbitrary function-- we don't know what it is-- using a polynomial. We'll keep adding terms to that polynomial. But to do this, we're going to assume that we can evaluate the function at 0, that it gives us some value, and that we can keep taking the derivative of the function and evaluating the first, the second, and the third derivative, so on and so forth, at 0 as well. So we're assuming that we know what f of 0 is. We're assuming that we know what f prime of 0 is. We're assuming that we know the second derivative at 0. We're assuming that we know the third derivative at 0. So maybe I'll write it-- third derivative. I'll just write f prime prime at 0, and so forth and so on. So let's think about how we can approximate this using polynomials of ever increasing length. So we could have a polynomial of just one term. And it would just be a constant term. So this would be a polynomial of degree 0. And if we have a constant term, we at least might want to make that constant polynomial-- it really is just a constant function-- equal the function at f of 0. So at first, maybe we just want p of 0, where p is the polynomial that we're going to construct, we want p of 0 to be equal to f of 0. So if we want to do that using a polynomial of only one term, of only one constant term, we can just set p of x is equal to f of 0. So if I were to graph it, it would look like this. It would just be a horizontal line at f of 0. And you could say, Sal, that's a horrible approximation. It only approximates the function at this point. Looks like we got lucky at a couple of other points, but it's really bad everywhere else. And now I would tell you, well, try to do any better using a horizontal line. At least we got it right at f of 0. So this is about as good as we can do with just a constant. And even though-- I just want to remind you-- this might not look like a constant, but we're assuming that given the function, we could evaluate it at 0 and that will just give us a number. So whatever number that was, we would put it right over here. We'd say p of x is equal to that number. It would just be a horizontal line right there at f of 0. But that obviously is not so great. So let's add some more constraints. Beyond the fact that we want p of 0 to be equal to f of 0, let's say that we also want p prime at 0 to be the same thing as f prime at 0. Let me do this in a new color. So we also want, in the new color, we also want-- that's not a new color. We also want p prime. We want the first derivative of our polynomial, when evaluated at 0, to be the same thing as the first derivative of the function when evaluated at 0. And we don't want to lose this right over here. So what if we set p of x as being equal to f of 0? So we're taking our old p of x, but now we're going to add another term so that the derivatives match up. Plus f prime of times x. So let's think about this a little bit. If we use this as our new polynomial, what happens? What is p is 0? p of 0 is going to be equal to-- you're going to have f of 0 plus whatever this f prime of 0 is times 0. If you put a 0 in for x, this term is just going to be 0. So you're going to be left with p of 0 is equal to f of 0. That's cool. That's just as good as our first version. Now what's the derivative over here? So the derivative is p prime of x is equal to-- you take the derivative of this. This is just a constant, so its derivative is 0. The derivative of a coefficient times x is just going to be the coefficient. So it's going to be f prime of 0. So if you evaluate it at 0-- so p prime of 0. Or the derivative of our polynomial evaluated at 0-- I know it's a little weird because we're not using-- we're doing a p prime of x of f of 0 and all of this. But just remember, what's the variable, what's the constant, and hopefully, it'll make sense. So this is just obviously going to be f prime of 0. Its derivative is a constant value. This is a constant value right here. We're assuming that we can take the derivative of our function and evaluate that thing at 0 to give a constant value. So if p prime of x is equal to this constant value, obviously, p prime of x evaluated at 0 is going to be that value. But what's cool about this right here, this polynomial that has a 0 degree term and a first degree term, is now this polynomial is equal to our function at x is equal to 0. And it also has the same first derivative. It also has the same slope at x is equal to 0. So this thing will look, this new polynomial with two terms-- getting a little bit better-- it will look something like that. It will essentially have-- it'll look like a tangent line at f of 0, at x is equal to 0. So we're doing better, but still not a super good approximation. It kind of is going in the same general direction as our function around 0. But maybe we can do better by making sure that they have the same second derivative. And to try to have the same second derivative while still having the same first derivative and the same value at 0, let's try to do something interesting. Let's define p of x. So let's make it clear. This was our first try. This is our second try right over here. And I'm about to embark on our third try. So in our third try, my goal is that the value of my polynomial is the same as the value of the function at 0. They have the same derivative at 0. And they also have the same second derivative at 0. So let's define my polynomial to be equal to-- so I'm going to do the first two terms of these guys right over here. So it's going to be f of 0 plus f prime of 0 times x, so exactly what we did here. But now let me add another term. I'll do the other term in a new color. And I'm going to put a 1/2 out here. And hopefully it might make sense why I'm about to do this. Plus 1/2 times the second derivative of our function evaluated at 0 x squared. And when we evaluate the derivative of this, I think you'll see why this 1/2 is there. Because now let's evaluate this and its derivatives at 0. So if we evaluate p of 0, p of 0 is going to be equal to what? Well, you have this constant term. If you evaluate it at 0, this x and this x squared are both going to be 0. So those terms are going to go away. So p of 0 is still equal to f of 0. If you take the derivative of p of x-- so let me take the derivative right here. I'll do it in yellow. So the derivative of my new p of x is going to be equal to-- so this term is going to go away. It's a constant term. It's going to be equal to f prime of 0. That's the coefficient on this. Plus-- this is the power rule right here-- 2 times 1/2 is just 1, plus f prime prime of 0 times x. Take the 2, multiply it times 1/2, and decrement that 2 right there. I think you now have a sense of why we put the 1/2 there. It's making it so that we don't end up with the 2 coefficient out front. Now what is p prime of 0? So let me write it right here. p prime of 0 is what? Well, this term right here is just going to be 0, so you're left with this constant value right over here. So it's going to be f prime of 0. So so far, our third generation polynomial has all the properties of the first two. And let's see how it does on its third derivative, or I should say the second derivative. So p prime prime of x is equal to-- this is a constant, so its derivative is 0. So you just take the coefficient on the second term is equal to f prime prime of 0. So what's the second derivative of p evaluated at 0? Well, it's just going to be this constant value. It's going to be f prime prime of 0. So notice, by adding this term, now, not only is our polynomial value the same thing as our function value at 0, its derivative at 0 is the same thing as the derivative of the function at 0. And its second derivative at 0 is the same thing as the second derivative of the function at 0. So we're getting pretty good at this. And you might guess that there's a pattern here. Every term we add, it'll allow us to set up the situation so that the n-th derivative of our approximation at 0 will be the same thing as the n-th derivative of our function at 0. So in general, if we wanted to keep doing this, if we had a lot of time on our hands and we wanted to just keep adding terms to our polynomial, we could-- and let me do this in a new color. Maybe I'll do it in a color I already used. We could make our polynomial approximation. So the first term, the constant term, will just be f of 0. Then the next term will be f prime of 0 times x. Then the next term will be f prime prime of 0 times 1/2 times x squared. I just rewrote that in a slightly different order. Then the next term, if we want to make their third derivative the same at 0, would be f prime prime prime of 0. The third derivative of the function at 0, times 1/2 times 1/3, so 1 over 2 times 3 times x to the third. And we can keep going. Maybe you you'll start to see a pattern here. Plus, if we want to make their fourth derivatives at 0 coincide, it would be the fourth derivative of the function. I could put a 4 up there, but this is really emphasizing-- it's the fourth derivative at 0 times 1 over-- and I'll change the order. Instead of writing it in increasing order, I'll write it as 4 times 3 times 2 times x to the fourth. And you can verify it for yourself. If we just had this only, and if you were to take the fourth derivative of this, evaluate it at 0, it'll be the same thing as the fourth derivative of the function evaluated at 0. And in general, you can keep adding terms where the n-th term will look like this. The n-th derivative of your function evaluated at 0 times x to the n over n factorial. Notice this is the same thing as 4 factorial. 4 factorial is equal to 4 times 3 times 2 times 1. You don't have to write the 1 there, but you could put it there. This right here is the same thing as 3 factorial-- 3 times 2 times 1. I didn't put the 1 there. This right here is the same thing as 2 factorial, 2 times 1. This is the same thing. We didn't write anything, but you could divide this by 1 factorial, which is the same thing as 1. And you can divide this by 0 factorial, which also happens to be 1. We won't have to study it too much over here. But this general series that I've kind of set up right here is called the Maclaurin series. And you can approximate a polynomial. And we'll see it leads to some pretty powerful results later on. But what happens-- and I don't have the computing power in my brain to draw the graph properly-- is that when only the functions equal, you get that horizontal line. When you make the function equal 0 and their first derivatives equal at 0, then you have something that looks like the tangent line. When you add another degree, it might approximate the polynomial something like this. When you add another degree, it might look something like that. And as you keep adding more and more degrees, when you keep adding more and more terms, it gets closer and closer around, especially as you get close to x is equal to 0. But in theory, if you add an infinite number of terms, you shouldn't be able to do-- I haven't proven this to you, so that's why I'm saying that. I haven't proved it yet to you. But if you add an infinite number of terms, all of the derivatives should be the same. And then the function should pretty much look like each other. In the next video, I'll do this with some actual functions just so it makes a little bit more sense. And just so you know, the Maclaurin series is a special case of the Taylor series because we're centering it at 0. And when you're doing a Taylor series, you can pick any center point. We'll focus on the Maclaurin right now.