### Learning Objectives

- 3.6.1 State the chain rule for the composition of two functions.
- 3.6.2 Apply the chain rule together with the power rule.
- 3.6.3 Apply the chain rule and the product/quotient rules correctly in combination when both are necessary.
- 3.6.4 Recognize the chain rule for a composition of three or more functions.
- 3.6.5 Describe the proof of the chain rule.

We have seen the techniques for differentiating basic functions $({x}^{n},\text{sin}\phantom{\rule{0.1em}{0ex}}x,\text{cos}\phantom{\rule{0.1em}{0ex}}x,\text{etc}.)$ as well as sums, differences, products, quotients, and constant multiples of these functions. However, these techniques do not allow us to differentiate compositions of functions, such as $h\left(x\right)=\text{sin}\left({x}^{3}\right)$ or $k\left(x\right)=\sqrt{3{x}^{2}+1}.$ In this section, we study the rule for finding the derivative of the composition of two or more functions.

### Deriving the Chain Rule

When we have a function that is a composition of two or more functions, we could use all of the techniques we have already learned to differentiate it. However, using all of those techniques to break down a function into simpler parts that we are able to differentiate can get cumbersome. Instead, we use the chain rule, which states that the derivative of a composite function is the derivative of the outer function evaluated at the inner function times the derivative of the inner function.

To put this rule into context, let’s take a look at an example: $h\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right).$ We can think of the derivative of this function with respect to *x* as the rate of change of $\text{sin}\left({x}^{3}\right)$ relative to the change in $x.$ Consequently, we want to know how $\text{sin}\left({x}^{3}\right)$ changes as $x$ changes. We can think of this event as a chain reaction: As $x$ changes, ${x}^{3}$ changes, which leads to a change in $\text{sin}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right).$ This chain reaction gives us hints as to what is involved in computing the derivative of $\phantom{\rule{0.2em}{0ex}}\text{sin}\left({x}^{3}\right).$ First of all, a change in $x$ forcing a change in ${x}^{3}$ suggests that somehow the derivative of ${x}^{3}$ is involved. In addition, the change in ${x}^{3}$ forcing a change in $\text{sin}\left({x}^{3}\right)$ suggests that the derivative of $\text{sin}(u)$ with respect to $u,$ where $u={x}^{3},$ is also part of the final derivative.

We can take a more formal look at the derivative of $h\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right)$ by setting up the limit that would give us the derivative at a specific value $a$ in the domain of $h\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right).$

This expression does not seem particularly helpful; however, we can modify it by multiplying and dividing by the expression ${x}^{3}-{a}^{3}$ to obtain

From the definition of the derivative, we can see that the second factor is the derivative of ${x}^{3}$ at $x=a.$ That is,

However, it might be a little more challenging to recognize that the first term is also a derivative. We can see this by letting $u={x}^{3}$ and observing that as $x\to a,u\to {a}^{3}\text{:}$

Thus, ${h}^{\prime}\left(a\right)=\text{cos}\left({a}^{3}\right)\xb73{a}^{2}.$

In other words, if $h\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right),$ then ${h}^{\prime}\left(x\right)=\text{cos}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right)\xb73{x}^{2}.$ Thus, if we think of $h\left(x\right)=\text{sin}\left({x}^{3}\right)$ as the composition $\left(f\circ g\right)\left(x\right)=f\left(g\left(x\right)\right)$ where $f\left(x\right)=$ sin $x$ and $g\left(x\right)={x}^{3},$ then the derivative of $h\left(x\right)=\text{sin}\left({x}^{3}\right)$ is the product of the derivative of $g\left(x\right)={x}^{3}$ and the derivative of the function $f\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}x$ evaluated at the function $g\left(x\right)={x}^{3}.$ At this point, we anticipate that for $h\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left(g\left(x\right)\right),$ it is quite likely that ${h}^{\prime}(x)=\text{cos}(g(x)){g}^{\prime}(x).$ As we determined above, this is the case for $h\left(x\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right).$

Now that we have derived a special case of the chain rule, we state the general case and then apply it in a general form to other composite functions. An informal proof is provided at the end of the section.

