# The Chain Rule

Up to this point, you’ve learned how to take the derivatives of various types of functions, including **polynomials**, **products**, **natural logs**, and more. But how would we go about taking the derivative of something like this, where one function is nested inside of another?

In this video, I’m going to show you how to quickly and easily apply the chain rule for problems such as these.

Before we get started, let’s briefly review composition of functions. Composition of functions can be described as nesting one function inside another, and is usually denoted with a little “o” between the two functions. For example, if

then we would say that “\(f\) composed with \(g\)” equals the composite function

To compose one function with another, it is helpful to write them in nested form like this: \(f(g(x))\). From here, we can write that \(g\) is \(8x-2\):

and plug that in everywhere we see an \(x\) in \(f(x)\).

Similarly, we could write “\(g\) composed with \(f\)” as

The chain rule is a method which helps us take the derivative of “nested” functions like \(f(g(x))\).

It states that the derivative of a composite function \(f∘g\) is equal to the derivative of the outer function, with the inner function untouched, multiplied by the derivative of the inner function. Another way of expressing the chain rule is by writing:

So if we wanted to find the derivative of \(f(g(x))=(8x-2)^{3}\), we would first write the derivative of the outer function, the cube, while leaving the inner function alone…

then multiply this by the derivative of the inner function, \(8x-2\), which would be 8.

Now, we could have handled this derivative by FOILing out \((8x-2)^{3}\) and then applying the power rule to the resulting polynomial. This expansion would have been time-consuming to calculate, though. Once you get the hang of the chain rule, you’ll find that it is an excellent time-saver in problems like this.

Let’s work through another example. Use the chain rule to find the derivative of the function \(h(x)=\sqrt{ln(x)}\).

First, let’s identify what the “outer function” and “inner function” each are. Since \(ln(x)\) is nested inside the radical, it is the inner function, while the outer function is the square root. The chain rule says that the derivative of a composite function is equal to the derivative of the outer function with the inner function untouched, times the derivative of the inner function. Since the derivative of \(\sqrt{x}\), or \(x^{\frac{1}{2}}\), is \(\frac{1}{2}x^{-\frac{1}{2}}\), we write the first part of the derivative as:

Then multiply by the derivative of the inside. Since the derivative of \(ln(x)\) is \(\frac{1}{x}\), we will multiply by \(\frac{1}{x}\).

