Processing math: 76%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

3.6: The Chain Rule

( \newcommand{\kernel}{\mathrm{null}\,}\)

Learning Objectives
  • State the chain rule for the composition of two functions.
  • Apply the chain rule together with the power rule.
  • Apply the chain rule and the product/quotient rules correctly in combination when both are necessary.
  • Recognize the chain rule for a composition of three or more functions.
  • Describe the proof of the chain rule.

We have seen the techniques for differentiating basic functions (xn,sinx,cosx, 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(x)=sin(x3) or k(x)=3x2+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(x)=sin(x3). We can think of the derivative of this function with respect to x as the rate of change of sin(x3) relative to the change in x. Consequently, we want to know how sin(x3) changes as x changes. We can think of this event as a chain reaction: As x changes, x3 changes, which leads to a change in sin(x3). This chain reaction gives us hints as to what is involved in computing the derivative of sin(x3). First of all, a change in x forcing a change in x3 suggests that somehow the derivative of x3 is involved. In addition, the change in x3 forcing a change in sin(x3) suggests that the derivative of sin(u) with respect to u, where u=x3, is also part of the final derivative.

We can take a more formal look at the derivative of h(x)=sin(x3) by setting up the limit that would give us the derivative at a specific value a in the domain of h(x)=sin(x3).

h(a)=limxasin(x3)sin(a3)xa

This expression does not seem particularly helpful; however, we can modify it by multiplying and dividing by the expression x3a3 to obtain

h(a)=limxasin(x3)sin(a3)x3a3x3a3xa.

From the definition of the derivative, we can see that the second factor is the derivative of x3 at x=a. That is,

limxax3a3xa=ddx(x3)|x=a=3a2.

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=x3 and observing that as xa,ua3:

limxasin(x3)sin(a3)x3a3=limua3sinusin(a3)ua3=ddu(sinu)|u=a3=cos(a3).

Thus, h(a)=cos(a3)3a2.

In other words, if h(x)=sin(x3), then h(x)=cos(x3)3x2. Thus, if we think of h(x)=sin(x3) as the composition (fg)(x)=f(g(x)) where f(x)=sinx and g(x)=x3, then the derivative of h(x)=sin(x3) is the product of the derivative of g(x)=x3 and the derivative of the function f(x)=sinx evaluated at the function g(x)=x3. At this point, we anticipate that for h(x)=sin(g(x)), it is quite likely that h(x)=cos(g(x))g(x). As we determined above, this is the case for h(x)=sin(x3).

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(x), the derivative of the composite function

h(x)=(fg)(x)=f(g(x))

is given by

h(x)=f(g(x))g(x).

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

dydx=dydududx.

Problem-Solving Strategy: Applying the Chain Rule
  1. To differentiate h(x)=f(g(x)), begin by identifying f(x) and g(x).
  2. Find f(x) and evaluate it at g(x) to obtain f(g(x)).
  3. Find g(x).
  4. Write h(x)=f(g(x))g(x).

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(x)=(g(x))n, we need to use the chain rule combined with the power rule. To do so, we can think of h(x)=(g(x))n as f(g(x)) where f(x)=xn. Then f(x)=nxn1. Thus, f(g(x))=n(g(x))n1. This leads us to the derivative of a power function using the chain rule,

h(x)=n(g(x))n1g(x)

Rule: Power Rule for Composition of Functions (General Power Rule)

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

h(x)=(g(x))n,

Then

h(x)=n(g(x))n1g(x).

Example 3.6.1: Using the Chain and Power Rules

Find the derivative of h(x)=1(3x2+1)2.

Solution

First, rewrite h(x)=1(3x2+1)2=(3x2+1)2.

Applying the power rule with g(x)=3x2+1, we have

h(x)=2(3x2+1)36x.

Rewriting back to the original form gives us

h(x)=12x(3x2+1)3

Exercise 3.6.1

Find the derivative of h(x)=(2x3+2x1)4.

Hint

Use the General Power Rule (Equation ???) with g(x)=2x3+2x1.

Answer

h(x)=4(2x3+2x1)3(6x2+2)=8(3x2+1)(2x3+2x1)3

Example 3.6.2: Using the Chain and Power Rules with a Trigonometric Function

Find the derivative of h(x)=sin3x.

Solution

First recall that sin3x=(sinx)3, so we can rewrite h(x)=sin3x as h(x)=(sinx)3.

Applying the power rule with g(x)=sinx, we obtain

h(x)=3(sinx)2cosx=3sin2xcosx.

Example 3.6.3: Finding the Equation of a Tangent Line

Find the equation of a line tangent to the graph of h(x)=1(3x5)2 at x=2.

Solution

Because we are finding an equation of a line, we need a point. The x-coordinate of the point is 2. To find the y-coordinate, substitute 2 into h(x). Since h(2)=1(3(2)5)2=1, the point is (2,1).

For the slope, we need h(2). To find h(x), first we rewrite h(x)=(3x5)2 and apply the power rule to obtain

h(x)=2(3x5)3(3)=6(3x5)3.

By substituting, we have h(2)=6(3(2)5)3=6.

Therefore, the line has equation y1=6(x2). Rewriting, the equation of the line is y=6x+13.

Exercise 3.6.2

Find the equation of the line tangent to the graph of f(x)=(x22)3 at x=2.

Hint

Use the preceding example as a guide.

Answer

y=48x88

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.6.4: Using the Chain Rule on a General Cosine Function

Find the derivative of h(x)=cos(g(x)).

Solution

Think of h(x)=cos(g(x)) as f(g(x)) where f(x)=cosx. Since f(x)=sinx, we have f(g(x))=sin(g(x)). Then we do the following calculation.

h(x)=f(g(x))g(x)Apply the chain rule.=sin(g(x))g(x)Substitutef(g(x))=sin(g(x)).

Thus, the derivative of h(x)=cos(g(x)) is given by h(x)=sin(g(x))g(x).

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

Example 3.6.5: Using the Chain Rule on a Cosine Function

Find the derivative of h(x)=cos(5x2).

Solution

Let g(x)=5x2. Then g(x)=10x. Using the result from the previous example,

h(x)=sin(5x2)10x=10xsin(5x2)

Example 3.6.6: Using the Chain Rule on Another Trigonometric Function

Find the derivative of h(x)=sec(4x5+2x).

Solution

Apply the chain rule to h(x)=sec(g(x)) to obtain

h(x)=sec(g(x))tan(g(x))g(x).

In this problem, g(x)=4x5+2x, so we have g(x)=20x4+2. Therefore, we obtain

h(x)=sec(4x5+2x)tan(4x5+2x)(20x4+2)=(20x4+2)sec(4x5+2x)tan(4x5+2x).

Exercise 3.6.3

Find the derivative of h(x)=sin(7x+2).

Hint

Apply the chain rule to h(x)=sin(g(x)) first and then use g(x)=7x+2.

Answer

h(x)=7cos(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 the examples above. 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,

ddx(sin(g(x)))=cos(g(x))g(x) ddx(sinu)=cosududx
ddx(cos(g(x)))=sin(g(x))g(x) ddx(cosu)=sinududx
ddx(tan(g(x)))=sec2(g(x))g(x) ddx(tanu)=sec2ududx
ddx(cot(g(x)))=csc2(g(x))g(x) ddx(cotu)=csc2ududx
ddx(sec(g(x)))=sec(g(x))tan(g(x))g(x) ddx(secu)=secutanududx
ddx(csc(g(x)))=csc(g(x))cot(g(x))g(x) ddx(cscu)=cscucotududx.
Example 3.6.7: Combining the Chain Rule with the Product Rule

Find the derivative of h(x)=(2x+1)5(3x2)7.

Solution

First apply the product rule, then apply the chain rule to each term of the product.

h(x)=ddx((2x+1)5)(3x2)7+ddx((3x2)7)(2x+1)5Apply the product rule.=5(2x+1)42(3x2)7+7(3x2)63(2x+1)5Apply the chain rule.=10(2x+1)4(3x2)7+21(3x2)6(2x+1)5Simplify.=(2x+1)4(3x2)6(10(3x2)+21(2x+1))Factor out (2x+1)4(3x2)6=(2x+1)4(3x2)6(72x+1)Simplify.

Exercise 3.6.4

Find the derivative of h(x)=x(2x+3)3.

Hint

Start out by applying the quotient rule. Remember to use the chain rule to differentiate the denominator.

Answer

h(x)=34x(2x+3)4

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

k(x)=h(f(g(x))).

Then, applying the chain rule once we obtain

k(x)=ddx(h(f(g(x))))=h(f(g(x)))ddx(f(g(x))).

Applying the chain rule again, we obtain

k(x)=h(f(g(x)))f(g(x))g(x).

Rule: Chain Rule for a Composition of Three Functions

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

k(x)=h(f(g(x))),

then

k(x)=h(f(g(x)))f(g(x))g(x).

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.6.8: Differentiating a Composite of Three Functions

Find the derivative of k(x)=cos4(7x2+1).

Solution

First, rewrite k(x) as

k(x)=(cos(7x2+1))4.

Then apply the chain rule several times.

k(x)=4(cos(7x2+1))3ddx(cos(7x2+1))Apply the chain rule.=4(cos(7x2+1))3(sin(7x2+1))ddx(7x2+1)Apply the chain rule.=4(cos(7x2+1))3(sin(7x2+1))(14x)Apply the chain rule.=56xsin(7x2+1)cos3(7x2+1)Simplify

Exercise \PageIndex{5}

Find the derivative of h(x)=\sin^6(x^3).

Hint

Rewrite h(x)=\sin^6(x^3)=\big(\sin(x^3)\big)^6 and use Example \PageIndex{8} as a guide.

Answer

h'(x)=18x^2\sin^5(x^3)\cos(x^3)

Example \PageIndex{9}: Using the Chain Rule in a Velocity Problem

A particle moves along a coordinate axis. Its position at time t is given by s(t)=\sin(2t)+\cos(3t). What is the velocity of the particle at time t=\dfrac{π}{6}?

Solution

To find v(t), the velocity of the particle at time t, we must differentiate s(t). Thus,

v(t)=s'(t)=2\cos(2t)−3\sin(3t).\nonumber

Proof of Chain Rule

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(x)≠g(a) for x≠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'(a):

h'(a)=\lim_{x→a}\dfrac{f\big(g(x)\big)−f\big(g(a)\big)}{x−a}. \nonumber

Rewriting, we obtain

h'(a)=\lim_{x→a}\dfrac{f\big(g(x)\big)−f\big(g(a)\big)}{g(x)−g(a)}⋅\dfrac{g(x)−g(a)}{x−a}. \nonumber

Although it is clear that

\lim_{x→a}\dfrac{g(x)−g(a)}{x−a}=g'(a), \nonumber

it is not obvious that

\lim_{x→a}\dfrac{f\big(g(x)\big)−f\big(g(a)\big)}{g(x)−g(a)}=f'\big(g(a)\big). \nonumber

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

\lim_{x→a}g(x)=g(a). \nonumber

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

\lim_{x→a}\dfrac{f\big(g(x)\big)−f \big(g(a) \big)}{g(x)−g(a)}=\lim_{y→b}\dfrac{f(y)−f(b)}{y−b}=f'(b)=f'\big(g(a)\big). \nonumber

Finally,

h'(a)=\lim_{x→a}\dfrac{f\big(g(x)\big)−f\big(g(a)\big )}{g(x)−g(a)}⋅\dfrac{g(x)−g(a)}{x−a}=f'\big(g(a)\big)\cdot g'(a). \nonumber

Example \PageIndex{10}: Using the Chain Rule with Functional Values

Let h(x)=f\big(g(x)\big). If g(1)=4,g'(1)=3, and f'(4)=7, find h'(1).

Solution

Use the chain rule, then substitute.

\begin{align*} h'(1)&=f'\big(g(1)\big)\cdot g'(1) & & \text{Apply the chain rule.} \\[4pt] &=f'(4)⋅3 & &\text{Substitute}\; g(1)=4 \;\text{and}\;g'(1)=3. \\[4pt] &=7⋅3 & &\text{Substitute}\; f'(4)=7. \\[4pt] &=21 & &\text{Simplify.} \end{align*} \nonumber

Exercise \PageIndex{6}

Given h(x)=f(g(x)). If g(2)=−3,g'(2)=4, and f'(−3)=7, find h'(2).

Hint

Follow Example \PageIndex{10}.

Answer

28

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.

For h(x)=f(g(x)), let u=g(x) and y=h(x)=f(u). Thus,

h'(x)=\dfrac{dy}{dx}\nonumber

f'(g(x))=f'(u)=\dfrac{dy}{du}\nonumber

and

g'(x)=\dfrac{du}{dx}.\nonumber

Consequently,

\dfrac{dy}{dx}=h'(x)=f'\big(g(x)\big)\cdot g'(x)=\dfrac{dy}{du}⋅\dfrac{du}{dx}.\nonumber

Rule: Chain Rule Using Leibniz’s Notation

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

\dfrac{dy}{dx}=\dfrac{dy}{du}⋅\dfrac{du}{dx}. \nonumber

Example \PageIndex{11}: Taking a Derivative Using Leibniz’s Notation I

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

Solution

First, let u=\dfrac{x}{3x+2}. Thus, y=u^5. Next, find \dfrac{du}{dx} and \dfrac{dy}{du}. Using the quotient rule,

\dfrac{du}{dx}=\dfrac{2}{(3x+2)^2}

and

\dfrac{dy}{du}=5u^4.

Finally, we put it all together.

\begin{align*} \dfrac{dy}{dx}&=\dfrac{dy}{du}⋅\dfrac{du}{dx} & & \text{Apply the chain rule.}\\[4pt] &=5u^4⋅\dfrac{2}{(3x+2)^2} & & \text{Substitute}\; \frac{dy}{du}=5u^4\;\text{and}\;\frac{du}{dx}=\frac{2}{(3x+2)^2}. \\[4pt] &=5\left(\dfrac{x}{3x+2}\right)^4⋅\dfrac{2}{(3x+2)^2} & & \text{Substitute}\; u=\frac{x}{3x+2}. \\[4pt] &=\dfrac{10x^4}{(3x+2)^6} & & \text{Simplify.} \end{align*}

It is important to remember that, when using the Leibniz form of the chain rule, the final answer must be expressed entirely in terms of the original variable given in the problem.

Example \PageIndex{12}: Taking a Derivative Using Leibniz’s Notation II

Find the derivative of y=\tan(4x^2−3x+1).

Solution

First, let u=4x^2−3x+1. Then y=\tan u. Next, find \dfrac{du}{dx} and \dfrac{dy}{du}:

\dfrac{du}{dx}=8x−3 and \dfrac{dy}{du}=\text{sec}^2u.

Finally, we put it all together.

\begin{align*} \dfrac{dy}{dx}&=\dfrac{dy}{du}⋅\dfrac{du}{dx} & & \text{Apply the chain rule.} \\[4pt] &=\text{sec}^2u⋅(8x−3) & & \text{Use}\;\dfrac{du}{dx}=8x−3\;\text{and}\;\dfrac{dy}{du}=\text{sec}^2u. \\[4pt] &=\text{sec}^2(4x^2−3x+1)⋅(8x−3) & & \text{Substitute}\;u=4x^2−3x+1. \end{align*} \nonumber

Exercise \PageIndex{7}

Use Leibniz’s notation to find the derivative of y=\cos(x^3). Make sure that the final answer is expressed entirely in terms of the variable x.

Hint

Let u=x^3.

Answer

\dfrac{dy}{dx}=−3x^2\sin(x^3).

Key Concepts

  • The chain rule allows us to differentiate compositions of two or more functions. It states that for h(x)=f\big(g(x)\big),

h'(x)=f'\big(g(x)\big)\cdot g'(x).

In Leibniz’s notation this rule takes the form

\dfrac{dy}{dx}=\dfrac{dy}{du}⋅\dfrac{du}{dx}.

  • We can use the chain rule with other rules that we have learned, and we can derive formulas for some of them.
  • The chain rule combines with the power rule to form a new rule:

If h(x)=\big(g(x)\big)^n, then h'(x)=n\big(g(x)\big)^{n−1}\cdot g'(x).

  • When applied to the composition of three functions, the chain rule can be expressed as follows: If h(x)=f\Big(g\big(k(x)\big)\Big), then h'(x)=f'\Big(g\big(k(x)\big)\Big)\cdot g'\big(k(x)\big)\cdot k'(x).

Key Equations

  • The chain rule

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

  • The power rule for functions

h'(x)=n\big(g(x)\big)^{n−1}\cdot g'(x)

Glossary

chain rule
the chain rule defines the derivative of a composite function as the derivative of the outer function evaluated at the inner function times the derivative of the inner function

This page titled 3.6: The Chain Rule is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Zoya Kravets via source content that was edited to the style and standards of the LibreTexts platform.

  • Was this article helpful?

Support Center

How can we help?