Chain rule: Differentiating Composite Functions

By Vegard Gjerde Based on Masterful Learning 9 min read
derivative-chain-rule calculus derivatives math learning-strategies

The chain rule lets you differentiate a composite function f(g(x))f(g(x)) by multiplying the outer derivative f(g(x))f'(g(x)) by the inner derivative g(x)g'(x) — provided both ff and gg are differentiable at the relevant points. Move selection means recognizing a genuine composition and checking both differentiability conditions before applying the rule. Building that recognition automatically is a core goal of the Unisium Study System.

Unisium hero image titled Chain rule showing the principle equation d/dx f(g(x)) = f'(g(x)) g'(x) and a conditions card.
The chain rule ddxf(g(x))=f(g(x))g(x)\frac{d}{dx} f(g(x)) = f'(g(x))\, g'(x) under conditions “f differentiable at g(x); g differentiable at x”.

On this page: The Principle | Conditions | Failure Modes | EE Questions | Retrieval Practice | Practice Ground | Solve a Problem | Related Principles | FAQ


The Principle

The move: Differentiate a composite function f(g(x))f(g(x)) by evaluating the outer derivative at the inner function, then multiplying by the derivative of the inner function.

The invariant: This produces an expression equal to the derivative of f(g(x))f(g(x)) — the outer-then-inner multiplication correctly captures how the composition’s rate of change depends on both layers.

Pattern: ddxf(g(x))f(g(x))g(x)\frac{d}{dx} f(g(x)) \quad\longrightarrow\quad f'(g(x))\, g'(x)

Legal ✓Illegal ✗
ddxsin(x2)=cos(x2)2x\dfrac{d}{dx}\sin(x^2) = \cos(x^2)\cdot 2x — outer sin\sin differentiable everywhere; condition holdsddxx21x=1↛x21x212xx=1\dfrac{d}{dx}\lvert x^2-1\rvert\big\rvert_{x=1} \not\to \dfrac{x^2-1}{\lvert x^2-1\rvert}\cdot 2x\big\rvert_{x=1} — this attempted chain-rule move differentiates u\lvert u\rvert at u=0u=0, where the outer derivative does not exist

At x=1x=1, the inner value is g(1)=0g(1) = 0, and the outer function f(u)=uf(u)=\lvert u\rvert is not differentiable at u=0u=0. The composition looks eligible, but the attempted move fails exactly at the condition check.


Conditions of Applicability

Condition: f differentiable at g(x); g differentiable at x

Both layers of the composition must be differentiable: the inner function gg must have a derivative at xx, and the outer function ff must have a derivative at g(x)g(x) — the output of the inner function at that point.

Before applying, check: identify the outer function ff and inner function gg; confirm that gg is differentiable at xx and that ff is differentiable at the value g(x)g(x) produces.

If the condition is violated: the chain rule cannot be applied at that point — the expression may still have a derivative via another route, or it may be non-differentiable.

  • When gg is not differentiable at xx (for example, x|x| at x=0x=0), the chain rule cannot be applied from that layer outward.
  • When ff is not differentiable at g(x)g(x) (for example, f(u)=uf(u) = |u| when g(x)=0g(x) = 0), the chain rule cannot be applied — even if the composite expression happens to have a limit elsewhere.

Want the complete framework behind this guide? Read Masterful Learning.


Common Failure Modes

Failure mode: differentiate the outer function at the inner value but omit the factor g(x)g'(x) → the result is wrong by a missing multiplicative factor; for non-linear gg, the missing factor is never 11, so the error is always visible in the final answer.

Debug: after writing f(g(x))f'(g(x)), ask “have I multiplied by the inner derivative?” If the inner function is anything other than the bare variable xx, a factor g(x)1g'(x) \neq 1 is present and must appear.


Elaborative Encoding

Use these questions to build deep understanding. (See Elaborative Encoding for the full method.)

