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: Derivative of cos³(x) using the chain rule

AP.CALC:
FUN‑3 (EU)
,
FUN‑3.C (LO)
,
FUN‑3.C.1 (EK)
f(x)=cos³(x) is a composition of the functions x³ and cos(x), and therefore we can differentiate it using the chain rule.

Want to join the conversation?

  • female robot ada style avatar for user Anika
    What does 'grok' mean? ,
    (22 votes)
    Default Khan Academy avatar avatar for user
  • old spice man green style avatar for user Patrick
    how did sal multiply 3cosx by the -sinx
    (6 votes)
    Default Khan Academy avatar avatar for user
  • spunky sam blue style avatar for user Mortadha Alaa
    I don't understand why dv/du is the same thing as v'( u(x) ).
    (8 votes)
    Default Khan Academy avatar avatar for user
  • leaf orange style avatar for user allenrandy03
    Albeit I should see past lessons probably, (I am missing some basic knowledge) but why does cos become -sin?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Li Hans
    Why is the dv in "dv/du" equal to d(cosx^3) even though the function v in v(x) is x^3, not cosx^3?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      Perhaps Sal should have written it a little differently. it is more ccurate to say
      dv(u(x)) / du(x) * du(x) / dx So the derivative of v(u(x)) with respect to u(x) times the derivative of u(x) with respect to x.

      Let me know if that doesn't make sense.
      (5 votes)
  • leaf green style avatar for user funAlways
    Can't we just think like every differential rule needs chain rule (for the concept)? it's just at some point you'd reach f(x) = x, and since f'(x) = 1 you can just cross it off in multiplications.
    I always think of it that way (similar to pythagorean theorem is actually law of cosines, but the "2abcos(theta)" always results in substraction by zero)
    (4 votes)
    Default Khan Academy avatar avatar for user
  • spunky sam green style avatar for user Josiah Schlabach
    So when Sal is taking the derivative of cosx^3 with respect to cosx instead of x, would that be like graphically taking the derivative but on a graph with (cosx) and y axes instead of just x and y axes?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • mr pink red style avatar for user sfrazee5001
    @ Sal multiplies for the final answer. Why does the (cosx)^2 become cos^2x? Is the x no longer squared? Thanks!
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Allen Lin
      sfrazee5001,

      Ah, I see. There are really two ways of writing. If you look at the upper left of the original f(x) function, we see f(x) = cos^3(x) = (cos x)^3. They really mean the same thing; it's just two different ways of writing the same thing.

      However, be careful about negative powers. For example, sin^-1(x) is not the same as (sin x)^-1 or csc x.
      (3 votes)
  • mr pink red style avatar for user Thomas Michel
    Isn't V basically equal to x^3 ?!

    If I'm right, then why does dV/dU = d(cosx)^3/dcosx, and not dx^3/dcosx?

    Thanks a lot,
    (2 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Joshua Ogunmefun
    why is it called the chain rule? and is it always obvious when you can actually use the chain rule?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • mr pink red style avatar for user andrewp18
      I think the reason it's called "chain rule" is because it allows us to differentiate a function "chain" or more accurately a function "composition". In general, you should always use the chain rule when you want to differentiate a composition:
      𝑓(𝑔(𝑥))
      Differentiating this is easy using the chain rule. However, going the other way around and reversing it by integration is considerably harder.
      Comment if you have questions!
      (3 votes)

Video transcript

- [Voiceover] Let's say we have the function f of x which is equal to cosine of x to the third power which we could also write like this, cosine of x to the third power. And we are interested in figuring out what f prime of x is going to be equal to. So we want to figure out f prime of x and as we will see, the chain rule is going to be very useful here and what I'm going to do is I'm going to first just apply the chain rule and then maybe dig into it a little bit to make sure we draw the connection between what we're doing here and then what you might see in maybe some of your Calculus textbooks that explain the chain rule. So if we have a function that is defined as essentially a composite function, notice this expression right here, we are taking something to the third power. It isn't just an x that we're taking to the third power. We are taking a cosine of x to the third power. So we're taking a function, you could view it this way, we're taking the function cosine of x and then we're inputting it in to another function that takes it to the third power. So let me put it this way. If you viewed, if you say, look, we could take an x, we put it into one function and that is, that first function is cosine of x so first, we evaluate the cosine and so that's going to produce cosine of x, cosine of x, and then we're going to input it into a function that just takes things to the third power. So it just takes things to the third power. And so what are you going to end up with? Well, you're going to end up with, what are you taking to the third power? You're taking cosine of x. Cosine of x to the third power. This is a composite function. You could view this, you could view this as the function, let's call this blue one, the function v and let's call this the function u and so if we're taking x and into u, this is u of x and then if we're taking u of x into the input or as the input into the function v then this output right over here, this is going to be v of, well, what was inputted? V of u of x. V of u of x or another way of writing it, I'm going to write it multiple ways. That's the same thing as v of cosine of x. V of cosine of x. And so v, whatever you input into it, it just takes it to the third power. If you were to write v of x, it would be x to the third power. So the chain rule tells us or the chain rule is what our brain should say. Hey, it becomes applicable if we're going to take the derivative of a function that can be expressed as a composite function like this. So just to be clear, we can write f of x. f of x is equal to v of u of x. I know I'm essentially saying the same thing over and over again but I'm saying it in slightly different ways because the first time you learn this, it can be a little bit hard to grok or really deeply understand so I'm going to try to write it in different ways. And the chain rule tells us that if you have a situation like this then the derivative, f prime of x, and this is something that you will see in your textbooks. Well, this is going to be the derivative of this whole thing with respect to u of x so we could write that as v prime of u of x. V prime of u of x times the derivative of u with respect to x. Times u prime of x. This right over here, this is one expression of the chain rule and so how do we evaluate it in this case? Well, let me color code it in a similar way. So the v function, this outer thing that just takes things to the third power, I'll put in blue. So f prime of x, another way of expressing it and I'll use it with more of the differential notation, you could view this as the derivative of, well, I'll write it a couple of different ways. You could view it as the derivative of v. The derivative of v with respect to u. I want to get the colors right. The derivative of v with respect to u, that's what this thing is right over here, times the derivative of u with respect to x. So times the derivative of u with respect to x. And just to be clear, so you're familiar with the different notations you'll see in different textbooks, this is this right over here just using different notations and this is this right over here. So let's actually evaluate these things. You're probably tired of just talking in the abstract. So this is going to be equal to, this is going to be equal to and I'm going to write it out again, this is the derivative, instead of just writing v and u, I'm going to write it, let me write this way. This is going to be, I keep wanting, I'm using the wrong colors. This is going to be the derivative of, and I'm going to leave some space, times the derivative of something else with respect to something else so we're going to have to first take the derivative of v. Well, v is cosine of x to the third power. Cosine of x. We're going to take the derivative of that with respect to u which is just cosine of x and we're going to multiply that times the derivative of u which is cosine of x with respect to x. With respect to x. So this one, we have good, we've seen this before. We know that the derivative with respect to x of cosine of x. Cosine. We use it in that same color. The derivative of cosine of x, well, that's equal to negative sine of x. So this one right over here, that is negative sine of x. You might be more familiar with seeing the derivative operated this way but in theory, you won't see this as often but this helps my brain really grok what we're doing. We're taking the derivative of cosine of x with respect to x. Well, that's going to be negative sine of x. Well, what about taking the derivative of cosine of x to the third power with respect to cosine of x? What is this thing over here mean? Well, if I were taking the derivative, if I was taking the derivative of, let me write it this way, if I was taking the derivative of x to the third power, x to the third power with respect to x, if it was like that, well, this is just going to be and let me put some brackets here to make it a little bit clear. If I'm taking the derivative of that, that is going to be, that is going to be, we bring the exponent out front. That's going to be three, three times x. Three times x to the second power. Three times x to the second power. So the general notion here is if I'm taking the derivative of something, whatever this something happens to be, let me do this in a new color. I'm doing the derivative of orange circle to the third power with respect to orange circle. Well, that's just going to be three times orange or yellow circle. Let me make it an actual orange circle. So the derivative of orange circle to the third power with respect to orange circle, that's going to be three times the orange circle squared. So if I'm taking the derivative of cosine of x to the third power with respect to cosine of x, well, that's just going to be, this is just going to be three times cosine of x, cosine of x to the second power. To the second power. Notice, one way to think about it. I'm taking the derivative of this outside function with respect to the inside. So I would do the same thing as taking the derivative of x to the third power but instead of an x, I have a cosine of x so instead of it being three x squared, it is three cosine of x squared and then the chain rule says, if we want to get finally get the derivative with respect to x, we then take the derivative of cosine of x with respect to x. I know that's a big mouthful but we are at the homestretch. We've now figured out the derivative. It's going to be this times this. So let's see, that's going to be negative three, negative three times sine of x times cosine squared of x and I know that was kind of a long way of saying it. I'm trying to explain the chain rule at the same time. But once you get the hang of it, you're just going to say, alright, well, let me take the derivative of the outside of something to the third power with respect to the inside. Let me just treat that cosine of x like as if it was an x. Well, that's going to be, if I do that, that's going to be three cosine squared of x so that's that part and that part and then let me take the derivative of the inside with respect to x. Well, that is negative sine of x.