### Rule: The Chain Rule

Let $f$ and $g$ be functions. For all *x* in the domain of $g$ for which $g$ is differentiable at *x* and $f$ is differentiable at $g\left(x\right),$ the derivative of the composite function

is given by

Alternatively, if $y$ is a function of $u,$ and $u$ is a function of $x,$ then

### Media

Watch an animation of the chain rule.

### Problem-Solving Strategy

#### Problem-Solving Strategy: Applying the Chain Rule

- To differentiate $h\left(x\right)=f\left(g\left(x\right)\right),$ begin by identifying $f(x)$ and $g(x).$
- Find $f\prime (x)$ and evaluate it at $g\left(x\right)$ to obtain ${f}^{\prime}\left(g\left(x\right)\right).$
- Find ${g}^{\prime}(x).$
- Write ${h}^{\prime}\left(x\right)={f}^{\prime}\left(g\left(x\right)\right)\xb7{g}^{\prime}\left(x\right).$

*Note*: When applying the chain rule to the composition of two or more functions, keep in mind that we work our way from the outside function in. It is also useful to remember that the derivative of the composition of two functions can be thought of as having two parts; the derivative of the composition of three functions has three parts; and so on. Also, remember that we never evaluate a derivative at a derivative.

### The Chain and Power Rules Combined

We can now apply the chain rule to composite functions, but note that we often need to use it with other rules. For example, to find derivatives of functions of the form $h\left(x\right)={(g\left(x\right))}^{n},$ we need to use the chain rule combined with the power rule. To do so, we can think of $h\left(x\right)={\left(g\left(x\right)\right)}^{n}$ as $f\left(g\left(x\right)\right)$ where $f\left(x\right)={x}^{n}.$ Then ${f}^{\prime}\left(x\right)=n{x}^{n-1}.$ Thus, ${f}^{\prime}\left(g\left(x\right)\right)=n{\left(g\left(x\right)\right)}^{n-1}.$ This leads us to the derivative of a power function using the chain rule,

### Rule: Power Rule for Composition of Functions

For all values of *x* for which the derivative is defined, if

Then

### Example 3.48

#### Using the Chain and Power Rules

Find the derivative of $h\left(x\right)=\frac{1}{{\left(3{x}^{2}+1\right)}^{2}}.$

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

### Example 3.49

#### Using the Chain and Power Rules with a Trigonometric Function

Find the derivative of $h\left(x\right)={\text{sin}}^{3}x.$

### Example 3.50

#### Finding the Equation of a Tangent Line

Find the equation of a line tangent to the graph of $h\left(x\right)=\frac{1}{{(3x-5)}^{2}}$ at $x=2.$

Find the equation of the line tangent to the graph of $f\left(x\right)={\left({x}^{2}-2\right)}^{3}$ at $x=\mathrm{-2}.$

### Combining the Chain Rule with Other Rules

Now that we can combine the chain rule and the power rule, we examine how to combine the chain rule with the other rules we have learned. In particular, we can use it with the formulas for the derivatives of trigonometric functions or with the product rule.

### Example 3.51

#### Using the Chain Rule on a General Cosine Function

Find the derivative of $h\left(x\right)=\text{cos}\phantom{\rule{0.1em}{0ex}}\left(g(x)\right).$

In the following example we apply the rule that we have just derived.

### Example 3.52

#### Using the Chain Rule on a Cosine Function

Find the derivative of $h\left(x\right)=\text{cos}\phantom{\rule{0.1em}{0ex}}\left(5{x}^{2}\right).$

### Example 3.53

#### Using the Chain Rule on Another Trigonometric Function

Find the derivative of $h\left(x\right)=\text{sec}\phantom{\rule{0.1em}{0ex}}\left(4{x}^{5}+2x\right).$

Find the derivative of $h\left(x\right)=\text{sin}(7x+2).$

