Chain Rule: Differentiating Composite Functions

Chain Rule: Differentiating Composite Functions

Build a clear mental model of the chain rule so composite derivatives feel predictable. Learn to spot the inner and outer functions, translate between notations, and sanity check results with quick slope estimates.

A lot of derivative mistakes come from treating a complicated expression like one blob. The chain rule fixes that by forcing you to respect how changes flow through layers. The surprising part is that the final slope is not added or averaged. It is multiplied. Once you see why multiplying makes sense, the rule stops feeling like a memorized formula and starts feeling like a shortcut you can trust.

Chain rule as change through layers

Think of a composite function as two steps in a row. First xx gets turned into g(x)g(x). Then that output gets turned into f(g(x))f(g(x)). If xx nudges a little, g(x)g(x) nudges some amount, and then ff reacts to that nudge.

The chain rule says the overall sensitivity is the product of the sensitivities at each step.

The multiplication is the whole point. If the inner step doubles tiny changes, and the outer step triples tiny changes, the combined machine makes changes about six times bigger. If either step flattens changes toward zero, the whole composite flattens too.

Multiply sensitivities
The slope of a composite is outside sensitivity evaluated at the inside output, times inside sensitivity.

Composite functions and the idea of sensitivity

A composite function is a function plugged into another function, like f(g(x))f(g(x)). The part that happens last is the outer function f()f(\,\cdot\,). The part that happens first is the inner function g(x)g(x).

Instead of thinking outer and inner as labels, think cause and effect.

  • gg turns a change in xx into a change in the intermediate value u=g(x)u=g(x).
  • ff turns a change in uu into a change in the final output y=f(u)y=f(u).

Sensitivity is just slope in disguise. When you compute g(x)g'(x), you are asking how sensitive uu is to xx. When you compute f(u)f'(u), you are asking how sensitive yy is to uu. For the composite, you want sensitivity of yy to xx, and it has to pass through the middle step.

The chain rule statement and notation

Chain rule (single layer). If y=f(g(x))y=f(g(x)) and both derivatives exist, then

dydx=f(g(x))g(x).\frac{dy}{dx}=f'(g(x))\cdot g'(x).

Read it as evaluate the slope of the outside function at the inside output, then multiply by the slope of the inside.

The different notations all point at the same idea.

  • y=dydxy'=\frac{dy}{dx} reminds you there is a single final slope you want.
  • (fg)(x)(f\circ g)'(x) emphasizes you are differentiating a composed function.
  • dydududx\frac{dy}{du}\cdot\frac{du}{dx} makes the multiplication feel natural because uu is the intermediate variable.

Leibniz lens
dydx\frac{dy}{dx} behaves like a ratio of tiny changes, so chaining dydu\frac{dy}{du} and dudx\frac{du}{dx} matches how changes pass through uu.

A reliable method that rarely fails

When you are new to the chain rule, the hardest part is seeing the layers. A dependable trick is to name the inner expression.

The u-substitution style workflow

  • Choose u=g(x)u=g(x) as the inner function.
  • Rewrite the original function in terms of uu, so it becomes y=f(u)y=f(u).
  • Differentiate using ordinary rules in uu.
  • Multiply by dudx\frac{du}{dx} and substitute back u=g(x)u=g(x).

A quick example shows the structure. For y=(3x2+1)5y=(3x^2+1)^5, let u=3x2+1u=3x^2+1. Then y=u5y=u^5, so dydu=5u4\frac{dy}{du}=5u^4. Also dudx=6x\frac{du}{dx}=6x. Multiply and substitute back.

dydx=5(3x2+1)46x=30x(3x2+1)4.\frac{dy}{dx}=5(3x^2+1)^4\cdot 6x=30x(3x^2+1)^4.

Notice you never differentiated the inside first or the outside first. You differentiated each with respect to its own input, then multiplied.

Common patterns that are really chain rule

Many derivative rules you memorize in practice are chain rule plus a basic derivative. The inside is often a line like ax+bax+b, but it can be any g(x)g(x).

The habit to build is to look for an expression that is acting like a single chunk being fed into a familiar outer shape.

  • Power outer. Anything like (g(x))n(g(x))^n.
  • Root outer. Anything like g(x)\sqrt{g(x)} or (g(x))1/2(g(x))^{1/2}.
  • Trig outer. Anything like sin(g(x))\sin(g(x)), cos(g(x))\cos(g(x)), tan(g(x))\tan(g(x)).
  • Exponential outer. Anything like eg(x)e^{g(x)} or ag(x)a^{g(x)}.
  • Log outer. Anything like ln(g(x))\ln(g(x)).

One warning that saves time. If the derivative you got looks exactly like the original function with a small tweak but you never multiplied by g(x)g'(x), you probably did not finish the chain rule.

Always pay the inside
When you differentiate the outer form, immediately ask what g(x)g'(x) is and multiply it in before moving on.

Multiple layers and mixed rules

Real problems often have more than one layer, or they mix composition with multiplication or division. The key is to treat rules like building blocks, not rivals. You can stack them.

More than one layer

If y=f(g(h(x)))y=f(g(h(x))), you apply the chain rule repeatedly. Each layer contributes its own derivative factor, and they multiply.

Chain rule with product or quotient

For something like x2sin(3x2)x^2\sin(3x^2), there is a product, so the product rule is the outer structure. Inside the product rule, you still differentiate sin(3x2)\sin(3x^2) using the chain rule.

A good mental move is to decide the top-level operation first.

  • Are you multiplying two big chunks? Use product rule, then chain rule inside a chunk if needed.
  • Are you dividing? Use quotient rule, then chain rule inside numerator or denominator if needed.
  • Is it one big outer shape around everything? Pure chain rule, possibly repeated.

Sanity-checking your derivative

A derivative is a slope. If your result does not behave like a slope, something went wrong. You can catch many errors without redoing the whole problem.

  • Sign check. If the function is increasing at a point, your derivative should be positive there.
  • Scale check. If the inside grows fast, the derivative usually gets bigger in magnitude.
  • Plug-in check. Pick an xx, estimate the slope from a small Δx\Delta x, compare to your derivative value.

Even a rough numeric slope is useful. If your symbolic derivative predicts a slope of 500500 but the function barely changes when you nudge xx, you likely missed a factor like g(x)g'(x) or made a constant mistake.

One-point reality check
Testing at a single xx value often finds the exact spot you dropped a minus sign or forgot an inner derivative.

Next steps for practice and mistake-proofing

Practice is less about doing dozens of random problems and more about training your eyes to see inner functions quickly.

Start every problem by circling the outermost shape. Is it a power, a trig function, a log, an exponential. Then put parentheses around what is being fed into it. That is your first inner candidate. If there are more layers, repeat.

The most common mistakes to watch for are predictable.

  • Differentiating the outer correctly but forgetting to multiply by g(x)g'(x)
  • Treating sin(3x)\sin(3x) as sin(x)\sin(x) and only multiplying by 33 after the fact, which usually leads to missing a power of xx in harder problems
  • Confusing eg(x)e^{g(x)} with (ex)g(x)(e^x)g(x), which is a product you do not actually have
  • Dropping parentheses when you substitute back, especially with negatives

A good self-check habit is to rewrite your final derivative in a factored form that shows the chain rule pieces. You should be able to point to the outer derivative part and the inner derivative factor immediately.

Was this lesson helpful?
Dive Deeper

Generate a follow-up sub-lesson on any aspect of this topic

Related content