Skip to content
Calculator Collection

Chain Rule Calculator

Compute the derivative of a composite function f(g(x)) where f(u) = c·u^n and g(x) = m·x + b, evaluated at a given x. Applies the chain rule: (d/dx)[f(g(x))] = f'(g(x)) · g'(x).

Last updated: May 2026

Fill in the required fields to see your result.

Compare with similar

About this calculator

The chain rule states that the derivative of a composite function is the derivative of the outer evaluated at the inner, times the derivative of the inner: (d/dx)[f(g(x))] = f'(g(x)) · g'(x). This calculator applies it to the specific case where the outer function is a power, f(u) = outer_coeff · u^outer_power, and the inner is linear, g(x) = inner_coeff · x + inner_constant. The chain-rule derivative becomes outer_coeff · outer_power · (inner_coeff · x + inner_constant)^(outer_power − 1) · inner_coeff, which the formula evaluates at the supplied x_value. Edge cases: when inner_coeff · x + inner_constant equals zero and outer_power − 1 is negative, the result is infinity or NaN (division by zero from a negative power). When outer_power is 1, the derivative simplifies to outer_coeff · inner_coeff, independent of x, because the outer function is linear. When outer_power is 0, the outer function is the constant outer_coeff, and the derivative is zero — but the formula will still compute outer_coeff · 0 · (...)^(−1), which produces 0 multiplied by potentially infinity (NaN). The calculator handles only this specific composition; for f(u) being trigonometric, exponential, or logarithmic, or for nested compositions (f(g(h(x)))), apply the chain rule by hand or use a symbolic engine.

How to use

Example 1 — derivative of (2x + 1)³ at x = 1. Outer f(u) = u³ so outer_coeff = 1, outer_power = 3; inner g(x) = 2x + 1 so inner_coeff = 2, inner_constant = 1; x_value = 1. Step 1: inner at x = 1: 2 · 1 + 1 = 3. Step 2: outer_coeff · outer_power · inner^(outer_power − 1) = 1 · 3 · 3² = 1 · 3 · 9 = 27. Step 3: multiply by inner_coeff: 27 · 2 = 54. Verify: (2x+1)³ expanded is 8x³ + 12x² + 6x + 1, derivative is 24x² + 24x + 6, at x = 1 gives 24 + 24 + 6 = 54 ✓. Example 2 — derivative of 3·(2x + 1)² at x = 1. outer_coeff = 3, outer_power = 2, inner_coeff = 2, inner_constant = 1, x_value = 1. Step 1: inner = 2 · 1 + 1 = 3. Step 2: 3 · 2 · 3^(2−1) = 3 · 2 · 3 = 18. Step 3: multiply by inner_coeff: 18 · 2 = 36. Verify: 3(2x+1)² = 3(4x² + 4x + 1) = 12x² + 12x + 3, derivative 24x + 12, at x = 1 gives 36 ✓. The chain rule and the expand-then-differentiate approach agree exactly, as they must.

Frequently asked questions

Why is the chain rule needed instead of just expanding and differentiating?

For small powers and simple inner functions, expanding the composite and differentiating term-by-term works and gives the same answer. For larger powers or more complex inner functions, expansion becomes impractical — (2x + 1)¹⁰ has eleven terms in the binomial expansion, and (sin(x))⁵ cannot be expanded into a finite polynomial at all. The chain rule lets you differentiate without ever expanding: just identify the outer and inner functions, differentiate each, and multiply. The rule generalises to arbitrary compositions f(g(h(x))) by repeated application, and it underpins backpropagation in neural networks (the gradient of a deeply composed function with respect to its inputs). For closed-form symbolic results, modern algebra systems (Wolfram Alpha, SymPy) apply the chain rule automatically. For paper-and-pencil work, the chain rule is essential the moment your function involves any composition more complex than a polynomial.

How does the chain rule extend to nested compositions like f(g(h(x)))?

By repeated application: (d/dx)[f(g(h(x)))] = f'(g(h(x))) · g'(h(x)) · h'(x). Each layer of composition contributes one factor — the derivative of that layer evaluated at the next inner layer's output. For example, the derivative of sin((2x+1)³) requires three applications: outermost is sin, middle is u³ where u = 2x+1, innermost is 2x+1 itself. Working outside-in: cos((2x+1)³) · 3(2x+1)² · 2 = 6(2x+1)² · cos((2x+1)³). This calculator handles only the two-layer case where outer is a power and inner is linear; for deeper or differently-shaped compositions, work by hand applying the chain rule one layer at a time or use a symbolic engine. The key intuition is that each layer of composition multiplies the result by that layer's derivative — a chain of multiplications matching the chain of function evaluations.

What if my inner function isn't linear?

This calculator assumes inner is linear (inner_coeff · x + inner_constant), which makes g'(x) = inner_coeff constant. If your inner function is quadratic, cubic, trigonometric, exponential, or anything else, you cannot use this tool directly; you must compute g'(x) at your point separately and apply the chain rule manually: result = outer_coeff · outer_power · g(x)^(outer_power − 1) · g'(x), where g(x) and g'(x) come from whatever your actual inner function is. For example, derivative of (sin(x))³ at x = π/4: outer = u³ so outer_coeff = 1, outer_power = 3; inner is sin so g(π/4) = √2/2 ≈ 0.707 and g'(π/4) = cos(π/4) = √2/2 ≈ 0.707. Result: 1 · 3 · 0.707² · 0.707 ≈ 1.06. The chain rule structure is the same; the only difference is that g and g' come from non-linear formulas you must evaluate yourself.

What are the common mistakes when applying the chain rule?

The biggest mistake is forgetting to multiply by g'(x) — students often differentiate the outer function and stop there, computing f'(g(x)) but missing the · g'(x) factor. The second is misidentifying the inner and outer functions — for f(x) = sin(x²), the outer is sin, the inner is x²; flipping these gives the wrong derivative. The third is mis-evaluating the inner: you must compute g(x) and substitute it into f', not just leave 'x' inside f'. People also forget that when the inner function is itself a composition (g(h(x))), you need to apply the chain rule again, producing a chain of multiplied derivatives, not just one. For this calculator specifically, the most common error is entering non-linear inner functions and getting wrong answers because the formula assumes linear inner. Always sanity-check chain-rule results by expanding for low powers and differentiating term-by-term — the two methods must agree.

When should I not use this calculator?

Do not use it when the inner function is anything other than linear (inner_coeff · x + inner_constant) — the formula gives wrong results for quadratic, trigonometric, exponential, or other inner functions. For non-linear inner functions, compute the chain rule by hand using f'(g(x)) · g'(x) with g'(x) evaluated separately, or use a symbolic engine. Do not use it for nested compositions f(g(h(x))) — apply the chain rule one layer at a time, multiplying the derivatives. It is not appropriate when the outer function is non-power (sin, cos, exp, log) — those need their own chain-rule formulas. Avoid it for higher-order derivatives (d²/dx² of f(g(x))), which require the chain rule combined with the product rule on the result and gets messy quickly; symbolic engines are recommended. Finally, if outer_power is zero (constant outer) or you're evaluating at a point where the inner equals zero with negative effective exponent, the formula can produce NaN or infinity — verify your setup before trusting the output.

Sources & references