At this point we provide a list of derivative formulas that may be obtained by applying the chain rule in conjunction with the formulas for derivatives of trigonometric functions. Their derivations are similar to those used in Example 3.51 and Example 3.53. For convenience, formulas are also given in Leibniz’s notation, which some students find easier to remember. (We discuss the chain rule using Leibniz’s notation at the end of this section.) It is not absolutely necessary to memorize these as separate formulas as they are all applications of the chain rule to previously learned formulas.

#### Using the Chain Rule with Trigonometric Functions

For all values of $x$ for which the derivative is defined,

### Example 3.54

#### Combining the Chain Rule with the Product Rule

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

Find the derivative of $h\left(x\right)=\frac{x}{{\left(2x+3\right)}^{3}}.$

### Composites of Three or More Functions

We can now combine the chain rule with other rules for differentiating functions, but when we are differentiating the composition of three or more functions, we need to apply the chain rule more than once. If we look at this situation in general terms, we can generate a formula, but we do not need to remember it, as we can simply apply the chain rule multiple times.

In general terms, first we let

Then, applying the chain rule once we obtain

Applying the chain rule again, we obtain

### Rule: Chain Rule for a Composition of Three Functions

For all values of *x* for which the function is differentiable, if

then

In other words, we are applying the chain rule twice.

Notice that the derivative of the composition of three functions has three parts. (Similarly, the derivative of the composition of four functions has four parts, and so on.) Also, *remember, we can always work from the outside in, taking one derivative at a time.*

### Example 3.55

#### Differentiating a Composite of Three Functions

Find the derivative of $k\left(x\right)={\text{cos}}^{4}\left({7x}^{2}+1\right).$

Find the derivative of $h\left(x\right)={\text{sin}}^{6}\left({x}^{3}\right).$

### Example 3.56

#### Using the Chain Rule in a Velocity Problem

A particle moves along a coordinate axis. Its position at time *t* is given by $s\left(t\right)=\text{sin}\phantom{\rule{0.1em}{0ex}}\left(2t\right)+\text{cos}\phantom{\rule{0.1em}{0ex}}\left(3t\right).$ What is the velocity of the particle at time $t=\frac{\pi}{6}?$

A particle moves along a coordinate axis. Its position at time $t$ is given by $s\left(t\right)=\text{sin}(4t).$ Find its acceleration at time $t.$

#### Proof

At this point, we present a very informal proof of the chain rule. For simplicity’s sake we ignore certain issues: For example, we assume that $g\left(x\right)\ne g(a)$ for $x\ne a$ in some open interval containing $a.$ We begin by applying the limit definition of the derivative to the function $h(x)$ to obtain ${h}^{\prime}(a)\text{:}$

Rewriting, we obtain

Although it is clear that

it is not obvious that

To see that this is true, first recall that since *g* is differentiable at $a,g$ is also continuous at $a.$ Thus,

Next, make the substitution $y=g(x)$ and $b=g(a)$ and use change of variables in the limit to obtain

Finally,

□

### Example 3.57

#### Using the Chain Rule with Functional Values

Let $h\left(x\right)=f\left(g\left(x\right)\right).$ If $g\left(1\right)=4,{g}^{\prime}\left(1\right)=3,$ and ${f}^{\prime}\left(4\right)=7,$ find ${h}^{\prime}\left(1\right).$

### Checkpoint 3.40

Given $h\left(x\right)=f\left(g\left(x\right)\right).$ If $g\left(2\right)=\mathrm{-3},{g}^{\prime}\left(2\right)=4,$ and ${f}^{\prime}\left(\mathrm{-3}\right)=7,$ find ${h}^{\prime}\left(2\right).$

### The Chain Rule Using Leibniz’s Notation

As with other derivatives that we have seen, we can express the chain rule using Leibniz’s notation. This notation for the chain rule is used heavily in physics applications.

$\text{For}\phantom{\rule{0.2em}{0ex}}h\left(x\right)=f\left(g\left(x\right)\right),$ let $u=g(x)$ and $y=h\left(x\right)=f\left(u\right).$ Thus,

Consequently,

### Rule: Chain Rule Using Leibniz’s Notation

If $y$ is a function of $u,$ and $u$ is a function of $x,$ then

### Example 3.58

#### Taking a Derivative Using Leibniz’s Notation, Example 1