Within the Principle

  • Why does the chain rule multiply by g(x)g'(x) rather than add it or apply ff'' instead?
  • What does “differentiable at g(x)g(x)” mean precisely — why does the outer function’s differentiability depend on the inner function’s output value rather than on xx directly?

For the Principle

  • How do you recognize, when examining an expression, that it is a composition requiring the chain rule rather than a product or sum?
  • What changes about the procedure when the inner function gg is itself a composite of a third function?

Between Principles

  • How does the chain rule differ from the product rule, and how does the composition structure from function composition tell you that f(g(x))f(g(x)) is an input-nesting relationship rather than a product f(x)g(x)f(x) \cdot g(x)?

Generate an Example

  • Describe a composite function where the outer function is continuous but not differentiable at the exact value that the inner function produces at some point x=ax = a. Explain why the chain rule fails there but the function itself is still defined.

Retrieval Practice

Answer from memory, then click to reveal and check. (See Retrieval Practice for the full method.)

State the chain rule in one sentence: _____Differentiate the outer function at the inner function, then multiply by the inner function's derivative: f'(g(x)) times g'(x).
Write the canonical chain rule pattern: _____ddxf(g(x))=f(g(x))g(x)\frac{d}{dx} f(g(x)) = f'(g(x)) g'(x)
State the canonical condition: _____f differentiable at g(x); g differentiable at x

Practice Ground

Use these exercises to build move-selection fluency. (See Self-Explanation for how to use worked examples effectively.)

Procedure Walkthrough

Starting from h(x)=sin(x3+1)h(x) = \sin(x^3 + 1), compute h(x)h'(x).

Outer: f(u)=sinuf(u) = \sin u, differentiable everywhere. Inner: g(x)=x3+1g(x) = x^3 + 1, differentiable everywhere. Both conditions hold.

StepExpressionOperation
0ddxsin(x3+1)\dfrac{d}{dx}\sin(x^3+1)
1cos(x3+1)ddx(x3+1)\cos(x^3+1)\cdot\dfrac{d}{dx}(x^3+1)Chain rule: outer sinucosu\sin u \to \cos u evaluated at inner; inner derivative written as a separate factor
2cos(x3+1)(ddxx3+ddx1)\cos(x^3+1)\cdot\left(\dfrac{d}{dx}x^3 + \dfrac{d}{dx}1\right)Sum rule on the inner derivative: differentiate each term of x3+1x^3+1 separately
3cos(x3+1)(3x2+0)\cos(x^3+1)\cdot(3x^2 + 0)Power rule on x3x^3 and constant rule on 11
43x2cos(x3+1)3x^2\cos(x^3+1)Simplify the inner derivative and collect the product

Drills

Format A: Forward step

Apply the chain rule to find the derivative.


Apply the chain rule to differentiate (5x32)4(5x^3 - 2)^4.

Reveal

Outer f(u)=u4f(u) = u^4 (differentiable everywhere), inner g(x)=5x32g(x) = 5x^3 - 2 (differentiable everywhere). Both conditions hold.

ddx(5x32)4=4(5x32)315x2=60x2(5x32)3\frac{d}{dx}(5x^3-2)^4 = 4(5x^3-2)^3 \cdot 15x^2 = 60x^2(5x^3-2)^3


Apply the chain rule to differentiate ex2e^{x^2}.

Reveal

Outer f(u)=euf(u) = e^u (differentiable everywhere), inner g(x)=x2g(x) = x^2 (differentiable everywhere).

ddxex2=ex22x\frac{d}{dx}e^{x^2} = e^{x^2} \cdot 2x


Determine whether the chain rule can be applied to differentiate x29|x^2 - 9| at x=3x = 3. If it cannot, explain why.

Reveal

The chain rule cannot be applied at x=3x = 3.

The outer function f(u)=uf(u) = |u| is NOT differentiable at u=0u = 0. The inner value is g(3)=329=0g(3) = 3^2 - 9 = 0. Condition fails: ff is not differentiable at g(3)g(3).

