Active Calculus · 2: Computing Derivatives

2.5: The 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))C(x) = f(g(x)) that is built from differentiable functions ff and g,g\text{,} how do we compute C′(x)C'(x) in terms of f,f\text{,} g,g\text{,} f′,f'\text{,} and g′?g'\text{?} What is the statement of the Chain Rule?

In addition to learning how to differentiate a variety of basic functions, we have also been developing our ability to use rules to differentiate certain algebraic combinations of them.

Example 2.5.12.5.1

State the rule(s) to find the derivative of each of the following combinations of f(x)=sin⁡(x)f(x) = \sin(x) and g(x)=x2:g(x) = x^2\text{:}

s(x)=3x2−5sin⁡(x), s(x) = 3x^2 - 5\sin(x)\text{,}

p(x)=x2sin⁡(x),and p(x) = x^2 \sin(x), \text{and}

q(x)=sin⁡(x)x2. q(x) = \dfrac{\sin(x)}{x^2}\text{.}

Answer

Finding s′s' uses the sum and constant multiple rules, because s(x)=3g(x)−5f(x).s(x) = 3g(x) - 5f(x)\text{.} Determining p′p' requires the product rule, because p(x)=g(x)⋅f(x).p(x) = g(x) \cdot f(x)\text{.} To calculate q′q' we use the quotient rule, because q(x)=f(x)g(x).q(x) =\frac{f(x)}{g(x)}\text{.}

There is one more natural way to combine basic functions algebraically, and that is by composing them. For instance, let's consider the function

C(x)=sin⁡(x2), C(x) = \sin(x^2)\text{,}

and observe that any input xx passes through a chain of functions. In the process that defines the function C(x),C(x)\text{,} xx is first squared, and then the sine of the result is taken. Using an arrow diagram,

x⟶x2⟶sin⁡(x2). x \longrightarrow x^2 \longrightarrow \sin(x^2)\text{.}

In terms of the elementary functions ff and g,g\text{,} we observe that xx is the input for the function g,g\text{,} and the result is used as the input for f.f\text{.} We write

C(x)=f(g(x))=sin⁡(x2) C(x) = f(g(x)) = \sin(x^2)

and say that CC is the composition of ff and g.g\text{.} We will refer to g,g\text{,} the function that is first applied to x,x\text{,} as the inner function, while f,f\text{,} the function that is applied to the result, is the outer function.

Given a composite function C(x)=f(g(x))C(x) = f(g(x)) that is built from differentiable functions ff and g,g\text{,} how do we compute C′(x)C'(x) in terms of f,f\text{,} g,g\text{,} f′,f'\text{,} and g′?g'\text{?} In the same way that the rate of change of a product of two functions, p(x)=f(x)⋅g(x),p(x) = f(x) \cdot g(x)\text{,} depends on the behavior of both ff and g,g\text{,} it makes sense intuitively that the rate of change of a composite function C(x)=f(g(x))C(x) = f(g(x)) will also depend on some combination of ff and gg and their derivatives. The rule that describes how to compute C′C' in terms of ff and gg and their derivatives is called the chain rule.

But before we can learn what the chain rule says and why it works, we first need to be comfortable decomposing composite functions so that we can correctly identify the inner and outer functions, as we did in the example above with C(x)=sin⁡(x2).C(x) = \sin(x^2)\text{.}

Preview Activity 2.5.12.5.1

For each function given below, identify its fundamental algebraic structure. In particular, is the given function a sum, product, quotient, or composition of basic functions? If the function is a composition of basic functions, state a formula for the inner function gg and the outer function ff so that the overall composite function can be written in the form f(g(x)).f(g(x))\text{.} If the function is a sum, product, or quotient of basic functions, use the appropriate rule to determine its derivative.

  1. h(x)=tan⁡(2x)\displaystyle h(x) = \tan(2^x)
  2. p(x)=2xtan⁡(x)\displaystyle p(x) = 2^x \tan(x)
  3. r(x)=(tan⁡(x))2\displaystyle r(x) = (\tan(x))^2
  4. m(x)=etan⁡(x)\displaystyle m(x) = e^{\tan(x)}
  5. w(x)=x+tan⁡(x)\displaystyle w(x) = \sqrt{x} + \tan(x)
  6. z(x)=tan⁡(x)\displaystyle z(x) = \sqrt{\tan(x)}

