Chapter 03
Medium

Chain Rule, Implicit Differentiation

00 · Symbol Glossary

$f(g(x))$f of g of x — composite function

A composition of two functions: first apply gg to xx, then apply ff to the result. gg is the inner function, ff is the outer function. Read "f of g of x."

$u$u — substitution variable

A placeholder variable used to name the inner function during a chain-rule computation: u=g(x)u=g(x). Once substituted, the outer function is differentiated as a function of uu alone.

$\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot\dfrac{du}{dx}$chain rule in Leibniz form

The chain rule written with Leibniz notation (Chapter 02, Section 00): differentiate the outer layer with respect to the inner variable uu, then multiply by the derivative of the inner layer with respect to xx. The dudu terms visually "cancel" as a mnemonic, though this is not literal fraction cancellation.

$y'$y prime — shorthand for dy/dx

A compact alternative to dydx\dfrac{dy}{dx} when the dependent variable yy is understood from context, used heavily once implicit differentiation is introduced.


01 · Composite Functions

Many functions are built by feeding the output of one function into another. y=(x2+1)5y = (x^2+1)^5 is not a bare power of xx — it is the fifth power applied to the result of x2+1x^2+1. Recognizing this layered structure is the first step before differentiating it.

Definition — Composite Function

Given two functions ff and gg, the composition f(g(x))f(g(x)) is formed by using g(x)g(x) as the input to ff.

(fg)(x)=f(g(x))(f\circ g)(x) = f(g(x))

gg — the inner function, applied first.

ff — the outer function, applied second, to the output of gg.

Example — Decomposing $y=(x^2+1)^5$

Identify the layers: the innermost operation is squaring and adding 11, so g(x)=x2+1g(x)=x^2+1. The outermost operation is raising to the fifth power, so f(u)=u5f(u)=u^5. Then y=f(g(x))=(g(x))5=(x2+1)5y = f(g(x)) = (g(x))^5 = (x^2+1)^5, matching the original expression.


02 · The Chain Rule

Neither the power rule nor the product rule (Chapter 02) can differentiate (x2+1)5(x^2+1)^5 directly — it is a single power of an expression, not of xx alone. The chain rule handles composite functions by differentiating each layer separately and multiplying the results.

Definition — Chain Rule

If y=f(g(x))y = f(g(x)), then

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

"Derivative of the outer function, evaluated at the inner function (leaving the inner function untouched inside), times the derivative of the inner function."

Step-by-step — Differentiate $y=(x^2+1)^5$
1
Identify inner and outer: g(x)=x2+1g(x)=x^2+1 (inner), f(u)=u5f(u)=u^5 (outer), so y=f(g(x))y=f(g(x)).
2
Differentiate the outer function, keeping the inner intact: f(u)=5u4f'(u)=5u^4, so f(g(x))=5(x2+1)4f'(g(x)) = 5(x^2+1)^4 — the exponent 55 came down as a multiplier and the inner expression x2+1x^2+1 is substituted back in unexpanded.
3
Differentiate the inner function: g(x)=2xg'(x) = 2x (power rule).
4
Multiply the two results: dydx=5(x2+1)42x\dfrac{dy}{dx} = 5(x^2+1)^4 \cdot 2x.
5
Simplify: dydx=10x(x2+1)4\dfrac{dy}{dx} = 10x(x^2+1)^4. The coefficient 1010 came from 5×25\times2.
❌ Forgetting to multiply by the inner derivative

A common shortcut error on the same function: writing dydx=5(x2+1)4\dfrac{dy}{dx} = 5(x^2+1)^4 and stopping there.

Why it breaks: this only accounts for the outer layer's rate of change, treating x2+1x^2+1 as if it were the variable itself changing at rate 11. But x2+1x^2+1 changes at rate 2x2x, not 11 — omitting the factor g(x)=2xg'(x)=2x silently assumes the inner function's slope is always 11, which is false everywhere except where 2x=12x=1.

Consequence: the resulting derivative is wrong at every xx except x=12x=\frac12 — a coincidental match, not a valid method. The multiplication by g(x)g'(x) is not optional.