The chain rule requires ff to be differentiable at g(x)g(x) — that requirement is violated here.


Apply the chain rule to differentiate ln(4x+1)\ln(4x + 1) for x>14x > -\tfrac{1}{4}.

Reveal

Outer f(u)=lnuf(u) = \ln u (differentiable for u>0u > 0), inner g(x)=4x+1>0g(x) = 4x+1 > 0 for x>14x > -\tfrac{1}{4}. Both conditions hold.

ddxln(4x+1)=14x+14=44x+1\frac{d}{dx}\ln(4x+1) = \frac{1}{4x+1} \cdot 4 = \frac{4}{4x+1}


Apply the chain rule to differentiate cos(2x3)\cos(2x^3).

Reveal

Outer f(u)=cosuf(u) = \cos u (differentiable everywhere), inner g(x)=2x3g(x) = 2x^3 (differentiable everywhere).

ddxcos(2x3)=sin(2x3)6x2\frac{d}{dx}\cos(2x^3) = -\sin(2x^3) \cdot 6x^2


Apply the chain rule to differentiate 3x2+1\sqrt{3x^2 + 1}.

Reveal

Rewrite as (3x2+1)1/2(3x^2+1)^{1/2}. Outer f(u)=u1/2f(u) = u^{1/2} (differentiable for u>0u > 0), inner g(x)=3x2+1>0g(x) = 3x^2+1 > 0 everywhere.

ddx(3x2+1)1/2=12(3x2+1)1/26x=3x3x2+1\frac{d}{dx}(3x^2+1)^{1/2} = \tfrac{1}{2}(3x^2+1)^{-1/2} \cdot 6x = \frac{3x}{\sqrt{3x^2+1}}


Format B: Action label

Identify the rule applied, or spot the error in the proposed step.


What rule was applied — and why is it valid — in the step below?

ddx(x2+3)5    5(x2+3)42x\frac{d}{dx}(x^2+3)^5 \;\longrightarrow\; 5(x^2+3)^4 \cdot 2x

Reveal

Chain rule. Outer f(u)=u5f(u) = u^5 (differentiable everywhere) differentiated at inner g(x)=x2+3g(x) = x^2+3, giving 5(x2+3)45(x^2+3)^4. Multiplied by inner derivative g(x)=2xg'(x) = 2x. Both differentiability conditions hold everywhere.


Which of the following expressions require the chain rule to differentiate? Identify all that do.

(a) x3cosxx^3 \cdot \cos x   (b) cos(x3)\cos(x^3)   (c) ex+x2e^x + x^2   (d) ex2e^{x^2}

Reveal

(b) and (d) require the chain rule — both are composite functions with a non-trivial inner function.

  • (a) is a product of two functions of xx: use the power rule and product rule.
  • (b) cos(x3)\cos(x^3): outer cosu\cos u, inner x3x^3 — chain rule required.
  • (c) is a sum of elementary functions: use the sum rule plus standard derivatives directly.
  • (d) ex2e^{x^2}: outer eue^u, inner x2x^2 — chain rule required.

Identify the error in the proposed differentiation below.

ddxsin(x4)    cos(x4)\frac{d}{dx}\sin(x^4) \;\longrightarrow\; \cos(x^4)

Reveal

The inner derivative factor is missing. The chain rule requires multiplying the outer derivative cos(x4)\cos(x^4) by g(x)=4x3g'(x) = 4x^3. The correct step is:

ddxsin(x4)=cos(x4)4x3\frac{d}{dx}\sin(x^4) = \cos(x^4) \cdot 4x^3


Label what happened in the transition below. State the outer function, the inner function, and the inner derivative used.

(2x+1)3Step 0    3(2x+1)22Step 1\underbrace{(2x+1)^3}_{\text{Step 0}} \;\longrightarrow\; \underbrace{3(2x+1)^2 \cdot 2}_{\text{Step 1}}

