# The Chain Rule

The chain rule is another trick for taking complex derivatives by breaking them down into simpler parts.  Rather than using this when we are multiplying or dividing two functions, we use the chain rule when our complex function can be thought of as plugging one function into another one.  These are known as composite functions.

Let’s say we have a function called $$h(x)$$ which is the composition of two simpler functions, $$f(x)$$ and $$g(x)$$ where: $$h(x)=f(g(x)).$$

Then, $$h'(x)=f'(g(x))\cdot g'(x)$$

This is known as the chain rule.

The phrase I use to remember The Chain Rule is:

The derivative of the outside, leave the inside function alone.  Then multiply by the derivative of the inside.

Similarly to the product rule and quotient rule, the first thing you need to do after identifying you need to use the chain rule is figure out which part of the function you want to call $$f(x)$$ and what to call $$g(x)$$.  Once you figure out which part to call $$f(x)$$ and $$g(x)$$, the rest of the process is almost identical to applying the product and quotient rules.

I would like to show a few examples of how to assign $$f(x)$$ and $$g(x)$$ then we can go through one of them all the way to the end.

## Example 1

Find the derivative of $$h(x)=\sqrt{x^3-4x^2+7x+1}$$.

#### Recognizing when to use the chain rule

The way I like to think about breaking it down into $$f(x)$$ and $$g(x)$$ is to consider which is the outside function and the inside function.  In this case, it is pretty clear that we have $$x^3-4x^2+7x+1$$ all inside of a square root.  Therefore, we can think of the square root as the outside function and the $$x^3-4x^2+7x+1$$ as the inside function.  In other words, we are plugging our inside function into our outside function.

Since we can say that the above function, $$h(x)$$, can be described by one function being plugged into another function, this tells us that we can use the chain rule to find its derivative.

#### Determining f and g

As mentioned before, the first thing you need to do is isolate the inside and outside functions.  I think that it is usually easier to decide on the inside function first.  The reason for this is that the inside function is often surrounded by parenthesis, or in this case, a square root.

So as a result, we can say that our inside function is $$g(x)=x^3-4x^2+7x+1.$$

Once we have figured out our inside function, we need to write everything else that’s left over as an isolated function, which we will call $$f(x)$$.  The simplest way to do this is look at our original function, $$h(x)$$, and replace the entire inside function, $$g(x)$$, with a single $$x$$.

Since $$h(x)=\sqrt{x^3-4x^2+7x+1}$$, all we need to do is replace the entire part which we have called the inside function, which is $$x^3-4x^2+7x+1$$, with a single $$x$$.  The function we are left with after doing this will be our outside function, which will be called $$f(x)$$.

Doing this leaves us with:

$$f(x)=\sqrt{x}$$

Now that we have figured out $$f(x)$$ and $$g(x)$$, we just need to figure out $$f'(x)$$ and $$g'(x)$$ and plug these functions into the chain rule formula as shown above.

I will work one of these all the way to the end a little later, but for now I’d like to do a couple more examples up to this point.

## Example 2

Find the derivative of $$h(x)=2sin(x^2+4)$$.

#### Determining f and g

Like last time, the first thing we need to do is determine what we will call our inside function and our outside function.  First we will figure out the inside function.  As I said before, the inside function is usually a bit easier to see because an easy place to start is to simply take the part of the function inside parenthesis.

If we do this in this case, we would say that our inside function is $$g(x)=x^2+4$$.  I would like to point out that this will not always work every time.  However, it is a good place to start.  You can always come back to this step if you realize your original choice for the inside function doesn’t work well.

If we say that our inside function is the $$x^2+4$$ part, all we need to do to figure out the outside function is replace that piece with a single $$x$$ and see what we have left.  If we do this, we are left with $$f(x)=2sin(x)$$.

Now we have two functions, $$f(x)=2sin(x)$$ and $$g(x)=x^2+4$$, that are much easier to derive.  Therefore, we can use these functions, find their derivatives, and put all those pieces into the chain rule formula.

Now I would like to do one example all the way from beginning to end.

## Example 3

Find the derivative of $$h(x)=\big(x^3+18\big)^{56}$$.

#### Determining f and g

Just like the first two examples, the first thing we want to do is determine our inside and our outside functions.  As before, let’s start with the inside function.  This is another case where our inside function is fairly obvious because it’s surrounded by a set of parenthesis.  Therefore, we will call our inside function $$g(x)=x^3+18$$.

Once we have our inside function, we need to determine our outside function.  To do this, we will go back to our original function and replace the inside function with a single $$x$$.  So we will replace the $$x^3+18$$ all with a single $$x$$.  Doing this gives us $$f(x)=x^{56}$$.

#### Dealing with each piece of the formula

Now we have determined our outside and inside functions to be $$f(x)=x^{56}$$ and $$g(x)=x^3+18$$.  Now, in order to use the chain rule formula to find the derivative of our original function $$h(x)$$ we also need to find $$f'(x)$$ and $$g'(x)$$.

Both of these derivatives can be found simply using the power rule.  If you can’t remember how to do this, I discussed the power rule in this article here.  All you need to do is move the power down in front of the $$x$$ and lower its power by $$1$$.

Doing this gives us:

$$f'(x)=56x^{55}$$

$$g'(x)=3x^2$$

#### Putting it all together

Now, similarly to the product and quotient rule, once we have the four necessary components we can just plug them into the chain rule formula and simplify.  Remember,

$$h'(x)=f'(g(x))\cdot g'(x)$$

Before I proceed I would like to quickly explain what the notation $$f'(g(x))$$ means.  Think about what it means to find, for example, $$f(2)$$.  All this means is that you need to plug $$2$$ into your function called $$f$$.  Or in other words, go to your function $$f(x)$$ and replace every $$x$$ with a $$2$$.  By this same reasoning, $$f'(g(x))$$ means we need to take our function $$f’$$ and replace each $$x$$ with our entire function $$g(x)$$.  So we will change each $$x$$ in our equation into $$(x^3+18)$$.  I suggest putting parenthesis around the entire function when you plug it into each $$x$$ because this will help make sure you simplify correctly.

Now let’s go ahead and use the formula.  We will plug $$g(x)$$ into $$f'(x)$$, then multiply that whole piece by our entire function $$g'(x)$$.

$$h'(x)=\Big(56\big(x^3+18\big)^{55}\Big)\Big(3x^2\Big)$$

Now you just want to simplify, and this tells you that our final derivative is:

$$h'(x)=168x^2\big(x^3+18\big)^{55}$$

Enter your email and name below and I’ll send you my calculus 1 study guide straight to your inbox!

Go check out my other lessons on the derivatives page.  There’s a lot of topics covered there that are worth taking a look at.  You can also see some more practice problems using the chain rule here.  And don’t forget, if you have any questions about this article or any suggestions for future lessons I haven’t touched on, leave a comment or email me at jakesmathlessons@gmail.com!