Find the derivative of $y={\left(\frac{x}{3x+2}\right)}^{5}.$

### Example 3.59

#### Taking a Derivative Using Leibniz’s Notation, Example 2

Find the derivative of $y=\text{tan}\phantom{\rule{0.1em}{0ex}}\left(4{x}^{2}-3x+1\right).$

Use Leibniz’s notation to find the derivative of $y=\text{cos}\phantom{\rule{0.1em}{0ex}}\left({x}^{3}\right).$ Make sure that the final answer is expressed entirely in terms of the variable $x.$

### Section 3.6 Exercises

For the following exercises, given $y=f(u)$ and $u=g\left(x\right),$ find $\frac{dy}{dx}$ by using Leibniz’s notation for the chain rule: $\frac{dy}{dx}=\frac{dy}{du}\phantom{\rule{0.2em}{0ex}}\frac{du}{dx}.$

$y=3u-6,u=2{x}^{2}$

$y=\text{sin}\phantom{\rule{0.1em}{0ex}}u,u=5x-1$

$y=\text{tan}\phantom{\rule{0.1em}{0ex}}u,u=9x+2$

For each of the following exercises,

- decompose each function in the form $y=f(u)$ and $u=g\left(x\right),$ and
- find $\frac{dy}{dx}$ as a function of $x.$

$y={\left(3x-2\right)}^{6}$

$y={\text{sin}}^{5}\left(x\right)$

$y=\text{tan}\phantom{\rule{0.1em}{0ex}}\left(\text{sec}\phantom{\rule{0.1em}{0ex}}x\right)$

$y={\text{cot}}^{2}x$

For the following exercises, find $\frac{dy}{dx}$ for each function.

$y={\left(3{x}^{2}+3x-1\right)}^{4}$

$y={\text{cos}}^{3}\left(\pi x\right)$

$y=\frac{1}{{\text{sin}}^{2}(x)}$

$y={\left(\text{tan}\phantom{\rule{0.1em}{0ex}}x+\text{sin}\phantom{\rule{0.1em}{0ex}}x\right)}^{\mathrm{-3}}$

$y={x}^{2}{\text{cos}}^{4}x$

$y=\sqrt{6+\text{sec}\phantom{\rule{0.1em}{0ex}}\pi {x}^{2}}$

Let $y={\left[f(x)\right]}^{2}$ and suppose that ${f}^{\prime}\left(1\right)=4$ and $\frac{dy}{dx}=10$ for $x=1.$ Find $f\left(1\right).$

Let $y={\left(f\left(x\right)+5{x}^{2}\right)}^{4}$ and suppose that $f\left(\mathrm{-1}\right)=\mathrm{-4}$ and $\frac{dy}{dx}=3$ when $x=\mathrm{-1}.$ Find ${f}^{\prime}\left(\mathrm{-1}\right)$

Let $y={\left(f\left(u\right)+3x\right)}^{2}$ and $u={x}^{3}-2x.$ If $f\left(4\right)=6$ and $\frac{dy}{dx}=18$ when $x=2,$ find ${f}^{\prime}\left(4\right).$

**[T]** Find the equation of the tangent line to $y=\text{\u2212}\text{sin}\phantom{\rule{0.1em}{0ex}}\left(\frac{x}{2}\right)$ at the origin. Use a calculator to graph the function and the tangent line together.

**[T]** Find the equation of the tangent line to $y={\left(3x+\frac{1}{x}\right)}^{2}$ at the point $\left(1,16\right).$ Use a calculator to graph the function and the tangent line together.

Find the $x$-coordinates at which the tangent line to $y={\left(x-\frac{6}{x}\right)}^{8}$ is horizontal.

**[T]** Find an equation of the line that is normal to $g(\theta )={\text{sin}}^{2}\left(\pi \theta \right)$ at the point $\left(\frac{1}{4},\frac{1}{2}\right).$ Use a calculator to graph the function and the normal line together.

For the following exercises, use the information in the following table to find ${h}^{\prime}(a)$ at the given value for $a.$