Reveal

Chain rule applied with:

  • Outer f(u)=u3f(u) = u^3, so f(u)=3u2f'(u) = 3u^2, evaluated at g(x)=2x+1g(x) = 2x+1: gives 3(2x+1)23(2x+1)^2.
  • Inner g(x)=2x+1g(x) = 2x+1, so g(x)=2g'(x) = 2.
  • Result: 3(2x+1)22=6(2x+1)23(2x+1)^2 \cdot 2 = 6(2x+1)^2.

Format C: Transition identification


The computation below differentiates h(x)=ln ⁣((x2+1)3)h(x) = \ln\!\bigl((x^2+1)^3\bigr). Identify which steps use the chain rule and explain the outer/inner pair for each.

StepExpression
0ln ⁣((x2+1)3)\ln\!\bigl((x^2+1)^3\bigr)
11(x2+1)3ddx(x2+1)3\dfrac{1}{(x^2+1)^3}\cdot\dfrac{d}{dx}(x^2+1)^3
21(x2+1)33(x2+1)22x\dfrac{1}{(x^2+1)^3}\cdot 3(x^2+1)^2 \cdot 2x
36x(x2+1)2(x2+1)3=6xx2+1\dfrac{6x(x^2+1)^2}{(x^2+1)^3} = \dfrac{6x}{x^2+1}
Reveal

Steps 1 and 2 both use the chain rule:

  • Step 0 → 1: outer f(u)=lnuf(u) = \ln u, inner g(x)=(x2+1)3g(x) = (x^2+1)^3. Chain rule: 1(x2+1)3ddx(x2+1)3\frac{1}{(x^2+1)^3} \cdot \frac{d}{dx}(x^2+1)^3.
  • Step 1 → 2: outer f(u)=u3f(u) = u^3, inner g(x)=x2+1g(x) = x^2+1. Chain rule: 3(x2+1)22x3(x^2+1)^2 \cdot 2x.
  • Step 2 → 3: algebraic cancellation and simplification only — no differentiation rule applied.

Solve a Problem

Apply what you’ve learned with Problem Solving.

Problem: Compute h(x)h'(x) where h(x)=e(x2+1)3h(x) = e^{(x^2+1)^3}. Apply the chain rule twice: first to the outer exponential, then to the cubic inner layer.

Full solution
StepExpressionMove
0ddxe(x2+1)3\dfrac{d}{dx}e^{(x^2+1)^3}
1e(x2+1)3ddx(x2+1)3e^{(x^2+1)^3}\cdot\dfrac{d}{dx}(x^2+1)^3Chain rule: outer f(u)=euf(u)=e^u, inner g(x)=(x2+1)3g(x)=(x^2+1)^3
2e(x2+1)33(x2+1)2ddx(x2+1)e^{(x^2+1)^3}\cdot 3(x^2+1)^2\cdot\dfrac{d}{dx}(x^2+1)Chain rule again: outer f(u)=u3f(u)=u^3, inner g(x)=x2+1g(x)=x^2+1
3e(x2+1)33(x2+1)22xe^{(x^2+1)^3}\cdot 3(x^2+1)^2\cdot 2xSum and power rules on the inner derivative: ddx(x2+1)=2x\dfrac{d}{dx}(x^2+1)=2x
46x(x2+1)2e(x2+1)36x(x^2+1)^2 e^{(x^2+1)^3}Multiply the constants and collect the factors

