If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Chain rule

AP.CALC:
FUN‑3 (EU)
,
FUN‑3.C (LO)
,
FUN‑3.C.1 (EK)
The chain rule tells us how to find the derivative of a composite function. Brush up on your knowledge of composite functions, and learn how to apply the chain rule correctly.
The chain rule says:
start fraction, d, divided by, d, x, end fraction, open bracket, f, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis, close bracket, equals, f, prime, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis, g, prime, left parenthesis, x, right parenthesis
It tells us how to differentiate composite functions.

Quick review of composite functions

A function is composite if you can write it as f, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis. In other words, it is a function within a function, or a function of a function.
For example, start color #1fab54, cosine, left parenthesis, end color #1fab54, start color #e07d10, x, squared, end color #e07d10, start color #1fab54, right parenthesis, end color #1fab54 is composite, because if we let start color #1fab54, f, left parenthesis, x, right parenthesis, equals, cosine, left parenthesis, x, right parenthesis, end color #1fab54 and start color #e07d10, g, left parenthesis, x, right parenthesis, equals, x, squared, end color #e07d10, then start color #1fab54, cosine, left parenthesis, end color #1fab54, start color #e07d10, x, squared, end color #e07d10, start color #1fab54, right parenthesis, end color #1fab54, equals, start color #1fab54, f, left parenthesis, end color #1fab54, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #1fab54, right parenthesis, end color #1fab54.
start color #e07d10, g, end color #e07d10 is the function within start color #1fab54, f, end color #1fab54, so we call start color #e07d10, g, end color #e07d10 the "inner" function and start color #1fab54, f, end color #1fab54 the "outer" function.
start color #1fab54, start underbrace, cosine, left parenthesis, space, start color #e07d10, start overbrace, x, squared, end overbrace, start superscript, start text, i, n, n, e, r, end text, end superscript, space, end color #e07d10, right parenthesis, end underbrace, start subscript, start text, o, u, t, e, r, end text, end subscript, end color #1fab54
On the other hand, cosine, left parenthesis, x, right parenthesis, dot, x, squared is not a composite function. It is the product of f, left parenthesis, x, right parenthesis, equals, cosine, left parenthesis, x, right parenthesis and g, left parenthesis, x, right parenthesis, equals, x, squared, but neither of the functions is within the other one.
Problem 1
Is g, left parenthesis, x, right parenthesis, equals, natural log, left parenthesis, sine, left parenthesis, x, right parenthesis, right parenthesis a composite function? If so, what are the "inner" and "outer" functions?
Choose 1 answer:
Choose 1 answer:

Common mistake: Not recognizing whether a function is composite or not

Usually, the only way to differentiate a composite function is using the chain rule. If we don't recognize that a function is composite and that the chain rule must be applied, we will not be able to differentiate correctly.
On the other hand, applying the chain rule on a function that isn't composite will also result in a wrong derivative.
Especially with transcendental functions (e.g., trigonometric and logarithmic functions), students often confuse compositions like natural log, left parenthesis, sine, left parenthesis, x, right parenthesis, right parenthesis with products like natural log, left parenthesis, x, right parenthesis, sine, left parenthesis, x, right parenthesis.
Problem 2
Is h, left parenthesis, x, right parenthesis, equals, cosine, squared, left parenthesis, x, right parenthesis a composite function? If so, what are the "inner" and "outer" functions?
Choose 1 answer:
Choose 1 answer:

Want more practice? Try this exercise.

Common mistake: Wrong identification of the inner and outer function

Even when a student recognized that a function is composite, they might get the inner and the outer functions wrong. This will surely end in a wrong derivative.
For example, in the composite function cosine, squared, left parenthesis, x, right parenthesis, the outer function is x, squared and the inner function is cosine, left parenthesis, x, right parenthesis. Students are often confused by this sort of function and think that cosine, left parenthesis, x, right parenthesis is the outer function.

Worked example of applying the chain rule

