 So it turns out that the chain rule applies no matter how many links are in your chain, and that's actually where the chain rule gets its name from, right? If we're trying to calculate the derivative of a function dy over dx, we can factor the derivative using the chain rule, that is the derivative will respect the function composition. So we can have some outer function y with respect to u and some inner function u with respect to x, and if we take those derivatives separately, their product can come together to form the derivative. But let's suppose that u itself has an inner function. So we can take the derivative of y with respect to u, we can take the derivative of u with respect to v, and we can take the derivative of v with respect to x. But what if the function v itself has an inner function, right? We can take the derivative of y with respect to u, we can take the derivative of u with respect to v, we can take the derivative of v with respect to t, we can take the derivative of t with respect to x and we can keep on going and going and going and going and as we link these different functions inside of each other we get to start to see why do we call it the chain rule. All right so let's look at a specific example. Let's consider the function f of x equals sine of cosine of tangent of x so we have this triple nested trigonometric function tangent inside of cosine inside of sine and so as we try to investigate inner functions we see that there's one function tangent of x that's all by itself but this tangent function sits inside of the function cosine which that sits inside of the function sine and so by the chain rule we should take the derivative of all of these functions in that sequence therefore the derivative of f with respect to x we're going to take the derivative of sine which is going to be a cosine function we then put its inner function inside which the inner function here is going to be cosine of tangent of x then we're going to multiply that by its inner derivative that is we're going to take the derivative of cosine of tangent of x like so but then what's the derivative of that well let me just copy down cosine of cosine of tangent again so we have to take the derivative of cosine here well the derivative of cosine is going to be a negative sine of well the inner function there is the tangent of x but then we have to multiply by the inner derivative of that function which we're going to be taking the derivative of tangent like so in which case putting this all together we have again the cosine of cosine of tangent we're going to have the negative sine of tangent and then we're going to take the derivative of tangent here which we know to be secant squared of x and there's then our derivative here of all these functions i'm probably would stick the negative sign out in front of everything so it doesn't look like subtraction by mistake so you're going to get negative cosine of cosine of tangent tangent of x then you're going to get sine of tangent tangent of x and then you're going to get secant squared in which case that would be the derivative of the function so we can take the derivative of these nested functions just by taking the derivative one link of the chain at a time let's look at another example let's take the function g of x to equal the square root of one plus the square root of one plus the square root of x all right how is the links of the chain going on here so consider the inner function one plus the square root of one plus the square root of x seems complicated right we'll come back to it later we don't have to do all the links of the chain at once i'm going to take the atom most function here just to be the square root of x now for the sake of calculation this is going to be very useful for us if we have to take the derivative of the square root of u with respect to u be aware by the power rule we're just taking the derivative of u to the one half power we end up with one half u to negative one half power but then by the chain rule we also have to take the derivative of u itself with respect to x and so putting that together this will look like u prime over two times the square root of u so whenever you have to take the derivative of a square root function you get its derivative on top of whatever the radicand was that'll sit above two times the square root of u that's going to be helpful in this situation so as we take the derivative of g right here we end up with since we're taking the square root we're going to get in the bottom two times the square root of one plus the square root of one plus the square root of x now we get there but then we get the inner derivative for which you have to take derivative of one plus the square root of one plus the square root of x like so so we haven't done the numerator or the numerator yet we have to come back to it well taking the derivative of this one plus the square root well you're just going to get you know the one right there it'll just go to zero we have to take the the derivative of the square root of 1 plus the square root of x right there, where again we have this inner function sitting inside of the outer function, which is again the square root of x. So taking this to the next line, we have this two times the square root of 1 plus the square root of 1 plus the square root of x. I'm going to put this to the side to make it a little bit easier. So this time when we take the derivative, we're going to get in the denominator two times the square root of 1 plus the square root of x. And then sitting on top, we get its inner function, which is going to turn out to be 1 plus the square root of x. We have to take its derivative, like so. But like I said a moment ago, the derivative of 1 is going to be zero so that it disappears. And so in the end, we're going to get the derivative of the square root of x, which is 1 over 2 times the square root of x. So we end up with something like the following. We're going to get 2 times the square root of 1 plus the square root of 1 plus the square root of x. That's the first part. So maybe make this a little bit shorter so we get a 1 right there. So that was the first outer derivative. Then the middle derivative is going to look like 1 over 2 times the square root of 1 plus the square root of x. And then the inner derivative is going to be 1 over 2 times the square root of x, which in terms of putting those all together, there's really not much to simplify. We take 2 times 2 times 2, which is 8. So we end up in the end, we're going to get 8 times the square root of x times the square root of 1 plus the square root of x times the square root of 1 plus the square root of 1 plus the square root of x, all under 1. And now it'll be the derivative of the function. And again, the purpose of these examples here is to just test how can we calculate the derivative when we nest functions more and more and more and more. Let's do one last example of this. Take y to be e to the secant of 3 theta. And so we see three functions in play here. There's 3 theta, which sits inside of the function secant, which sits inside the function e to the power, exponential by e. And so when we take the derivative, the first, you know, the outermost derivative we're going to get is going to be the derivative of an exponential. The natural exponential just give back itself. So we get e to the secant of 3 theta power. But then we have to times that by the inner derivative, the derivative of secant of 3 theta, which the derivative of secant is secant tangent. So we get secant 3 theta times tangent 3 theta. Then we have to take the derivative of 3 theta, the inner function, that situation, which the inner function then would be 3. And so piecing this together, we see that y prime is going to equal 3 times e to the secant of 3 theta times secant of 3 theta times tangent of 3 theta. And so not all of these nested chains are going to be as messy as maybe the previous example was. But the principle is still the same. If we just take the derivative one step at a time, I do the derivative, then the inner derivative, then the next inner derivative, then the next inner derivative, do this all the way until you get to the very middle of the function until you get to the, you know, the chocolate center of your Tootsie Pop there. And then you're going to have the derivative, which we calculated from the chain rule.