03 · Chain Rule with Leibniz Notation

Writing u=g(x)u=g(x) explicitly and using dydu\dfrac{dy}{du}, dudx\dfrac{du}{dx} makes multi-layer compositions easier to track, especially once three or more layers are nested.

Step-by-step — Differentiate $y = \sqrt{3x^2-x}$ using Leibniz notation
1
Name the inner expression: let u=3x2xu = 3x^2-x, so y=u=u1/2y = \sqrt{u} = u^{1/2}.
2
Differentiate yy with respect to uu: dydu=12u1/2=12u\dfrac{dy}{du} = \frac12 u^{-1/2} = \dfrac{1}{2\sqrt{u}} (power rule with n=12n=\frac12).
3
Differentiate uu with respect to xx: dudx=6x1\dfrac{du}{dx} = 6x-1 (power rule term by term on 3x2x3x^2-x).
4
Multiply and substitute uu back: dydx=dydududx=12u(6x1)=6x123x2x\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot\dfrac{du}{dx} = \dfrac{1}{2\sqrt{u}}\cdot(6x-1) = \dfrac{6x-1}{2\sqrt{3x^2-x}}.
Chaining through three or more layers

For y=sin((x3+1)2)y=\sin\big((x^3+1)^2\big)-style triple compositions (outer trig-like layer, middle power layer, inner polynomial), apply the chain rule repeatedly: differentiate the outermost layer, multiply by the derivative of the next layer in, multiply by the derivative of the layer after that, and so on until reaching a bare polynomial in xx.


04 · Implicit Differentiation

Every derivative computed so far assumed yy was written explicitly as a function of xx, like y=x2+1y=x^2+1. Some equations mix xx and yy together with no way to isolate yy cleanly — for example, x2+y2=25x^2+y^2=25. Implicit differentiation finds dydx\dfrac{dy}{dx} directly from such an equation, without first solving for yy.

Definition — Implicit Differentiation

To differentiate an equation containing both xx and yy:

  1. Differentiate both sides of the equation with respect to xx, term by term.
  2. Every time a term contains yy, apply the chain rule: treat yy as an inner function of xx, so ddx[yn]=nyn1dydx\dfrac{d}{dx}[y^n] = n y^{n-1}\cdot\dfrac{dy}{dx}.
  3. Solve the resulting equation algebraically for dydx\dfrac{dy}{dx}.
Step-by-step — Find $\dfrac{dy}{dx}$ for $x^2+y^2=25$
1
Differentiate both sides with respect to xx: ddx[x2]+ddx[y2]=ddx[25]\dfrac{d}{dx}[x^2] + \dfrac{d}{dx}[y^2] = \dfrac{d}{dx}[25].
2
Differentiate x2x^2 normally: power rule gives 2x2x.
3
Differentiate y2y^2 using the chain rule: treat yy as a function of xx; ddx[y2]=2ydydx\dfrac{d}{dx}[y^2] = 2y\cdot\dfrac{dy}{dx} — the extra factor dydx\dfrac{dy}{dx} appears precisely because yy is itself changing with xx, unlike the plain variable xx.
4
Differentiate the right side: 2525 is a constant, so its derivative is 00.
5
Assemble the differentiated equation: 2x+2ydydx=02x + 2y\dfrac{dy}{dx} = 0.
6
Solve algebraically for dydx\dfrac{dy}{dx}: 2ydydx=2x    dydx=2x2y=xy2y\dfrac{dy}{dx} = -2x \implies \dfrac{dy}{dx} = \dfrac{-2x}{2y} = -\dfrac{x}{y}.
Example — Slope on the circle at a specific point

For x2+y2=25x^2+y^2=25 (a circle of radius 55), find the slope at the point (3,4)(3,4) — check first that this point satisfies the equation: 32+42=9+16=253^2+4^2=9+16=25. ✓

Using dydx=xy\dfrac{dy}{dx}=-\dfrac{x}{y} from the step-block above: dydx(3,4)=34\dfrac{dy}{dx}\Big|_{(3,4)} = -\dfrac{3}{4}.