Simplifying, we get that \(h'(x)=\frac{1}{2x}(ln(x))^{-\frac{1}{2}}\), or \(\frac{1}{2x\sqrt{ln(x)}}\).

Let’s do another example. Use the chain rule to find the derivative of the function \(j(x)=e^{8x^{2}}\).

Even though this function looks a little bit fearsome, we have the tools necessary to work through its derivative. In this case, the “outer function” is the exponential function, e raised to a power. The “inner function” is that power, \(8x^{2}\). To get the derivative with the chain rule, we need to first write the derivative of the outer function with the inner function untouched. Since the derivative of the outer function, \(e^{x}\), is itself, we are just going to write \(e^{8x^{2}}\) again.

Then, we need to multiply this by the derivative of the inner function. Since the derivative of 8×2 is 16x, let’s go ahead and write that down:

Not so bad, right? Now I want you to try a problem on your own. Using the chain rule, find the derivative of \(k(x)=(x^{3}-9)^{11}\). Remember, you’ll need to handle the outer function’s derivative first, then the inner function’s derivative. Pause the video now to work out the answer yourself, then we will discuss the solution together.

Did you get it? Let’s check your work now. What is the outer function? In this problem, it is the eleventh power. The inner function is \(x^{3}-9\). The first part of the chain rule dictates that we write the derivative of the outer function with the inner function still inside of it, so we will have \(k'(x)=(11x^{3}-9)^{10}\)…. Then we are going to multiply this by the derivative of the inner function, which will be \(3x^{2}\).

If we simplify this a little bit, we’ll get:

This problem, like the first one in this video, could have been solved by expanding the polynomial to a twelve-term expression and then handling each term individually with the power rule. But I think it’s safe to say that the chain rule is a much better method for finding this derivative.

Let’s work through one last example. Leo is studying population growth in a petri dish of mold spores. The dish starts out with only one spore, but the spore duplicates itself and there is exponential population growth over time. If the number of mold spores on day \(x\) can be calculated using the function \(m(x)=e^{\sqrt{x}}\), determine the function \(m'(x)\) which represents the growth rate on day \(x\).

Because we are interested in finding a rate function, \(m'(x)\), we understand that this is a derivative problem. And since the function \(m(x)\) is a composite function, we know that we are going to need the chain rule to find that derivative.

The outer function in this case is the exponential function, \(e\) raised to a power. That power, \(\sqrt{x}\), is the inner function. To find \(m’\), we start by taking the derivative of the outer function while leaving the inner function as-is. Once again, the derivative of \(e^{{x}\) is itself, so we will start by just writing \(e^{\sqrt{x}}\) again.

Next, we have to multiply this by the derivative of the inner function. Since the derivative of \(\sqrt{x}\) is \(\frac{1}{2}x^{-\frac{1}{2}}\), the growth rate function \(m’\) is equal to:

or equivalently:

Remember, the chain rule helps us take the derivatives of composite or “nested” functions. To get these derivatives, first write the derivative of the outer function with the inner function still untouched within it, then multiply this by the derivative of the inner function.

This technique will come in handy any time you see a function contained in another function, whether under a radical, in a logarithm, or even inside a trig function. As always, a little practice goes a long way, so I encourage you to try some problems on your own now.

Thanks for watching, and happy studying!

## Practice Questions

**Question #1:**

Use the chain rule to find the derivative, \(h^\prime\), of the function \(h\left(x\right)=\text{cos}{\left(9x^4+17\right)}\).

\(\text{cos}{\left(36x^3\right)}\)

\(-36x^3\text{sin}{\left(9x^4+17\right)}\)

\(-\text{sin}{\left(36x^3\right)}\)

\(\text{cos}{\left(36x^3\right)}-\text{sin}{\left(9x^4+17\right)}\)

**Answer:**

The correct answer is B. The function h is the composition of the functions \(f\left(x\right)=\text{cos}{x}\), the outer function, and \(g\left(x\right)=9x^4+17\), the inner function. The chain rule tells us that \(h^\prime\left(x\right)=f^\prime\left(g\left(x\right)\right)\cdot g^\prime\left(x\right)={\rm outer}^\prime\left(\text{inner untouched}\right)\cdot{\text{ inner}}^\prime\). Since \(f^\prime\left(x\right)=-\text{sin}{x}\) and \(g^\prime\left(x\right)=9\left(4x^3\right)=36x^3\), the chain rule gives us \(h^\prime\left(x\right)=-\text{sin}{\left(9x^4+17\ \right)}\cdot\left(36x^3\right)=-36x^3\text{sin}{\left(9x^4+17\ \right)}\).

**Question #2:**

Use the chain rule to find the derivative, \(k^\prime\), of the function \(k\left(x\right)=\text{ln}{\left(e^x+12\right)}\).

\(\frac{e^x}{x}\)

\(\text{ln}{\left(e^x\right)}\)

\(\frac{e^x}{e^x+12}\)

\(\frac{1}{e^x+12}\)

**Answer:**

The correct answer is C. The function \(k\) is the composition of the functions \(f\left(x\right)=\text{ln}{x}\), the outer function, and \(g\left(x\right)=e^x+12\), the inner function. The chain rule tells us that \(k^\prime\left(x\right)=f^\prime\left(g\left(x\right)\right)\cdot g^\prime\left(x\right)={\text{outer}}^\prime\left(\text{inner untouched}\right)\cdot{\text{ inner}}^\prime\). Since \(f^\prime\left(x\right)=\frac{1}{x}\) and \(g^\prime\left(x\right)=e^x+0=e^x\), the chain rule gives us:

\(k^\prime\left(x\right)=\frac{1}{e^x+12}\cdot e^x=\frac{e^x}{e^x+12}\)

**Question #3:**

Use the chain rule to find the derivative, \(m^\prime\), of the function \(m\left(x\right)=\sqrt{2x^3-5x^2+13x-92}\).

\(\frac{6x^2-10x+13}{2\sqrt{2x^3-5x^2+13x-92}}\)

\(\frac{1}{2\sqrt{2x^3-5x^2+13x-92}}\)

\(\sqrt{6x^2-10x+13}\)

\(\frac{1}{2\sqrt{6x^2-10x+13}}\)

**Answer:**

The correct answer is A. The function \(m\) is the composition of the functions \(f\left(x\right)=\sqrt x=x^\frac{1}{2}\), the outer function, and \(g\left(x\right)=2x^3-5x^2+13x-92\), the inner function. The chain rule tells us that \(m^\prime\left(x\right)=f^\prime\left(g\left(x\right)\right)\cdot g^\prime\left(x\right)={\text{ outer}}^\prime\left(\text{inner untouched}\right)\cdot{\text{ inner}}^\prime\). Since \(f^\prime\left(x\right)=\left(\frac{1}{2}\right)x^{-\frac{1}{2}}and g^\prime\left(x\right)=6x^2-10x+13\), the chain rule gives us:

\(m^\prime\left(x\right)=\frac{1}{2}\left(2x^3-5x^2+13x-92\right)^{-\frac{1}{2}}\cdot\left(6x^2-10x+13\right)=\frac{6x^2-10x+13}{2\sqrt{2x^3-5x^2+13x-92}}\)

**Question #4:**

A weight suspended from a spring oscillates in such a fashion that its position about the ground at time \(t\) seconds is \(s\left(t\right)=20+18\text{sin}{\left(3t\right)}\text{ cm}\). Differentiate the position function to find the velocity of the weight at time \(t\) seconds. That is, find \(v\left(t\right)=s^\prime\left(t\right)\).

\(18\text{cos}{\left(3t\right)}\text{ cm/sec}\)

\(18\text{cos}{\left(3\right)}\text{ cm/sec}\)

\(54\text{sin}{\left(3t\right)}\text{ cm/sec}\)

\(54\text{cos}{\left(3t\right)}\text{ cm/sec}\)

**Answer:**

The correct answer is D. The function \(s\) is the composition of the functions \(f\left(t\right)=20+18\text{sin}{\left(t\right)}\), the outer function, and \(g\left(t\right)=3t\), the inner function. The chain rule tells us that \(s^\prime\left(t\right)=f^\prime\left(g\left(t\right)\right)\cdot g^\prime\left(t\right)={\text{ outer}}^\prime\left(\text{inner untouched}\right)\cdot{\text{ inner}}^\prime\). Since \(f^\prime\left(t\right)=0+18\text{cos}{\left(t\right)}=18\text{cos}{\left(t\right)}\) and \(g^\prime\left(t\right)=3\), the chain rule gives us \(s^\prime\left(t\right)=v\left(t\right)=18\text{cos}{\left(3t\right)}\cdot3=54\text{cos}{\left(3t\right)}\text{ cm/sec}\).

**Question #5:**

You begin a new exercise program to build up your running endurance. You find that after \(x\) weeks of this program, the daily distance you can run is \(d\left(x\right)=1.5\text{ln}{\left(x^2+1\right)}\text{ miles}\). What is the derivative \(d^\prime\left(x\right)\), the function that gives the rate at which your distance is increasing?

\(\frac{1.5}{x^2+1}\text{ miles/week}\)

\(1.5\text{ln}{\left(2x\right)}\text{ miles/week}\)

\(\frac{3x}{x^2+1}\text{ miles/week}\)

\(\frac{3}{4x}\text{ miles/week}\)

**Answer:**

The correct answer is C. The function \(d\) is the composition of the functions \(f\left(x\right)=1.5\text{ln}{\left(x\right)}\), the outer function, and \(g\left(x\right)=x^2+1\), the inner function. The chain rule tells us that \(d^\prime\left(x\right)=f^\prime\left(g\left(x\right)\right)\cdot g^\prime\left(x\right)={\text{ outer}}^\prime\left(\text{inner untouched}\right)\cdot{\text{ inner}}^\prime\). Since \(f^\prime\left(t\right)=\frac{1.5}{x}\) and \(g^\prime\left(t\right)=2x\), the chain rule gives us the following derivative.

\(d^\prime\left(x\right)=\frac{1.5}{x^2+1}\cdot2x=\frac{3x}{x^2+1}\text{ miles/week}\)