Worked example: Derivative of cos_(x) using the chain rule | AP Calculus AB | Khan Academy
Let's say we have the function f of x, which is equal to cosine of x to the third power. We could also write it like this: cosine of x to the third power. 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. As we will see, the chain rule is going to be very useful here.
What I'm going to do is I'm going to first just apply the chain rule and then maybe dig into 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. 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 into another function that takes it to the third power. Let me put it this way: if you viewed it—if you say, look, we could take an x, we put it into one function—that first function is cosine of x. So first we evaluate the cosine, and so that's going to produce cosine of x.
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. 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 to the third power. This is a composite function. You could view this as the function—let's call this blue one the function v and let's call this the function u.
If we're taking x into u, this is u of x. 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 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.
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. The chain rule tells us—or the chain rule is what our brain should say—is 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.
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—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.
So how do we evaluate it in this case? Let me color code it in a similar way. 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. Just to make 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.
Let's actually evaluate these things. You're probably tired of just talking in the abstract. So 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 it this way: this is going to be—I keep wanting using the wrong colors—this is going to be the derivative of, I'm going to leave some space, times the derivative of something else with respect to something else.
So we're going 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—let me 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 operator 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 does this thing over here mean? Well, if I was 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 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 clearer—if I'm taking the derivative of that, that is going to be—we bring the exponent out front.
It's going to be 3 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 just—in a new color—it could be 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 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 3 times cosine of x to the second power. Notice, this is just 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 3 x squared, it is 3 cosine of x squared. Then the chain rule says if we want to finally get the derivative with respect to x, we then take the derivative of cosine of x with respect to x.
Now that's a big mouthful, but we are at the home stretch. 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 3 times sine of x times cosine squared of x. 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, “All right, 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 did that—that’s going to be 3 cosine squared of x. So that's that part and that part. Then let me take the derivative of the inside with respect to x. Well, that is negative sine of x.