Geometrically, the radius to (3,4)(3,4) has slope 43\dfrac{4}{3}; the tangent line's slope 34-\dfrac34 is its negative reciprocal — the tangent to a circle is always perpendicular to the radius at the point of tangency.

❌ Treating y as a constant during implicit differentiation

On the same equation x2+y2=25x^2+y^2=25, a common mistake is writing ddx[y2]=2y\dfrac{d}{dx}[y^2]=2y, omitting the chain-rule factor dydx\dfrac{dy}{dx} entirely — treating yy as if it does not depend on xx.

Why it breaks: yy is defined implicitly in terms of xx through the equation itself; wherever xx moves, yy generally moves too, at the (unknown, to-be-solved-for) rate dydx\dfrac{dy}{dx}. Omitting that factor is the same category of error as omitting g(x)g'(x) in the chain rule (Section 02) — because differentiating y2y^2 with respect to xx is an application of the chain rule with inner function y(x)y(x).

Consequence: the resulting equation 2x+2y=02x+2y=0 gives y=xy=-x, a straight line — nothing like the correct slope formula dydx=x/y\dfrac{dy}{dx}=-x/y, and wrong at every point on the circle except where it happens to coincide by accident.


Implicit differentiation extends naturally to situations where every quantity in an equation is itself changing with respect to time tt — differentiate both sides with respect to tt instead of xx, applying the chain rule to every variable.

Example — Related rates, compressed

A trading desk's exposure follows V=PnV = P\cdot n, where PP is price per share and nn is number of shares held, both changing with time tt. Differentiating both sides with respect to tt using the product rule (Chapter 02) combined with the chain rule: dVdt=dPdtn+Pdndt\dfrac{dV}{dt} = \dfrac{dP}{dt}\cdot n + P\cdot\dfrac{dn}{dt}.

If P=50P=50 dollars, n=200n=200 shares, dPdt=2\dfrac{dP}{dt}=2 dollars/hour, and the desk is unwinding the position at dndt=10\dfrac{dn}{dt}=-10 shares/hour, then dVdt=2(200)+50(10)=400500=100\dfrac{dV}{dt} = 2(200) + 50(-10) = 400-500=-100: total exposure is falling by 100100 dollars/hour, even though the price itself is rising, because the position is being reduced faster than the price gain compensates.


06 · Exercises

EXERCISE 3.1

Identify the inner and outer functions first: the inner is the expression being cubed, the outer is the cubing operation itself.

y=(4x3)3y=(4x-3)^3. Inner g(x)=4x3g(x)=4x-3, outer f(u)=u3f(u)=u^3. f(u)=3u2    f(g(x))=3(4x3)2f'(u)=3u^2 \implies f'(g(x))=3(4x-3)^2. g(x)=4g'(x)=4. Chain rule: y=3(4x3)24=12(4x3)2y' = 3(4x-3)^2\cdot4 = 12(4x-3)^2.

Differentiate y=(4x3)3y=(4x-3)^3 using the chain rule. Identify the inner and outer functions explicitly.

EXERCISE 3.2

Rewrite the square root as a 12\frac12 power before applying the chain rule.

y=x3+2x=(x3+2x)1/2y=\sqrt{x^3+2x}=(x^3+2x)^{1/2}. Outer derivative: 12(x3+2x)1/2\frac12(x^3+2x)^{-1/2}. Inner derivative: 3x2+23x^2+2. Chain rule: y=12(x3+2x)1/2(3x2+2)=3x2+22x3+2xy' = \frac12(x^3+2x)^{-1/2}(3x^2+2) = \dfrac{3x^2+2}{2\sqrt{x^3+2x}}.

Differentiate y=x3+2xy=\sqrt{x^3+2x}.

EXERCISE 3.3

Differentiate both sides with respect to xx, remembering to apply the chain rule (nyn1dy/dxn y^{n-1}\,dy/dx) to every yy term, then isolate dy/dxdy/dx algebraically.

x3+y3=9x^3+y^3=9. Differentiate: 3x2+3y2dydx=03x^2 + 3y^2\dfrac{dy}{dx} = 0. Solve: 3y2dydx=3x2    dydx=3x23y2=x2y23y^2\dfrac{dy}{dx} = -3x^2 \implies \dfrac{dy}{dx} = \dfrac{-3x^2}{3y^2} = -\dfrac{x^2}{y^2}.