PrincipleRelationship
Derivative at a PointFoundation — every derivative rule stands on the limit definition, and the chain rule inherits that derivative object before it becomes a reusable move
Derivative Product RuleProduct rule handles two separate factors f(x)g(x)f(x)g(x); the chain rule handles one function nested inside another as f(g(x))f(g(x))
Derivative Power RulePower rule often supplies the outer derivative when the chain rule is applied to powers such as (x2+1)5(x^2+1)^5
Derivative of e^xCommon outer-rule case: chain rule turns the direct exe^x derivative into eg(x)g(x)e^{g(x)}g'(x) when the exponent is nontrivial
Derivative of ln(x)Common outer-rule case: chain rule turns the direct ln(x)\,\ln(x) derivative into g(x)/g(x)g'(x)/g(x) for composite logarithms
Function CompositionThe chain rule depends on recognizing the composition structure fgf \circ g before choosing the move

FAQ

What is the chain rule?

The chain rule states that the derivative of a composite function f(g(x))f(g(x)) equals f(g(x))g(x)f'(g(x)) \cdot g'(x) — the outer derivative evaluated at the inner function, multiplied by the inner derivative. It applies whenever both ff and gg are differentiable at the relevant points.

When does the chain rule apply?

It applies when you have a genuine composition f(g(x))f(g(x)) with a non-trivial inner function, and when gg is differentiable at xx and ff is differentiable at g(x)g(x). If either differentiability condition fails at the point of interest, the chain rule cannot be used there.

What happens if I forget the inner derivative?

Omitting g(x)g'(x) gives the wrong derivative. For example, ddxsin(x2)=cos(x2)\frac{d}{dx}\sin(x^2) = \cos(x^2) is incorrect; the correct answer is cos(x2)2x\cos(x^2) \cdot 2x. The missing factor is never 11 unless the inner function is g(x)=xg(x) = x itself, so the error always affects the final answer.

How is the chain rule different from the product rule?

The product rule handles a product f(x)g(x)f(x) \cdot g(x) — two functions multiplied together with the same variable. The chain rule handles a composition f(g(x))f(g(x)) — one function applied inside another. The structural distinction is whether you are multiplying two functions or plugging one into the other.

Can the chain rule apply more than once in the same problem?

Yes. When the inner function is itself a composition, you apply the chain rule at each layer in succession — from outermost to innermost — multiplying the outer derivative by each successive inner derivative. This is sometimes called the “extended chain rule” or “chain of chains.”


How This Fits in Unisium

The chain rule is one of the highest-leverage moves in single-variable calculus — almost every non-trivial differentiation problem involves a composition, and fluent application requires both recognizing the composition structure and automatically checking the differentiability conditions. Unisium builds this fluency through targeted state-transition drills: you practice identifying outer and inner functions, naming the conditions, and executing the multiplication — until move selection is automatic rather than deliberate.

Explore further:

  • Calculus Subdomain Map — Return to the calculus hub to see how the derivative-rule cluster is grouped around the definition and the structural rules
  • Derivative Product Rule — The paired move for products rather than compositions; knowing both rules sharpens your ability to tell them apart
  • Derivative of e^x — The direct exponential rule becomes a chain-rule example as soon as the exponent is g(x)g(x) instead of xx
  • Derivative of ln(x) — The direct logarithm rule becomes a chain-rule example as soon as the input is g(x)g(x) instead of xx
  • Function Composition — The structural concept underlying the chain rule; understanding fgf \circ g makes outer/inner identification faster
  • Power Rule — Frequently used as the outer or inner step when applying the chain rule to polynomial compositions
  • Elaborative Encoding — Build deep understanding of why the inner derivative factor is mathematically necessary
  • Retrieval Practice — Reinforce the condition and pattern until they are instantly accessible

Ready to master the chain rule? Start practicing with Unisium or explore the full learning framework in Masterful Learning.

Masterful Learning book cover

Masterful Learning

The study system for physics, math, & programming that works: retrieval, connection, explanation, problem solving, and more.

Read the book (opens in new tab) ISBN 979-8-2652-9642-9

Ready to apply this strategy?

Join Unisium and start implementing these evidence-based learning techniques.

Start Learning with Unisium Read More Guides

Want the complete framework? This guide is from Masterful Learning.

Learn about the book →