Skip to main content
\(\newcommand{\dollar}{\$} \DeclareMathOperator{\erf}{erf} \DeclareMathOperator{\arctanh}{arctanh} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section2.7The Chain Rule

Motivating Questions
  • What is a composite function and how do we recognize its structure algebraically?

  • Given a composite function \(C(x) = f(g(x))\) that is built from differentiable functions \(f\) and \(g\text{,}\) how do we compute \(C'(x)\) in terms of \(f\text{,}\) \(g\text{,}\) \(f'\text{,}\) and \(g'\text{?}\) What is the statement of the Chain Rule?

In this section we will consider composite functions.

SubsectionComposition of Functions

We encounter composite functions in the real world every day. As an example, suppose you and some friends are driving from Lincoln, NE to Omaha, NE. Once you arrive in Omaha you drive around the city to see all the beautiful sites. We know that Omaha is 60 miles away from Lincoln, and for each hour spent in Omaha, you drive an additional 5 miles. Then the function

\begin{equation*} m(x)=60+5x \end{equation*}

represents the miles traveled if you and your friends spend \(x\) hours in Omaha.

Now, suppose gas for your vehicle costs $0.15 per mile. We can represent this knowledge with the function

\begin{equation*} c(m)=.15m \end{equation*}

where \(m\) is in miles. If we want to know how much you and your friends will spend on gas during your trip if you spend \(x\) hours in Omaha, we can now use these two functions we created. If you spend \(x\) hours in Omaha, you will have traveled \(60+5x\) miles. The cost of gas is \(.15m\) where \(m\) is miles. Then we need only replace \(m\) by \(60+5x\) to get

\begin{equation*} .15(60+5x) \end{equation*}

as the cost of gas if you spend \(x\) hours in Omaha.

In function notation, we write this as follows:

\begin{equation*} c(f(x))=.15f(x)=.15(60+5x). \end{equation*}

Here we are evaluating the function \(c(m)\) at the value \(f(x)\) since \(f(x)\) is the number of miles traveled. The function \(c(f(x))\) is called a composite function, or a composition of functions.

Example2.61

Given the functions \(f(x)=x^2-2x \) and \(g(x)=.5 x\text{,}\) identify the function \(f(g(x))\) and find the value of \(f(g(1))\text{.}\)

Solution

First, let's find the function \(f(g(x))\text{.}\) To identify this function, we are plugging in \(.5x\) for \(x\) in the function \(f(x)=x^2-2x\text{.}\) We get the function

\begin{equation*} f(g(x))=f(.5x)=(.5x)^2-2(.5x)=.25x^2-x. \end{equation*}

Now, to find the value \(f(g(1))\) we simply evaluate the function \(f(g(x))\) at \(1\text{.}\) We have

\begin{equation*} f(g(1))=.25(1)^2-1=.25-1=-.75. \end{equation*}

Looking back at our first example, from the functions \(m(x)=60+5x\) and \(c(m)=.15m\) we created the new function

\begin{equation*} c(m(x))=.15(60+5x). \end{equation*}

Notice that this composition of functions, \(c(m(x))\text{,}\) has time in hours as its input and cost as its output.

In general, given two functions \(f(x)\) and \(g(x)\text{,}\) the composition \(f(g(x))\) has the same input as \(g \text{,}\) but has the same output as \(f \text{.}\)

Composing Functions

Given two functions \(f(x)\) and \(g(x)\text{,}\) the composition \(f(g(x))\) has the same input as \(g \text{,}\) but has the same output as \(f \text{.}\)

Subsection

First let us consider why we need another derivative rule.

Example2.62

Consider the function

\begin{equation*} f(x) = (x^2+3x)^2\text{,} \end{equation*}

in order to take the derivative we would have to rewrite this as a product of two functions:

\begin{equation*} f(x) = (x^2+3x)^2=(x^2+3x)(x^2+3x)\text{,} \end{equation*}

and then use the product rule to find the derivative

\begin{equation*} f'(x) = (2x+3)(x^2+3x)+(x^2+3x)(2x+3)=2(x^2+3x)(2x+3)\text{.} \end{equation*}
When we have a composite function we could try to rewrite as we did in Example2.62; however, often this is very hard. For example:

\begin{equation*} r(x) = (x^2+3x)^{70}\text{,} \end{equation*}

we would not want to distribute 70 times, or apply the product rule to the product of 70 functions. We need a rule for finding the derivative of composite functions without using algebra to rewrite.

SubsectionThe Chain Rule

Chain Rule

If \(g\) is differentiable at \(x\) and \(f\) is differentiable at \(g(x)\text{,}\) then the composite function \(C\) defined by \(C(x) = f(g(x))\) is differentiable at \(x\) and

\begin{equation*} C'(x) = f'(g(x)) g'(x)\text{.} \end{equation*}

As with the product and quotient rules, it is often helpful to think verbally about what the chain rule says: If \(C\) is a composite function defined by an outer function \(f\) and an inner function \(g\text{,}\) then \(C'\) is given by the derivative of the outer function evaluated at the inner function, times the derivative of the inner function.

It is helpful to clearly identify the inner function \(g\) and outer function \(f\text{,}\) compute their derivatives individually, and then put all of the pieces together by the chain rule.

Example2.63

Use the chain rule to determine the derivative of the function

\begin{equation*} r(x) = (x^2+3x)^{70}\text{.} \end{equation*}

First we want to identify an inside function. Here the inside function is:

\begin{equation*} \text{inside function=} g(x) = x^2+3x\text{.} \end{equation*}

Once you have found an inside function, what is left is the outside function, here:

\begin{equation*} \text{outside function= }f(x) = x^{70} \text{.} \end{equation*}

Then we apply the chain rule by taking the derivative of the outside function, with the inside unchanged, then multiply by the derivative of the inside:

\begin{equation*} r'(x)=70(x^2+3x)^{69}(2x+3)\text{.} \end{equation*}
Example2.64

For each function given below, identify an inner function \(g\) and outer function \(f\) to write the function in the form \(f(g(x))\text{.}\) Determine \(f'(x)\text{,}\) \(g'(x)\text{,}\) and \(f'(g(x))\text{,}\) and then apply the chain rule to determine the derivative of the given function.

  1. \(\displaystyle h(x) = (2x^2+5x)^4\)

  2. \(\displaystyle g(x) = 3(x^3+4x)^9\)

  3. \(\displaystyle p(x) = \sqrt{ 5x^2+7x+2}\)

  4. \(\displaystyle s(x) = \frac{2}{(x^3+5)^2}\)

  5. \(\displaystyle z(x) = \frac{1}{\sqrt{x^2+4}}\)

Answer
  1. \(\displaystyle h'(x) = 4(2x^2+5x)^3(4x+5)\text{.}\)

  2. \(\displaystyle g'(x) = 27(x^3+4x)^8(3x^2+4x)\text{.}\)

  3. \(\displaystyle p'(x) = \frac12(5x^2+7x+2)^{-1/2}(10x+7)=\frac{10x+7}{2\sqrt{5x^2+7x+2}}\text{.}\)

  4. \(\displaystyle s'(x) = -4(x^3+5)^{-3}(3x^2)=\frac{-12x^2}{(x^3+5)^3}\text{.}\)

  5. \(\displaystyle z'(x) = \frac{-1}{2}(x^2+4)^{-3/2}(2x)=\frac{-x}{(x^2+4)^{3/2}}\text{.}\)

Solution
  1. The outer function is \(f(x) = x^4\) while the inner function is \(g(x) = 2x^2+5x\text{.}\) We know that

    \begin{equation*} f'(x) = 4x^3, g'(x) =4x+5\text{.} \end{equation*}

    Hence by the chain rule,

    \begin{equation*} h'(x) = f'(g(x))g'(x) = 4(2x^2+5x)^3(4x+5)\text{.} \end{equation*}
  2. The outer function is \(f(x) = 3x^9\) and the inner function is \(g(x) = x^3+4x\text{.}\) We know that

    \begin{equation*} f'(x) = 27x^8, g'(x) = 3x^2+4\text{.} \end{equation*}

    Thus by the chain rule,

    \begin{equation*} h'(x) = f'(g(x))g'(x) = 27(x^3+4x)^8(3x^2+4)\text{.} \end{equation*}
  3. The outer function is \(f(x) = \sqrt{x}=x^{1/2}\) while the inner function is \(g(x) = 5x^2+7x+2\text{.}\) We know that

    \begin{equation*} f'(x) = \frac{1}{2}x^{-1/2}, g'(x) = 10x+7\text{.} \end{equation*}

    Thus by the chain rule,

    \begin{equation*} p'(x) = f'(g(x))g'(x) = \frac12(5x^2+7x+2)^{-1/2}(10x+7)=\frac{10x+7}{2\sqrt{5x^2+7x+2}}\text{.} \end{equation*}
  4. The outer function is \(\displaystyle f(x) =\frac{2}{x^2}=2x^{-2}\) and the inner function is \(g(x) = x^3+5\text{.}\) We know that

    \begin{equation*} s'(x) = -4x^{-3}=\frac{-4}{x^3}, g'(x) = 3x^2\text{.} \end{equation*}

    Hence by the chain rule,

    \begin{equation*} h'(x) = f'(g(x))g'(x) = -4(x^3+5)^{-3}(3x^2)=\frac{-12x^2}{(x^3+5)^3}\text{.} \end{equation*}
  5. The outer function is \(\displaystyle f(x) = \frac{1}{\sqrt{x}}=x^{-1/2}\) and the inner function is \(g(x) = x^2+4\text{.}\) We know that

    \begin{equation*} f'(x) = \frac{-1}{2}x^{-3/2}=\frac{-1}{2x^{3/2}}, g'(x) =2x\text{.} \end{equation*}

    Hence by the chain rule,

    \begin{equation*} z'(x) = f'(g(x))g'(x) = \frac{-1}{2}(x^2+4)^{-3/2}(2x)=\frac{-x}{(x^2+4)^{3/2}}\text{.} \end{equation*}

SubsectionUsing Multiple Rules Simultaneously

The chain rule now joins the sum, constant multiple, product, and quotient rules in our collection of techniques for finding the derivative of a function through understanding its algebraic structure and the basic functions that constitute it. It takes practice to get comfortable applying multiple rules to differentiate a single function, but using proper notation and taking a few extra steps will help.

Example2.65

Find a formula for the derivative of \(h(t) = \sqrt{t^2 + 2t}(3t^4+6t)^5\text{.}\)

We first observe that \(h\) is the product of two functions: \(h(t) = a(t) \cdot b(t)\text{,}\) where \(a(t) = \sqrt{t^2 + 2t}\) and \(b(t) = (3t^4+6t)^5\text{.}\) We will need to use the product rule to differentiate \(h\text{.}\) And because \(a\) and \(b\) are composite functions, we will also need the chain rule. We therefore begin by computing \(a'(t)\) and \(b'(t)\text{.}\)

Writing \(a(t) = f(g(t)) = \sqrt{t^2+2t}\) and finding the derivatives of \(f\) and \(g\) with respect to \(t\text{,}\) we have

\(f(t) = \sqrt{t}\text{,}\) \(g(t) = t^2 + 2t\text{,}\)
\(f'(t) = \frac{1}{2}t^{-1/2}\text{,}\) \(g'(t) = 2t+2\text{,}\)
\(f'(g(t)) = \frac{1}{2(t^2+2t)^{1/2}}\text{.}\)

Thus by the chain rule, it follows that

\begin{equation*} a'(t) = f'(g(t))g'(t) = \frac{1}{2(t^2+2t)^{1/2}} (2t+2)=\frac{t+1}{\sqrt{t^2+2t}}\text{.} \end{equation*}

Turning next to the function \(b\text{,}\) we write \(b(t) = r(s(t)) = (3t^2+6t)^5 \) and find the derivatives of \(r\) and \(s\) with respect to \(t\text{.}\)

\(r(t) = t^5\text{,}\) \(s(t) = 3t^2+6t \text{,}\)
\(r'(t) = 5t^4\text{,}\) \(s'(t) = 6t+6\text{,}\)
\(r'(s(t)) = 5(3t^2+6t)^4\text{.}\)

By the chain rule,

\begin{equation*} \end{equation*}

Now we are finally ready to compute the derivative of the function \(h\text{.}\) Recalling that \(h(t) = \sqrt{t^2 + 2t}(3t^4+6t)^5\text{,}\) by the product rule we have

\begin{equation*} h'(t) = \frac{d}{dt}\left[\sqrt{t^2 + 2t}\right](3t^4+6t)^5+\sqrt{t^2 + 2t} \frac{d}{dt}\left[(3t^4+6t)^5\right] \text{.} \end{equation*}

From our work above with \(a\) and \(b\text{,}\) we know the derivatives of \(\sqrt{t^2 + 2t}\) and \((3t^4+6t)^5\text{.}\) Therefore

\begin{equation*} h'(t) =\frac{t+1}{\sqrt{t^2+2t}}(3t^4+6t)^5 + \sqrt{t^2 + 2t} 5(3t^2+6t)^4(6t+6) \text{.} \end{equation*}

The above calculation may seem tedious. However, by breaking the function down into small parts and calculating derivatives of those parts separately, we are able to accurately calculate the derivative of the entire function.

Example2.66

Differentiate each of the following functions. State the rule(s) you use, label relevant derivatives appropriately, and be sure to clearly identify your overall answer.

  1. \(p(x) = 4x^2\sqrt{x^6 + 2x}\)

  2. \(\displaystyle m(x) = \frac{x}{(x^2+2)^2}\)

  3. \(\displaystyle h(x) = \frac{\sqrt{3x^2+5x}}{4x+3}\)

  4. \(c(x) = 4(x^4+5x)^7(7x^3+5x)^5\)

Answer
  1. \(p'(x) = 8x\sqrt{x^6+2x}+4x^2\frac{3x^5+1}{\sqrt{x^6+2x}}\text{.}\)

  2. \(m'(x) = \frac{(x^2+2)^2-x2(x^2+2)(2x)}{(x^2+2)^4}\text{.}\)

  3. \(m'(x) = \frac{0.5(3x^2+5x)^{-1/2}(6x+5)(4x+3)-\sqrt{3x^2+5x}(4)}{(4x+3)^2}\text{.}\)

  4. \(h'(x) = [28(x^4+5x)^6(4x^3+5)](7x^3+5x)^5+4(x^4+5x)^7[5(7x^3+5x)^4(21x^2+5)]\text{.}\)

Solution
  1. By the product rule,

    \begin{equation*} \displaystyle p'(x) = \frac{d}{dx}\left[4x^2\right]\sqrt{x^6 + 2x}+4x^2\frac{d}{dx}\left[\sqrt{x^6 + 2x}\right]\text{.} \end{equation*}

    Using the chain rule to complete the second derivative as

    \begin{equation*} \frac{d}{dx}\left[\sqrt{x^6 + 2x}\right]=\frac{1}{2}(x^6+2x)^{-1/2}(6x^5+2)=\frac{3x^5+1}{\sqrt{x^6+2x}}\text{.} \end{equation*}

    Then put together, we see that

    \begin{equation*} p'(x) = 8x\sqrt{x^6+2x}+4x^2\frac{3x^5+1}{\sqrt{x^6+2x}}\text{.} \end{equation*}
  2. Observe that by the quotient rule,

    \begin{equation*} \displaystyle m'(x) = \frac{\frac{d}{dx}\left[x\right](x^2+2)^2-x\frac{d}{dx}\left[(x^2+2)^2\right]}{((x^2+2)^2)^2}\text{.} \end{equation*}

    Applying the chain rule to differentiate

    \begin{equation*} \frac{d}{dx}\left[(x^2+2)^2\right]=2(x^2+2)(2x) \end{equation*}

    Then put together, we see that

    \begin{equation*} m'(x) = \frac{(x^2+2)^2-x2(x^2+2)(2x)}{(x^2+2)^4}\text{.} \end{equation*}
  3. By the quotient rule,

    \begin{equation*} h'(y) = \frac{\frac{d}{dx}[\sqrt{3x^2+5x}](4x+3) - \sqrt{3x^2+5x} \frac{d}{dx}[(4x+3)]}{(4x+3)^2}\text{.} \end{equation*}

    Applying the chain rule to differentiate

    \begin{equation*} \frac{d}{dx}[\sqrt{3x^2+5x}]=\frac12(3x^2+5x)^{-1/2}(6x+5)=\frac{6x+5}{2\sqrt{3x^2+5x}}\text{,} \end{equation*}

    it follows that

    \begin{equation*} h'(x) =\frac{0.5(3x^2+5x)^{-1/2}(6x+5)(4x+3)-\sqrt{3x^2+5x}(4)}{(4x+3)^2}\text{.} \end{equation*}
  4. By the product rule

    \begin{equation*} h'(x)=\frac{d}{dx}\left[4(x^4+5x)^7\right](7x^3+5x)^5+4(x^4+5x)^7\frac{d}{dx}\left[(7x^3+5x)^5\right]\text{.} \end{equation*}

    Use the chain rule to find each derivative:

    \begin{equation*} \frac{d}{dx}\left[4(x^4+5x)^7\right]=28(x^4+5x)^6(4x^3+5) \end{equation*}

    and

    \begin{equation*} \frac{d}{dx}\left[(7x^3+5x)^5\right]=5(7x^3+5x)^4(21x^2+5)\text{.} \end{equation*}

    Then with the product rule, we find that

    \begin{equation*} h'(x) = [28(x^4+5x)^6(4x^3+5)](7x^3+5x)^5+4(x^4+5x)^7[5(7x^3+5x)^4(21x^2+5)]\text{.} \end{equation*}

The chain rule now adds substantially to our ability to compute derivatives. Whether we are finding the equation of the tangent line to a curve, the instantaneous velocity of a moving particle, or the instantaneous rate of change of a certain quantity, the chain rule is indispensable if the function under consideration is a composition.

Example2.67

Use known derivative rules (including the chain rule) as needed to answer each of the following questions.

  1. Find an equation for the tangent line to the curve \(y= \sqrt{x^3 +x+ 4}\) at the point where \(x=0\text{.}\)

  2. If \(\displaystyle s(t) = \frac{1}{(t^2+1)^3}\) represents the position function of a particle moving horizontally along an axis at time \(t\) (where \(s\) is measured in inches and \(t\) in seconds), find the particle's instantaneous velocity at \(t=1\text{.}\) Is the particle moving to the left or right at that instant?6You may assume that this axis is like a number line, with left being the negative direction, and right being the positive direction.

Answer
  1. \(y - 2 = \frac{1}{4}(x-0)\text{.}\)

  2. \(s'(1) = -\frac{3}{8}\) inches per second, so the particle is moving left at the instant \(t = 1\text{.}\)

Solution
  1. Let \(f(x) = \sqrt{x^3 + 4}\text{.}\) By the chain rule, \(\displaystyle f'(x) = \frac{1}{2} (x^3+x+4)^{-1/2}(3x^2+1)\text{,}\) and thus \(f'(0) = \frac{1}{4}\text{.}\) Note further that \(f(0) = \sqrt{4} = 2\text{.}\) The tangent line is therefore the line through \((0,2)\) with slope \(\frac{1}{4}\text{,}\) which is

    \begin{equation*} y - 2 = \frac{1}{4}(x-0)\text{.} \end{equation*}
  2. Observe that \(s(t) = (t^2 + 1)^{-3}\text{,}\) and thus by the chain rule, \(s'(t) = -3(t^2 + 1)^{-4}(2t)\text{.}\) We therefore see that \(s'(1) = -\frac{6}{16} = -\frac{3}{8}\) inches per second, so the particle is moving left at the instant \(t = 1\text{.}\)

SubsectionSummary

  • Given a composite function \(C(x) = f(g(x))\) where \(f\) and \(g\) are differentiable functions, the chain rule tells us that

    \begin{equation*} C'(x) = f'(g(x)) g'(x)\text{.} \end{equation*}

SubsectionExercises

Consider the basic functions \(f(x) = x^3\) and \(g(x) = \sin(x)\text{.}\)

  1. Let \(h(x) = f(g(x))\text{.}\) Find the exact instantaneous rate of change of \(h\) at the point where \(x = \frac{\pi}{4}\text{.}\)

  2. Which function is changing most rapidly at \(x = 0.25\text{:}\) \(h(x) = f(g(x))\) or \(r(x) = g(f(x))\text{?}\) Why?

  3. Let \(h(x) = f(g(x))\) and \(r(x) = g(f(x))\text{.}\) Which of these functions has a derivative that is periodic? Why?

Let functions \(p\) and \(q\) be the piecewise linear functions given by their respective graphs in Figure2.68. Use the graphs to answer the following questions.

Figure2.68The graphs of \(p\) (in blue) and \(q\) (in green).
  1. Let \(C(x) = p(q(x))\text{.}\) Determine \(C'(0)\) and \(C'(3)\text{.}\)

  2. Find a value of \(x\) for which \(C'(x)\) does not exist. Explain your thinking.

  3. Let \(Y(x) = q(q(x))\) and \(Z(x) = q(p(x))\text{.}\) Determine \(Y'(-2)\) and \(Z'(0)\text{.}\)

If a spherical tank of radius 4 feet has \(h\) feet of water present in the tank, then the volume of water in the tank is given by the formula

\begin{equation*} V = \frac{\pi}{3} h^2(12-h)\text{.} \end{equation*}
  1. At what instantaneous rate is the volume of water in the tank changing with respect to the height of the water at the instant \(h = 1\text{?}\) What are the units on this quantity?

  2. Now suppose that the height of water in the tank is being regulated by an inflow and outflow (e.g., a faucet and a drain) so that the height of the water at time \(t\) is given by the rule \(h(t) = \sin(\pi t) + 1\text{,}\) where \(t\) is measured in hours (and \(h\) is still measured in feet). At what rate is the height of the water changing with respect to time at the instant \(t = 2\text{?}\)

  3. Continuing under the assumptions in (b), at what instantaneous rate is the volume of water in the tank changing with respect to time at the instant \(t = 2\text{?}\)

  4. What are the main differences between the rates found in (a) and (c)? Include a discussion of the relevant units.