Often a composite function cannot be written in an alternate algebraic form. For instance, the function C(x)=sin⁡(x2)C(x) = \sin(x^2) cannot be expanded or otherwise rewritten, so it presents no alternate approaches to taking the derivative. But some composite functions can be expanded or simplified, and these provide a way to explore how the chain rule works.

Example 2.5.22.5.2

Let f(x)=−4x+7f(x) = -4x + 7 and g(x)=3x−5.g(x) = 3x - 5\text{.} Determine a formula for C(x)=f(g(x))C(x) = f(g(x)) and compute C′(x).C'(x)\text{.} How is C′C' related to ff and gg and their derivatives?

Answer

By the rules given for ff and g,g\text{,}

C(x)=(f(g(x))=(f(3x−5)=(−4(3x−5)+7=(−12x+20+7=(−12x+27.\begin{align*} C(x) =\mathstrut & f(g(x))\\[4pt] =\mathstrut & f(3x-5)\\[4pt] =\mathstrut & -4(3x-5) + 7\\[4pt] =\mathstrut & -12x + 20 + 7\\[4pt] =\mathstrut & -12x + 27\text{.} \end{align*}

Thus, C′(x)=−12.C'(x) = -12\text{.} Noting that f′(x)=−4f'(x) = -4 and g′(x)=3,g'(x) = 3\text{,} we observe that C′C' appears to be the product of f′f' and g′.g'\text{.}

It may seem that Example 2.5.22.5.2 is too elementary to illustrate how to differentiate a composite function. Linear functions are the simplest of all functions, and composing linear functions yields another linear function. While this example does not illustrate the full complexity of a composition of nonlinear functions, at the same time we remember that any differentiable function is locally linear, and thus any function with a derivative behaves like a line when viewed up close. The fact that the derivatives of the linear functions ff and gg are multiplied to find the derivative of their composition turns out to be a key insight.

We now consider a composition involving a nonlinear function.

Example 2.5.32.5.3

Let C(x)=sin⁡(2x).C(x) = \sin(2x)\text{.} Use the double angle identity to rewrite CC as a product of basic functions, and use the product rule to find C′.C'\text{.} Rewrite C′C' in the simplest form possible.

Answer

Using the double angle identity for the sine function, we write

C(x)=sin⁡(2x)=2sin⁡(x)cos⁡(x). C(x) = \sin(2x) = 2\sin(x)\cos(x)\text{.}

Applying the product rule and simplifying, we find

C′(x)=2sin⁡(x)(−sin⁡(x))+cos⁡(x)(2cos⁡(x))=2(cos⁡2(x)−sin⁡2(x)). C'(x) = 2\sin(x)(-\sin(x)) + \cos(x)(2\cos(x)) = 2(\cos^2(x) - \sin^2(x))\text{.}

Next, we recall that the double angle identity for the cosine,

cos⁡(2x)=cos⁡2(x)−sin⁡2(x). \cos(2x) = \cos^2(x) - \sin^2(x)\text{.}

Substituting this result into our expression for C′(x),C'(x)\text{,} we now have that

C′(x)=2cos⁡(2x). C'(x) = 2 \cos(2x)\text{.}

In Example 2.5.32.5.3 , if we let g(x)=2xg(x) = 2x and f(x)=sin⁡(x),f(x) = \sin(x)\text{,} we observe that C(x)=f(g(x)).C(x) = f(g(x))\text{.} Now, g′(x)=2g'(x) = 2 and f′(x)=cos⁡(x),f'(x) = \cos(x)\text{,} so we can view the structure of C′(x)C'(x) as

C′(x)=2cos⁡(2x)=g′(x)f′(g(x)). C'(x) = 2\cos(2x) = g'(x) f'(g(x))\text{.}

In this example, as in the example involving linear functions, we see that the derivative of the composite function C(x)=f(g(x))C(x) = f(g(x)) is found by multiplying the derivatives of ff and g,g\text{,} but with f′f' evaluated at g(x).g(x)\text{.}

It makes sense intuitively that these two quantities are involved in the rate of change of a composite function: if we ask how fast CC is changing at a given xx value, it clearly matters how fast gg is changing at x,x\text{,} as well as how fast ff is changing at the value of g(x).g(x)\text{.} It turns out that this structure holds for all differentiable functions 1  as is stated in the Chain Rule.

Like other differentiation rules, the Chain Rule can be proved formally using the limit definition of the derivative.
Chain Rule

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

C′(x)=f′(g(x))g′(x). C'(x) = f'(g(x)) g'(x)\text{.}

As with the product and quotient rules, it is often helpful to think verbally about what the chain rule says: “If CC is a composite function defined by an outer function ff and an inner function g,g\text{,} then C′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 identify clearly the inner function gg and outer function f,f\text{,} compute their derivatives individually, and then put all of the pieces together by the chain rule.

Example 2.5.42.5.4

Determine the derivative of the function

r(x)=(tan⁡(x))2. r(x) = (\tan(x))^2\text{.}
Answer

The function rr is composite, with inner function g(x)=tan⁡(x)g(x) = \tan(x) and outer function f(x)=x2.f(x) = x^2\text{.} Organizing the key information involving f,f\text{,} g,g\text{,} and their derivatives, we have

f(x)=x2f(x) = x^2   g(x)=tan⁡(x)g(x) = \tan(x)
f′(x)=2xf'(x) = 2x   g′(x)=sec⁡2(x)g'(x) = \sec^2(x)
f′(g(x))=2tan⁡(x)f'(g(x)) = 2\tan(x)    

Applying the chain rule, we find that

r′(x)=f′(g(x))g′(x)=2tan⁡(x)sec⁡2(x). r'(x) = f'(g(x))g'(x) = 2\tan(x) \sec^2(x)\text{.}

As a side note, we remark that r(x)r(x) is usually written as tan⁡2(x).\tan^2(x)\text{.} This is common notation for powers of trigonometric functions: cos⁡4(x),\cos^4(x)\text{,} sin⁡5(x),\sin^5(x)\text{,} and sec⁡2(x)\sec^2(x) are all composite functions, with the outer function a power function and the inner function a trigonometric one.

Activity 2.5.22.5.2

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

  1. h(x)=cos⁡(x4)\displaystyle h(x) = \cos(x^4)
  2. p(x)=tan⁡(x)\displaystyle p(x) = \sqrt{ \tan(x) }
  3. s(x)=2sin⁡(x)\displaystyle s(x) = 2^{\sin(x)}
  4. z(x)=cot⁡5(x)\displaystyle z(x) = \cot^5(x)
  5. m(x)=(sec⁡(x)+ex)9\displaystyle m(x) = (\sec(x) + e^x)^9

Using 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.

Example 2.5.52.5.5

Find a formula for the derivative of h(t)=3t2+2tsec⁡4(t).h(t) = 3^{t^2 + 2t}\sec^4(t)\text{.}

Answer

We first observe that hh is the product of two functions: h(t)=a(t)⋅b(t),h(t) = a(t) \cdot b(t)\text{,} where a(t)=3t2+2ta(t) = 3^{t^2 + 2t} and b(t)=sec⁡4(t).b(t) = \sec^4(t)\text{.} We will need to use the product rule to differentiate h.h\text{.} And because aa and bb are composite functions, we will need the chain rule. We therefore begin by computing a′(t)a'(t) and b′(t).b'(t)\text{.}

Writing a(t)=f(g(t))=3t2+2t,a(t) = f(g(t)) = 3^{t^2 + 2t}\text{,} and finding the derivatives of ff and g,g\text{,} we have

f(t)=3tf(t) = 3^t   g(t)=t2+2tg(t) = t^2 + 2t
f′(t)=3tln⁡(3)f'(t) = 3^t \ln(3)   g′(t)=2t+2g'(t) = 2t+2
f′(g(t))=3t2+2tln⁡(3)f'(g(t)) = 3^{t^2 + 2t}\ln(3)    

Thus, by the chain rule, it follows that a′(t)=f′(g(t))g′(t)=3t2+2tln⁡(3)(2t+2).a'(t) = f'(g(t))g'(t) = 3^{t^2 + 2t}\ln(3) (2t+2)\text{.}

Turning next to b,b\text{,} we write b(t)=r(s(t))=sec⁡4(t)b(t) = r(s(t)) = \sec^4(t) and find the derivatives of rr and s.s\text{.}

r(t)=t4r(t) = t^4   s(t)=sec⁡(t)s(t) = \sec(t)
r′(t)=4t3r'(t) = 4t^3   s′(t)=sec⁡(t)tan⁡(t)s'(t) = \sec(t)\tan(t)
r′(s(t))=4sec⁡3(t)r'(s(t)) = 4\sec^3(t)    

By the chain rule,

b′(t)=r′(s(t))s′(t)=4sec⁡3(t)sec⁡(t)tan⁡(t)=4sec⁡4(t)tan⁡(t). b'(t) = r'(s(t))s'(t) = 4\sec^3(t)\sec(t)\tan(t) = 4 \sec^4(t) \tan(t)\text{.}

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

h′(t)=3t2+2tddt[sec⁡4(t)]+sec⁡4(t)ddt[3t2+2t]. h'(t) = 3^{t^2 + 2t} \frac{d}{dt}[\sec^4(t)] + \sec^4(t) \frac{d}{dt}[3^{t^2 + 2t}]\text{.}

From our work above with aa and b,b\text{,} we know the derivatives of 3t2+2t3^{t^2 + 2t} and sec⁡4(t),\sec^4(t)\text{,} and therefore

h′(t)=3t2+2t4sec⁡4(t)tan⁡(t)+sec⁡4(t)3t2+2tln⁡(3)(2t+2). h'(t) = 3^{t^2 + 2t} 4\sec^4(t) \tan(t) + \sec^4(t) 3^{t^2 + 2t}\ln(3) (2t+2)\text{.}
Activity 2.5.32.5.3

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

  1. p(r)=4r6+2er\displaystyle p(r) = 4\sqrt{r^6 + 2e^r}
  2. m(v)=sin⁡(v2)cos⁡(v3)\displaystyle m(v) = \sin(v^2) \cos(v^3)
  3. h(y)=cos⁡(10y)e4y+1\displaystyle h(y) = \frac{\cos(10y)}{e^{4y}+1}
  4. s(z)=2z2sec⁡(z)\displaystyle s(z) = 2^{z^2 \sec (z)}
  5. c(x)=sin⁡(ex2)\displaystyle c(x) = \sin(e^{x^2})

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, if the function under consideration is a composition, the chain rule is indispensable.

Activity 2.5.42.5.4

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=ex+3y= \sqrt{e^x + 3} at the point where x=0.x=0\text{.}
  2. If s(t)=1(t2+1)3\displaystyle s(t) = \frac{1}{(t^2+1)^3} represents the position function of a particle moving horizontally along an axis at time tt (where ss is measured in inches and tt in seconds), find the particle's instantaneous velocity at t=1.t=1\text{.} Is the particle moving to the left or right at that instant?
  3. At sea level, air pressure is 30 inches of mercury. At an altitude of hh feet above sea level, the air pressure, P,P\text{,} in inches of mercury, is given by the function P=30e−0.0000323h.P = 30 e^{-0.0000323 h}\text{.} Compute dP/dhdP/dh and explain what this derivative function tells you about air pressure, including a discussion of the units on dP/dh.dP/dh\text{.} In addition, determine how fast the air pressure is changing for a pilot of a small plane passing through an altitude of 10001000 feet.
  4. Suppose that f(x)f(x) and g(x)g(x) are differentiable functions and that the following information about them is known:
    Table 2.5.12.5.1 . Data for functions ff and g.g\text{.}
    xx f(x)f(x) f′(x)f'(x) g(x)g(x) g′(x)g'(x)
    −1-1 22 −5-5 −3-3 44
    22 −3-3 44 −1-1 22

    If C(x)C(x) is a function given by the formula f(g(x)),f(g(x))\text{,} determine C′(2).C'(2)\text{.} In addition, if D(x)D(x) is the function f(f(x)),f(f(x))\text{,} find D′(−1).D'(-1)\text{.}

The composite version of basic function rules

As we gain more experience with differentiation, we will become more comfortable in simply writing down the derivative without taking multiple steps. This is particularly simple when the inner function is linear, since the derivative of a linear function is a constant.

Example 2.5.62.5.6

Use the chain rule to differentiate each of the following composite functions whose inside function is linear:

ddx[(5x+7)10]=10(5x+7)9⋅5, \frac{d}{dx} \left[ (5x+7)^{10} \right] = 10(5x+7)^9 \cdot 5\text{,}

ddx[tan⁡(17x)]=17sec⁡2(17x), and \frac{d}{dx} \left[ \tan(17x) \right] = 17\sec^2(17x), \ \text{and}

ddx[e−3x]=−3e−3x. \frac{d}{dx} \left[ e^{-3x} \right] = -3e^{-3x}\text{.}

More generally, following is an excellent exercise for getting comfortable with the derivative rules. Write down a list of all the basic functions whose derivatives we know, and list the derivatives. Then write a composite function with the inner function being an unknown function u(x)u(x) and the outer function being a basic function. Finally, write the chain rule for the composite function. The following example illustrates this for two different functions.

Example 2.5.72.5.7

To determine

ddx[sin⁡(u(x))], \frac{d}{dx}[\sin(u(x))]\text{,}

where uu is a differentiable function of x,x\text{,} we use the chain rule with the sine function as the outer function. Applying the chain rule, we find that

ddx[sin⁡(u(x))]=cos⁡(u(x))⋅u′(x). \frac{d}{dx}[\sin(u(x))] = \cos(u(x)) \cdot u'(x)\text{.}

This rule is analogous to the basic derivative rule that ddx[sin⁡(x)]=cos⁡(x).\frac{d}{dx}[\sin(x)] = \cos(x)\text{.}

Similarly, since ddx[ax]=axln⁡(a),\frac{d}{dx}[a^x] = a^x \ln(a)\text{,} it follows by the chain rule that

ddx[au(x)]=au(x)ln⁡(a)⋅u′(x). \frac{d}{dx}[a^{u(x)}] = a^{u(x)} \ln(a) \cdot u'(x)\text{.}

This rule is analogous to the basic derivative rule that ddx[ax]=axln⁡(a).\frac{d}{dx}[a^{x}] = a^{x} \ln(a)\text{.}

Summary

  • A composite function is one where the input variable xx first passes through one function, and then the resulting output passes through another. For example, the function h(x)=2sin⁡(x)h(x) = 2^{\sin(x)} is composite since x⟶sin⁡(x)⟶2sin⁡(x).x \longrightarrow \sin(x) \longrightarrow 2^{\sin(x)}\text{.}
  • Given a composite function C(x)=f(g(x))C(x) = f(g(x)) where ff and gg are differentiable functions, the chain rule tells us that
    C′(x)=f′(g(x))g′(x). C'(x) = f'(g(x)) g'(x)\text{.}

Credit and licence

This page titled 2.5: The Chain Rule was last modified on Wed, 09 Nov 2022 05:46:35 GMT and is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew Boelkins, David Austin, and Steven Schlicker ( ScholarWorks @Grand Valley State University ) via source content that was edited to the style and standards of the LibreTexts platform.

Source: https://math.libretexts.org/Bookshelves/Calculus/Active_Calculus_(Boelkins_et_al.)/02%3A_Computing_Derivatives/2.05%3A_The_Chain_Rule

Licence: CC BY-SA 4.0 (creativecommons.org/licenses/by-sa/4.0/). You may share and adapt it under the same licence, with this credit. WorldClass adapted the formatting only: the text is the authors', with interactive parts and links to other sites left out.

Build status · Flash Infinity AI™ is a trademark of AI-Flash Inc.. WorldClass is not affiliated with, approved or accredited by any exam board, curriculum provider or university unless a page says so.