$x$ | $f(x)$ | $f\prime (x)$ | $g(x)$ | $g\prime (x)$ |
---|---|---|---|---|

0 | 2 | 5 | 0 | 2 |

1 | 1 | −2 | 3 | 0 |

2 | 4 | 4 | 1 | −1 |

3 | 3 | −3 | 2 | 3 |

$h\left(x\right)=g\left(f\left(x\right)\right);a=0$

$h(x)={\left(\frac{f(x)}{g(x)}\right)}^{2};a=3$

$h\left(x\right)={\left(1+g(x)\right)}^{3};a=2$

$h\left(x\right)=f\left(g\left(\text{sin}\phantom{\rule{0.1em}{0ex}}x\right)\right);a=0$

**[T]** The position function of a freight train is given by $s\left(t\right)=100{\left(t+1\right)}^{\mathrm{-2}},$ with $s$ in meters and $t$ in seconds. At time $t=6$ s, find the train’s

- velocity and
- acceleration.
- Using a. and b. is the train speeding up or slowing down?

**[T]** A mass hanging from a vertical spring is in simple harmonic motion as given by the following position function, where $t$ is measured in seconds and $s$ is in inches:

$s\left(t\right)=\mathrm{-3}\phantom{\rule{0.1em}{0ex}}\text{cos}\phantom{\rule{0.1em}{0ex}}\left(\pi t+\frac{\pi}{4}\right).$

- Determine the position of the spring at $t=1.5$ s.
- Find the velocity of the spring at $t=1.5$ s.

**[T]** The total cost to produce $x$ boxes of Thin Mint Girl Scout cookies is $C$ dollars, where $C=0.0001{x}^{3}-0.02{x}^{2}+3x+300.$ In $t$ weeks production is estimated to be $x=1600+100t$ boxes.

- Find the marginal cost ${C}^{\prime}\left(x\right).$
- Use Leibniz’s notation for the chain rule, $\frac{dC}{dt}=\frac{dC}{dx}\xb7\frac{dx}{dt},$ to find the rate with respect to time $t$ that the cost is changing.
- Use b. to determine how fast costs are increasing when $t=2$ weeks. Include units with the answer.

**[T]** The formula for the area of a circle is $A=\pi {r}^{2},$ where $r$ is the radius of the circle. Suppose a circle is expanding, meaning that both the area $A$ and the radius $r$ (in inches) are expanding.

- Suppose $r=2-\frac{100}{{\left(t+7\right)}^{2}}$ where $t$ is time in seconds. Use the chain rule $\frac{dA}{dt}=\frac{dA}{dr}\xb7\frac{dr}{dt}$ to find the rate at which the area is expanding.
- Use a. to find the rate at which the area is expanding at $t=4$ s.

**[T]** The formula for the volume of a sphere is $S=\frac{4}{3}\pi {r}^{3},$ where $r$ (in feet) is the radius of the sphere. Suppose a spherical snowball is melting in the sun.

- Suppose $r=\frac{1}{{\left(t+1\right)}^{2}}-\frac{1}{12}$ where $t$ is time in minutes. Use the chain rule $\frac{dS}{dt}=\frac{dS}{dr}\xb7\frac{dr}{dt}$ to find the rate at which the snowball is melting.
- Use a. to find the rate at which the volume is changing at $t=1$ min.

**[T]** The daily temperature in degrees Fahrenheit of Phoenix in the summer can be modeled by the function $T\left(x\right)=94-10\phantom{\rule{0.1em}{0ex}}\text{cos}\left[\frac{\pi}{12}\left(x-2\right)\right],$ where $x$ is hours after midnight. Find the rate at which the temperature is changing at 4 p.m.

**[T]** The depth (in feet) of water at a dock changes with the rise and fall of tides. The depth is modeled by the function $D\left(t\right)=5\phantom{\rule{0.1em}{0ex}}\text{sin}\phantom{\rule{0.1em}{0ex}}\left(\frac{\pi}{6}t-\frac{7\pi}{6}\right)+8,$ where $t$ is the number of hours after midnight. Find the rate at which the depth is changing at 6 a.m.