Chain Rule Calculator
Differentiate composite functions using the chain rule.
Choose outer and inner function types, enter parameters, and evaluate d/dx[f(g(x))] at any point x.
The chain rule handles derivatives of composite functions: functions of the form f(g(x)), where one function is nested inside another. If you want d/dx[sin(3x + 2)], you cannot differentiate the sine and stop there. You also need to account for the inner function 3x + 2.
The formula: d/dx[f(g(x))] = f’(g(x)) · g’(x). Read it as “derivative of the outer function evaluated at the inner function, times the derivative of the inner function.” Most calculus students forget that second factor. That trailing g’(x) is the whole point.
This calculator fixes the inner function as g(x) = ax + b. The derivative of ax + b is always just a, which keeps results clean and easy to verify by hand.
For each outer function type, the chain rule gives:
- Power f(u) = u^n: result is n(ax+b)^(n-1) · a
- Sine f(u) = sin(u): result is cos(ax+b) · a
- Cosine f(u) = cos(u): result is -sin(ax+b) · a
- Exponential f(u) = e^u: result is e^(ax+b) · a
- Natural log f(u) = ln(u): result is a/(ax+b)
The classic exam mistake: d/dx[sin(5x)] looks like cos(5x). The correct answer is 5cos(5x). That factor of 5 comes from differentiating the inner function 5x.
More than one layer. For deeper compositions like h(x) = sin(e^(x²)), apply the chain rule once per layer, working from the outside in: differentiate sin first, leaving its argument alone (cos(e^(x²))), then multiply by the derivative of e^(x²) (which itself needs another chain step: e^(x²) · 2x). Each layer contributes one factor to the product. Three layers, three factors.
Implicit differentiation is the chain rule in disguise. When you differentiate y³ with respect to x in an implicit equation, you treat y as a function of x and write d/dx[y³] = 3y² · dy/dx. That dy/dx factor is not optional. It is the chain rule applied to the inner function y(x), and dropping it collapses the whole problem.
The chain rule is the most frequently applied differentiation rule in applied math and physics. Any time one function sits inside another, whether raised to a power, tucked inside a trig function, or sitting up in an exponent, you almost certainly need it. It is also exactly what backpropagation does in a neural network: gradients are pushed back through layers of nested functions, one chain-rule step per layer. Work through a few examples with different outer types until “multiply by g’(x)” becomes automatic.
A worked example the boxes above reproduce. Take f(u) = sin(u) with g(x) = 2x + 1, evaluated at x = 1.
- g(1) = 2(1) + 1 = 3
- f’(u) = cos(u), so f’(g(1)) = cos(3) = −0.98999250
- g’(x) = 2 always
- d/dx = −0.98999250 × 2 = −1.97998499
Note that cos(3) means 3 radians, not 3 degrees, which is the other classic slip on a problem like this. Choose Sine, enter a = 2, b = 1, x = 1, and that is the number you get.
Note: ln(u) requires ax + b > 0 at the chosen x. If the result reports it as undefined, adjust the coefficient or constant so the inner function stays positive at the point you are evaluating.
How we build and check this calculator
This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.
More Math Calculators
- Chi-Square Distribution Calculator
- Chinese Remainder Theorem Calculator
- Cramer's Rule Calculator
- Critical Points Calculator
- Cumulative Frequency Calculator
- Curl Calculator
- Descartes Rule of Signs Calculator
- Descriptive Statistics Calculator
- Directional Derivative Calculator
- Divergence Calculator
- Double Integral Calculator
- Error Function Calculator