Let's see how the chain rule is applied by differentiating h, left parenthesis, x, right parenthesis, equals, left parenthesis, 5, minus, 6, x, right parenthesis, start superscript, 5, end superscript. Notice that h is a composite function:
h(x)=( 56xinner )5outerg(x)=56xinner functionf(x)=x5outer function\begin{aligned} h(x) &= \greenD{\underbrace{(~\goldD{\overbrace{5-6x}^{\text{inner}}~})^5}_{\text{outer}}} \\\\ \goldD{g(x)}&=\goldD{5-6x} &&\text{inner function} \\\\ \greenD{f(x)}&=\greenD{x^5}&&\text{outer function} \end{aligned}
Because h is composite, we can differentiate it using the chain rule:
start fraction, d, divided by, d, x, end fraction, open bracket, start color #1fab54, f, left parenthesis, end color #1fab54, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #1fab54, right parenthesis, end color #1fab54, close bracket, equals, start color #11accd, f, prime, left parenthesis, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, right parenthesis, end color #11accd, dot, start color #ca337c, g, prime, left parenthesis, x, right parenthesis, end color #ca337c
Described verbally, the rule says that the derivative of the composite function is the inner function start color #e07d10, g, end color #e07d10 within the derivative of the outer function start color #11accd, f, prime, end color #11accd, multiplied by the derivative of the inner function start color #ca337c, g, prime, end color #ca337c.
Before applying the rule, let's find the derivatives of the inner and outer functions:
g(x)=6f(x)=5x4\begin{aligned} \maroonD{g'(x)}&=\maroonD{-6} \\\\ \blueD{f'(x)}&=\blueD{5x^4} \end{aligned}
Now let's apply the chain rule:
ddx[f(g(x))]=f(g(x))g(x)=5(56x)46=30(56x)4\begin{aligned} &\dfrac{d}{dx}\left[f\Bigl(g(x)\Bigr)\right] \\\\ =&\blueD{f'\Bigl(\goldD{g(x)}\Bigr)}\cdot\maroonD{g'(x)} \\\\ =&\blueD{5(\goldD{5-6x})^4} \cdot \maroonD{-6} \\\\ =&-30(5-6x)^4 \end{aligned}

Practice applying the chain rule

Problem 3.A
Problem set 3 will walk you through the steps of differentiating sine, left parenthesis, 2, x, cubed, minus, 4, x, right parenthesis.
What are the inner and outer functions in sine, left parenthesis, 2, x, cubed, minus, 4, x, right parenthesis?
Choose 1 answer:
Choose 1 answer:

Problem 4
start fraction, d, divided by, d, x, end fraction, open bracket, square root of, cosine, left parenthesis, x, right parenthesis, end square root, close bracket, equals, question mark
Choose 1 answer:
Choose 1 answer:

Want more practice? Try this exercise.
Problem 5
xf, left parenthesis, x, right parenthesish, left parenthesis, x, right parenthesisf, prime, left parenthesis, x, right parenthesish, prime, left parenthesis, x, right parenthesis
minus, 19minus, 1minus, 5minus, 6
23minus, 116
G, left parenthesis, x, right parenthesis, equals, f, left parenthesis, h, left parenthesis, x, right parenthesis, right parenthesis
G, prime, left parenthesis, 2, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Want more practice? Try this exercise.
Problem 6
Katy tried to find the derivative of left parenthesis, 2, x, squared, minus, 4, right parenthesis, cubed. Here is her work:
Step 1: Let start color #1fab54, f, left parenthesis, x, right parenthesis, equals, x, cubed, end color #1fab54 and start color #e07d10, g, left parenthesis, x, right parenthesis, equals, 2, x, squared, minus, 4, end color #e07d10, then start color #1fab54, left parenthesis, end color #1fab54, start color #e07d10, 2, x, squared, minus, 4, end color #e07d10, start color #1fab54, right parenthesis, cubed, end color #1fab54, equals, start color #1fab54, f, left parenthesis, end color #1fab54, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #1fab54, right parenthesis, end color #1fab54.
Step 2: start color #11accd, f, prime, left parenthesis, x, right parenthesis, equals, 3, x, squared, end color #11accd
Step 3: The derivative is start color #11accd, f, prime, left parenthesis, end color #11accd, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #11accd, right parenthesis, end color #11accd:
start fraction, d, divided by, d, x, end fraction, open bracket, start color #1fab54, left parenthesis, end color #1fab54, start color #e07d10, 2, x, squared, minus, 4, end color #e07d10, start color #1fab54, right parenthesis, cubed, end color #1fab54, close bracket, equals, start color #11accd, 3, left parenthesis, end color #11accd, start color #e07d10, 2, x, squared, minus, 4, end color #e07d10, start color #11accd, right parenthesis, squared, end color #11accd
Is Katy's work correct? If not, what's her mistake?
Choose 1 answer:
Choose 1 answer:

Common mistake: Forgetting to multiply by the derivative of the inner function

A common mistake is for students to only differentiate the outer function, which results in f, prime, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis, while the correct derivative is f, prime, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis, g, prime, left parenthesis, x, right parenthesis.

Another common mistake: Computing f, prime, left parenthesis, g, prime, left parenthesis, x, right parenthesis, right parenthesis

