Chain Rule Calculator
The free chain rule calculator solves single-variable, nested triple-composition, and multivariable chain rule problems with full step-by-step decomposition into outer f(u) and inner g(x) functions — showing every step of f'(g(x))·g'(x) with automatic verification.
Use * for multiplication, ^ for powers. e^(x^2) not exp(x^2). Chain rule applies when you have a function inside another function.
Chain Rule Result — d/dx[f(g(x))] = f'(g(x)) · g'(x)
Nested Chain Rule: For f(g(h(x))), the generalised chain rule gives:
d/dx[f(g(h(x)))] = f'(g(h(x))) · g'(h(x)) · h'(x)
Triple Chain Rule — d/dx[f(g(h(x)))] = f'(g(h(x)))·g'(h(x))·h'(x)
Multivariable Chain Rule: For z = f(x,y), x = x(t), y = y(t):
dz/dt = (∂z/∂x)(dx/dt) + (∂z/∂y)(dy/dt)
dz/dt — Final Result
Two-Parameter Chain Rule: For z = f(x,y), x = x(s,t), y = y(s,t):
∂z/∂s = (∂z/∂x)(∂x/∂s) + (∂z/∂y)(∂y/∂s)
∂z/∂t = (∂z/∂x)(∂x/∂t) + (∂z/∂y)(∂y/∂t)
∂z/∂s — Result
∂z/∂t — Result
Outer: f(u) = uⁿ → f'(u) = n·uⁿ⁻¹ Inner: u = g(x)
Chain rule: d/dx[(g(x))ⁿ] = n·(g(x))ⁿ⁻¹ · g'(x) — the power rule combined with the inner derivative.
(3x+1)⁵ → 5(3x+1)⁴ · 3 = 15(3x+1)⁴
(x²+1)¹⁰ → 10(x²+1)⁹ · 2x = 20x(x²+1)⁹
Outer: f(u) = sin(u) → f'(u) = cos(u) Inner: u = g(x)
The chain rule gives: d/dx[sin(g(x))] = cos(g(x)) · g'(x). The key is that cos evaluates at g(x), not just x.
sin(x²) → cos(x²) · 2x = 2x·cos(x²)
cos(5x) → −sin(5x) · 5 = −5sin(5x)
Outer: f(u) = eᵘ → f'(u) = eᵘ Inner: u = g(x)
Since eᵘ differentiates to itself, the chain rule gives e^(g(x)) times g'(x) — the outer part stays unchanged.
e^(x³) → e^(x³) · 3x² = 3x²·e^(x³)
e^(x²−2x) → e^(x²−2x) · (2x−2)
Outer: f(u) = ln(u) → f'(u) = 1/u Inner: u = g(x)
Chain rule: d/dx[ln(g(x))] = (1/g(x)) · g'(x) = g'(x)/g(x). A very commonly tested pattern.
ln(cos(x)) → (−sin(x))/cos(x) = −tan(x)
ln(x²+1) → 2x/(x²+1)
Outer: f(u) = √u → f'(u) = 1/(2√u) Inner: u = g(x)
Rewrite √(g(x)) = (g(x))^(1/2), then chain rule gives (1/2)(g(x))^(−1/2) · g'(x) = g'(x)/(2√(g(x))).
√(4−x²) → (−2x)/(2√(4−x²)) = −x/√(4−x²)
Click any row to load into the chain rule calculator. Outer function shown in indigo, inner in teal.
| f(x) | d/dx [f(x)] | Outer · Inner |
|---|---|---|
| sin(x²) | 2x·cos(x²) | sin(u) · x² |
| cos(5x) | −5sin(5x) | cos(u) · 5x |
| tan(x²+3x) | (2x+3)sec²(x²+3x) | tan(u) · x²+3x |
| sin(3x+1) | 3cos(3x+1) | sin(u) · 3x+1 |
| cos(x²) | −2x·sin(x²) | cos(u) · x² |
| f(x) | d/dx [f(x)] | Outer · Inner |
|---|---|---|
| e^(x²) | 2x·e^(x²) | eᵘ · x² |
| e^(x³) | 3x²·e^(x³) | eᵘ · x³ |
| e^(3x+1) | 3e^(3x+1) | eᵘ · 3x+1 |
| e^(sin x) | cos(x)·e^(sin x) | eᵘ · sin x |
| f(x) | d/dx [f(x)] | Outer · Inner |
|---|---|---|
| ln(x²+1) | 2x/(x²+1) | ln(u) · x²+1 |
| ln(cos x) | −tan(x) | ln(u) · cos x |
| ln(sin x) | cot(x) | ln(u) · sin x |
| ln(3x+2) | 3/(3x+2) | ln(u) · 3x+2 |
| f(x) | d/dx [f(x)] | Outer · Inner |
|---|---|---|
| (3x+1)⁵ | 15(3x+1)⁴ | u⁵ · 3x+1 |
| (x²+1)¹⁰ | 20x(x²+1)⁹ | u¹⁰ · x²+1 |
| √(4−x²) | −x/√(4−x²) | √u · 4−x² |
| √(x²+1) | x/√(x²+1) | √u · x²+1 |
| sin³(x) | 3sin²(x)·cos(x) | u³ · sin x |
What Is the Chain Rule — Definition and Formula
This chain rule calculator computes the derivative of any composite function using the chain rule formula f'(g(x))·g'(x), providing full step-by-step decomposition into an outer function and an inner function — covering single-variable, nested triple-composition, and the multivariable chain rule partial derivative calculator for dz/dt and ∂z/∂s cases.
The chain rule is the fundamental differentiation rule for composite functions — functions of the form y = f(g(x)), where one function is nested inside another. The chain rule states:
In plain language: "Derivative of the outside (leaving the inside alone), times the derivative of the inside." This mnemonic captures the chain rule completely. Every use of the chain rule follows f'(g(x))·g'(x) — without exception.
The chain rule formula f'(g(x))·g'(x) can also be written in Leibniz notation. If y = f(u) and u = g(x), then:
This Leibniz form makes the chain rule intuitive: the du terms appear to cancel, leaving dy/dx. While this isn't rigorous, it gives the correct answer and explains why the chain rule formula f'(g(x))·g'(x) works for every composite function.
How to Use the Chain Rule — Step-by-Step Method
The chain rule differentiation calculator applies this four-step method for every composite function. Learning this process allows you to handle any chain rule problem systematically.
- Step 1 — Identify outer and inner function: Ask "what is the last operation performed?" That is the outer function f. Everything inside it is the inner function g(x). For sin(x²): outer = sin(u), inner = x².
- Step 2 — Differentiate the outer function, leaving the inner alone: Treat u = g(x) as a single variable. Compute f'(u). Do NOT touch the inner function yet.
- Step 3 — Differentiate the inner function: Compute g'(x) using standard differentiation rules (power rule, product rule, etc.).
- Step 4 — Multiply: The chain rule gives d/dx[f(g(x))] = f'(g(x))·g'(x). Substitute u = g(x) back into f'(u), then multiply by g'(x). Simplify.
Example 1: Chain Rule for sin(x²)
- Outer: f(u) = sin(u) → f'(u) = cos(u)
- Inner: u = g(x) = x² → g'(x) = 2x
- Substitute: f'(g(x)) = cos(x²)
- Chain rule: d/dx[sin(x²)] = cos(x²) · 2x = 2x·cos(x²)
Example 2: Chain Rule for (3x+1)⁵
- Outer: f(u) = u⁵ → f'(u) = 5u⁴
- Inner: u = g(x) = 3x+1 → g'(x) = 3
- f'(g(x)) = 5(3x+1)⁴
- Chain rule: d/dx[(3x+1)⁵] = 5(3x+1)⁴ · 3 = 15(3x+1)⁴
Example 3: Chain Rule for e^(x³)
- Outer: f(u) = eᵘ → f'(u) = eᵘ
- Inner: u = g(x) = x³ → g'(x) = 3x²
- f'(g(x)) = e^(x³)
- Chain rule: d/dx[e^(x³)] = e^(x³) · 3x² = 3x²·e^(x³)
Example 4: Chain Rule for ln(cos x)
- Outer: f(u) = ln(u) → f'(u) = 1/u
- Inner: u = g(x) = cos(x) → g'(x) = −sin(x)
- f'(g(x)) = 1/cos(x)
- Chain rule: d/dx[ln(cos x)] = (1/cos x)(−sin x) = −sin(x)/cos(x) = −tan(x)
Example 5: Chain Rule for √(4−x²)
- Rewrite: (4−x²)^(1/2)
- Outer: f(u) = u^(1/2) → f'(u) = (1/2)u^(−1/2) = 1/(2√u)
- Inner: u = g(x) = 4−x² → g'(x) = −2x
- f'(g(x)) = 1/(2√(4−x²))
- Chain rule: d/dx[√(4−x²)] = [1/(2√(4−x²))]·(−2x) = −x/√(4−x²)
Nested Chain Rule — Three or More Layers
The nested chain rule generalises f'(g(x))·g'(x) to three or more layers of composition. For f(g(h(x))), the generalised chain rule is:
The method is called "outside-in peeling": differentiate the outermost function first (leaving everything inside unchanged), then multiply by the derivative of the next layer (leaving what's inside it unchanged), then multiply by the derivative of the innermost layer. This applies the chain rule formula f'(g(x))·g'(x) at each stage.
Example: d/dx[sin(√(x²+1))]
- Identify three layers: f(u) = sin(u), g(v) = √v, h(x) = x²+1
- Outermost derivative: f'(u) = cos(u) → evaluated at √(x²+1): cos(√(x²+1))
- Middle derivative: g'(v) = 1/(2√v) → evaluated at x²+1: 1/(2√(x²+1))
- Innermost derivative: h'(x) = 2x
- Multiply all three: cos(√(x²+1)) · [1/(2√(x²+1))] · 2x
- Simplify: x·cos(√(x²+1)) / √(x²+1)
Connection to Limits: The chain rule formula f'(g(x))·g'(x) can be derived from the limit definition of the derivative. The key insight (from the limit proof) is that as h → 0, the difference quotient [f(g(x+h)) − f(g(x))]/h factors into the outer and inner difference quotients — each approaching their respective derivatives. This is why the chain rule calculator's limit interpretation connects to the infinitesimal rates (dy/du)(du/dx) = dy/dx.
Multivariable Chain Rule — dz/dt and Partial Derivatives
The multivariable chain rule calculator extends f'(g(x))·g'(x) to functions of several variables. For z = f(x,y) where x and y depend on a single parameter t, the chain rule for partial derivatives gives:
This partial derivative chain rule calculator formula has one term for each intermediate variable (x and y). Each term is a partial derivative of z with respect to the intermediate variable, times the ordinary derivative of that variable with respect to t. This is precisely how the chain rule formula f'(g(x))·g'(x) generalises to multiple variables.
Worked Example: z = x²y + y³, x = cos(t), y = sin(t)
- Compute partial derivatives: ∂z/∂x = 2xy, ∂z/∂y = x² + 3y²
- Compute ordinary derivatives: dx/dt = −sin(t), dy/dt = cos(t)
- Chain rule: dz/dt = (2xy)(−sin t) + (x²+3y²)(cos t)
- Substitute x = cos t, y = sin t: dz/dt = 2cos(t)sin(t)(−sin t) + (cos²t + 3sin²t)(cos t)
- = −2sin²(t)cos(t) + cos³(t) + 3sin²(t)cos(t)
- = cos³(t) + sin²(t)cos(t) = cos(t)[cos²(t) + sin²(t)] = cos(t)
For two parameters s and t (the general multivariable chain rule calculator case), where z = f(x,y), x = x(s,t), y = y(s,t), the chain rule partial derivative calculator gives two equations:
The multivariable chain rule combines ordinary chain rule reasoning with partial derivatives — for computing ∂z/∂x and ∂z/∂y independently, see our Partial Derivative Calculator.
Common Mistakes With the Chain Rule
Mistake 1 — Forgetting to Multiply by g'(x)
- ❌ Wrong: d/dx[sin(x²)] = cos(x²)
- ✅ Correct chain rule: d/dx[sin(x²)] = cos(x²) · 2x = 2x·cos(x²)
- The g'(x) factor — the inner derivative — is the most commonly omitted part of the chain rule formula f'(g(x))·g'(x).
Mistake 2 — Misidentifying Outer vs Inner Function
- ❌ Wrong for ln(cos x): treating cos(x) as outer, ln as inner
- ✅ Correct: outer = ln(u) since it wraps everything; inner = cos(x)
- Always ask: "what is the last operation applied?" — that is the outer function.
Mistake 3 — Applying Chain Rule to Non-Composites
- ❌ Wrong: d/dx[sin(x) + x²] — chain rule applied to a sum
- ✅ Correct: use sum rule; neither sin(x) nor x² alone is a composite requiring chain rule
- Chain rule only applies when one function is genuinely inside another.
Mistake 4 — Sign Errors in Trig Inner Derivatives
- ❌ Wrong: d/dx[ln(cos x)] = sin(x)/cos(x) = tan(x)
- ✅ Correct chain rule: g'(x) = d/dx[cos x] = −sin(x) → result is −sin(x)/cos(x) = −tan(x)
- Always compute g'(x) explicitly; sign errors compound in chain rule problems.
Mistake 5 — Not Substituting Inner Function Back into f'(u)
- ❌ Wrong: d/dx[sin(x²)] = cos(u)·2x (leaving u unsubstituted)
- ✅ Correct: substitute u = x² → cos(x²)·2x — the final answer must be in terms of x only
- After computing f'(u), always replace u with g(x) in the chain rule formula.
Worked Examples — Ten Full Chain Rule Solutions
| f(x) | Outer f(u) | Inner g(x) | d/dx[f(g(x))] = f'(g(x))·g'(x) |
|---|---|---|---|
| sin(x²) | sin(u) | x² | 2x·cos(x²) |
| (3x+1)⁵ | u⁵ | 3x+1 | 15(3x+1)⁴ |
| e^(x³) | eᵘ | x³ | 3x²·e^(x³) |
| ln(cos x) | ln(u) | cos x | −tan(x) |
| √(4−x²) | √u | 4−x² | −x/√(4−x²) |
| cos(5x) | cos(u) | 5x | −5sin(5x) |
| (x²+1)¹⁰ | u¹⁰ | x²+1 | 20x(x²+1)⁹ |
| tan(x²+3x) | tan(u) | x²+3x | (2x+3)sec²(x²+3x) |
| e^(sin x) | eᵘ | sin x | cos(x)·e^(sin x) |
| sin(√(x²+1)) | sin(u) | √(x²+1) | x·cos(√(x²+1))/√(x²+1) |
Full Solution 6: cos(5x)
- f(u) = cos(u) → f'(u) = −sin(u)
- u = g(x) = 5x → g'(x) = 5
- f'(g(x)) = −sin(5x)
- Chain rule: d/dx[cos(5x)] = −sin(5x) · 5 = −5sin(5x)
- Verify: d/dx(−5·(−sin(5x))/5) = d/dx(sin(5x))... checking: (1/5)d/dx[cos(5x)] worked ✓
Full Solution 9: e^(sin x)
- f(u) = eᵘ → f'(u) = eᵘ
- u = g(x) = sin(x) → g'(x) = cos(x)
- f'(g(x)) = e^(sin x)
- Chain rule: d/dx[e^(sin x)] = e^(sin x) · cos(x) = cos(x)·e^(sin x)
Full Solution 10 — Nested: sin(√(x²+1))
- Three layers: f = sin, g = √, h = x²+1
- f'(g(h(x))) = cos(√(x²+1))
- g'(h(x)) = 1/(2√(x²+1))
- h'(x) = 2x
- Multiply: cos(√(x²+1)) · 1/(2√(x²+1)) · 2x = x·cos(√(x²+1))/√(x²+1)
Frequently Asked Questions — Chain Rule
Related Calculators
Share This Tool
Share the Chain Rule Calculator with students!