Find dydx\dfrac{dy}{dx} for x3+y3=9x^3+y^3=9 using implicit differentiation.

EXERCISE 3.4

This equation has a product of xx and yy — differentiating that term requires the product rule combined with the chain rule, since yy depends on xx.

xy+y2=6xy + y^2 = 6. Differentiate xyxy with the product rule: ddx[xy]=1y+xdydx=y+xdydx\dfrac{d}{dx}[xy] = 1\cdot y + x\cdot\dfrac{dy}{dx} = y + x\dfrac{dy}{dx}. Differentiate y2y^2 with the chain rule: 2ydydx2y\dfrac{dy}{dx}. Right side derivative: 00. Assemble: y+xdydx+2ydydx=0y + x\dfrac{dy}{dx} + 2y\dfrac{dy}{dx} = 0. Group dydx\dfrac{dy}{dx} terms: dydx(x+2y)=y\dfrac{dy}{dx}(x+2y) = -y. Solve: dydx=yx+2y\dfrac{dy}{dx} = \dfrac{-y}{x+2y}.

Find dydx\dfrac{dy}{dx} for xy+y2=6xy+y^2=6. Note that one term requires both the product rule and the chain rule together.

EXERCISE 3.5

Check the point satisfies the equation first, then use the implicit-differentiation formula for slope, then plug in the specific coordinates.

x2+y2=25x^2+y^2=25 at (4,3)(-4,3): check (4)2+32=16+9=25(-4)^2+3^2=16+9=25 ✓. From Section 04, dydx=xy\dfrac{dy}{dx}=-\dfrac{x}{y}. At (4,3)(-4,3): dydx=43=43\dfrac{dy}{dx} = -\dfrac{-4}{3} = \dfrac43.

Find the slope of the tangent line to x2+y2=25x^2+y^2=25 at the point (4,3)(-4,3).

EXERCISE 3.6

Differentiate the given relation with respect to time tt using the product rule, since both quantities in the product are changing with tt.

R=qpR = q\cdot p (revenue = quantity sold times price), both functions of tt. dRdt=dqdtp+qdpdt\dfrac{dR}{dt} = \dfrac{dq}{dt}\cdot p + q\cdot\dfrac{dp}{dt}. With q=1000q=1000 units, p=20p=20 dollars, dqdt=50\dfrac{dq}{dt}=50 units/day, dpdt=0.50\dfrac{dp}{dt}=-0.50 dollars/day: dRdt=50(20)+1000(0.50)=1000500=500\dfrac{dR}{dt} = 50(20) + 1000(-0.50) = 1000-500=500. Revenue is increasing at 500500 dollars/day — the volume gain outweighs the price decline.

Revenue is R=qpR=qp where quantity sold qq and price pp both change with time tt. Given q=1000q=1000 units, p=20p=20 dollars, dqdt=50\dfrac{dq}{dt}=50 units/day, and dpdt=0.50\dfrac{dp}{dt}=-0.50 dollars/day, find dRdt\dfrac{dR}{dt} using implicit (related-rate) differentiation.


07 · Chapter Summary

ConceptFormula / Rule
Composite functionf(g(x))f(g(x)): apply inner gg, then outer ff
Chain ruledydx=f(g(x))g(x)\dfrac{dy}{dx} = f'(g(x))\cdot g'(x)
Chain rule (Leibniz)dydx=dydududx\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot\dfrac{du}{dx}
Implicit differentiationDifferentiate both sides w.r.t. xx; chain-rule every yy term as nyn1dydxny^{n-1}\dfrac{dy}{dx}
Product + chain togetherTerms like xyxy need the product rule with a dydx\dfrac{dy}{dx} factor on the yy half
Related ratesDifferentiate a governing equation with respect to tt to link multiple changing quantities

Next: Chapter 04 — Applications of Derivatives: Core, where the derivative rules built here are used to analyze how functions rise, fall, and curve.