Another common mistake is to differentiate f, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis as the composition of the derivatives, f, prime, left parenthesis, g, prime, left parenthesis, x, right parenthesis, right parenthesis.
This is also incorrect. The function that should be inside of f, prime, left parenthesis, x, right parenthesis is g, left parenthesis, x, right parenthesis, not g, prime, left parenthesis, x, right parenthesis.
Remember: The derivative of start color #1fab54, f, left parenthesis, end color #1fab54, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #1fab54, right parenthesis, end color #1fab54 is start color #11accd, f, prime, left parenthesis, end color #11accd, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #11accd, right parenthesis, end color #11accd, start color #ca337c, g, prime, left parenthesis, x, right parenthesis, end color #ca337c. Not start color #11accd, f, prime, left parenthesis, end color #11accd, start color #e07d10, g, left parenthesis, x, right parenthesis, end color #e07d10, start color #11accd, right parenthesis, end color #11accd and not start color #11accd, f, prime, left parenthesis, end color #11accd, start color #ca337c, g, prime, left parenthesis, x, right parenthesis, end color #ca337c, start color #11accd, right parenthesis, end color #11accd.

Want to join the conversation?

  • blobby green style avatar for user jade jericho
    On Problem 2. I chose the answer "not a composite function" because i took cos^2(x) to be cos(x)*cos(x) and hence used the product rule to differentiate. Is that okay?
    (26 votes)
    Default Khan Academy avatar avatar for user
  • starky sapling style avatar for user 20leunge
    Why is it called the chain rule?
    (10 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user vishnuprashanth.cvi
    Can someone kindly help me on how to differentiate (x-11)^3 / (x+3) using the chain rule?
    TIA
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      You'll need quotient or product rule in addition to the chain rule.

      First let's find the derivative of (x-11)³. Outer function is x³, inner function is x-11. So we take
      d/dx((x-11)³)
      d/(x-11) (x-11)³ •d/dx (x-11)
      3(x-11)²•1
      3(x-11)²

      Now, the derivative of x+3 is just 1. Putting these together with the quotient rule, we get
      d/dx ((x-11)³/(x+3))
      [(x+3)•d/dx(x-11)³ -(x-11)³•d/dx(x+3)]/((x+3)²)
      Substitute the derivatives that we know and we get
      [(x+3)•3(x-11)² -(x-11)³•1]/((x+3)²)
      This is our answer. To simplify, we can factor an (x-11)² out of the numerator and get
      (x-11)²•(3x+9 -(x-11))/((x+3)²)
      (x-11)²•(2x+20)/((x+3)²)
      (11 votes)
  • piceratops ultimate style avatar for user Anto Q
    Why are sin(x), cos(x), etc, called transcendental functions?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user Ryan
    Why is the derivative of 3x = 3, but the derivative of 3(sin x) = 3(cos x)?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • starky tree style avatar for user Hmcoyle
    This is great. Is there an article showing the chain rule when there are more than 2 functions in a composite?
    (0 votes)
    Default Khan Academy avatar avatar for user
  • piceratops seed style avatar for user Hima Praveen
    how do you know when to use chain rule?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • female robot ada style avatar for user Revant Sai T
    Can you please make a video on how to find the minimum value of 2^sin(x) + 2^cos(x). Also, what is the inner function and outer function for 2^sin(x)??
    Thanks, any help would be appreciated
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Alex
      While the AM-GM inequality is useful, I'm just going to do it as a standard optimization problem.

      Because you asked, inner function is sin(x) and outer function is 2^x.

      f(x) = 2^(sin x) + 2^(cos x)
      f'(x) = ln(2) * 2^(sin x) * cos x - ln(2) * 2^(cos x) * sin x
      This is undefined nowhere, so we look for points where f'(x) = 0, or 2^(sin x) cos x = 2^(cos x) sin x; this expression is (essentially) equivalent to sin(x) = cos(x), which is true at pi/4 + k * pi.
      The minimum value of f should be at 5pi/4, where (sin x, cos x) = (-sqrt(2) / 2, -sqrt(2) / 2).

      min(f(x)) = f(5pi / 4 + 2pi * k) = 1.225.
      (4 votes)
  • leaf orange style avatar for user COLLIN0250
    Is e^2x a composite function and how would you use the chain rule for this?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user Andrzej Olsen
      Yes, e^(2x) is a composite function.

      The inner function, better seen by the parentheses I drew above, is 2x, and the outer function is e^x. Let's now write out the derivatives of both functions.

      d/dx(e^x) = e^x
      d/dx(2x) = 2

      This is the chain rule:

      d/dx(f(g(x))) = f'(g(x)) * g'(x)

      Since we know that e^x is the outer function and 2x is the inner function, we can plug those in using the derivatives we found earlier.

      d/dx(e^(2x)) = e^(2x) * 2

      Just swapping some stuff around now:

      d/dx(e^(2x)) = 2e^(2x)

      Hopefully I explained this well, chain rule is one of those things I have a hard time putting into words. I know this looks pretty complicated, but with practice it should slowly start to become second nature to you!
      (3 votes)
  • hopper jumping style avatar for user Pedro Ivan Pimenta Fagundes
    what is the derivative of f(x)=tan'¹(x) ?
    tan'¹(x) is atan(x);
    (1 vote)
    Default Khan Academy avatar avatar for user