Unit 3, lesson 25

The Chain Rule

How to differentiate a function of a function by multiplying the rates of the outer and inner parts, how this handles nested compositions and related rates, and which differentiability conditions it needs.

  • Theory part 49
  • Practice part 50
  • Differentiation Rules

Theory, part 49

Nothing loads from YouTube until you press play.

Practice, part 50

Nothing loads from YouTube until you press play.

If a gear turns three times as fast as a second gear, and the second turns twice as fast as a third, then the first turns six times as fast as the third. Rates multiply along a chain. The chain rule says exactly this for functions built one inside another, and it is the rule you will use more than any other.

Key terms

Composition

Definition The composition of ff and gg is the function f∘gf \circ g given by

(f∘g)(x)=f(g(x)).(f \circ g)(x) = f(g(x)).

Its domain is the set of all xx in the domain of gg for which g(x)g(x) lies in the domain of ff.

In plain words Apply gg first, then feed the result into ff. An input is allowed only if both steps make sense.

Example With g(x)=1−x2g(x) = 1 - x^2 and f(u)=uf(u) = \sqrt{u}, (f∘g)(x)=1−x2(f \circ g)(x) = \sqrt{1 - x^2}. We need 1−x2≥01 - x^2 \ge 0, so the domain is [−1,1][-1, 1]. In the other order, (g∘f)(x)=1−(x)2=1−x(g \circ f)(x) = 1 - (\sqrt{x})^2 = 1 - x with domain [0,∞)[0, \infty), a different function.

Inner and outer functions

Definition When a function is written as y=f(g(x))y = f(g(x)), the function gg is the inner function and ff is the outer function. It is common to name the intermediate value, u=g(x)u = g(x), so that y=f(u)y = f(u). The same function can usually be split in more than one way, and any split into differentiable pieces works.

In plain words The inner function is what you compute first. The outer function is the last operation you would do with a calculator.

Example For y=(3x2+1)5y = (3x^2 + 1)^5 the inner function is u=3x2+1u = 3x^2 + 1 and the outer function is y=u5y = u^5. For y=x3+4y = \sqrt{x^3 + 4} the inner function is u=x3+4u = x^3 + 4 and the outer is y=uy = \sqrt{u}.

Derivative of a composite

Definition If gg is differentiable at xx and ff is differentiable at g(x)g(x), then f∘gf \circ g is differentiable at xx and

(f∘g)′(x)=f′(g(x))⋅g′(x).(f \circ g)'(x) = f'(g(x)) \cdot g'(x).

In Leibniz notation, with y=f(u)y = f(u) and u=g(x)u = g(x),

dydx=dydu⋅dudx,\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx},

where dydu\frac{dy}{du} is evaluated at u=g(x)u = g(x).

In plain words Differentiate the outer function, leaving the inner one inside it untouched, then multiply by the derivative of the inner function.

Example For y=(3x2+1)5y = (3x^2 + 1)^5,

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

At x=1x = 1 this is 30⋅44=768030 \cdot 4^4 = 7680. Expanding (3x2+1)5(3x^2 + 1)^5 first would give the same answer with much more work.

Nested compositions

Definition For three functions, if hh is differentiable at xx, gg is differentiable at h(x)h(x) and ff is differentiable at g(h(x))g(h(x)), then

ddxf(g(h(x)))=f′(g(h(x)))⋅g′(h(x))⋅h′(x).\frac{d}{dx} f(g(h(x))) = f'(g(h(x))) \cdot g'(h(x)) \cdot h'(x).

Longer chains work the same way, with one factor for each layer.

In plain words Peel the layers from the outside in. Each layer contributes its derivative, evaluated at whatever sits inside it.

Example Let y=1+(x2+1)3y = \sqrt{1 + (x^2 + 1)^3}. The layers are  ⋅ \sqrt{\,\cdot\,}, then 1+( ⋅ )31 + (\,\cdot\,)^3, then x2+1x^2 + 1. So

dydx=121+(x2+1)3⋅3(x2+1)2⋅2x.\frac{dy}{dx} = \frac{1}{2\sqrt{1 + (x^2 + 1)^3}} \cdot 3(x^2 + 1)^2 \cdot 2x.

At x=1x = 1 we have x2+1=2x^2 + 1 = 2 and 1+23=91 + 2^3 = 9, so the slope there is

12⋅3⋅3⋅22⋅2=16⋅12⋅2=4.\frac{1}{2 \cdot 3} \cdot 3 \cdot 2^2 \cdot 2 = \frac{1}{6} \cdot 12 \cdot 2 = 4.

Rates with intermediate variables

Definition If a quantity yy is a differentiable function of uu, and uu is a differentiable function of time tt, then yy changes with tt at the rate

dydt=dydu⋅dudt,\frac{dy}{dt} = \frac{dy}{du} \cdot \frac{du}{dt},

with dydu\frac{dy}{du} evaluated at the current value of uu. The units match, since units of yy per uu times units of uu per tt give units of yy per tt.

In plain words If you know how yy responds to uu and how fast uu is changing, multiply to get how fast yy is changing.

Example A spherical balloon has volume V=43πr3V = \frac{4}{3}\pi r^3, so dVdr=4πr2\frac{dV}{dr} = 4\pi r^2. If the radius grows at 22 centimeters per second, then at the moment r=3r = 3 centimeters,

dVdt=4π⋅32⋅2=72π≈226 cubic centimeters per second.\frac{dV}{dt} = 4\pi \cdot 3^2 \cdot 2 = 72\pi \approx 226 \text{ cubic centimeters per second}.

Differentiability assumptions

Definition The chain rule needs gg differentiable at xx and ff differentiable at the point g(x)g(x), not at xx. These conditions are sufficient but not necessary. If one of them fails, the composite may or may not be differentiable, and the formula cannot be used to decide. A careful proof also has to handle points where g(x+h)=g(x)g(x + h) = g(x) for small h≠0h \neq 0, which is why the tempting argument of cancelling Δu\Delta u in ΔyΔu⋅ΔuΔx\frac{\Delta y}{\Delta u} \cdot \frac{\Delta u}{\Delta x} is not a complete proof.

In plain words Check that the inner function is smooth at your point and the outer function is smooth where the inner one lands. If not, go back to the limit definition.

Example Take f(u)=∣u∣f(u) = \lvert u \rvert and g(x)=x2−1g(x) = x^2 - 1 at x=1x = 1. Here g(1)=0g(1) = 0 and ff is not differentiable at 00, so the chain rule does not apply. In fact ∣x2−1∣\lvert x^2 - 1 \rvert has one-sided slopes −2-2 and 22 at x=1x = 1, a corner. On the other hand, with f(u)=u2f(u) = u^2 and g(x)=∣x∣g(x) = \lvert x \rvert the inner function fails at 00, yet f(g(x))=x2f(g(x)) = x^2 is differentiable there. The chain rule is silent in both cases, and the answers differ.

Check yourself

  1. Differentiate y=x3+4y = \sqrt{x^3 + 4} and find the slope at x=2x = 2.
Show the answer

With inner function u=x3+4u = x^3 + 4 the chain rule gives

y′=3x22x3+4.y' = \frac{3x^2}{2\sqrt{x^3 + 4}}.

At x=2x = 2 the slope is

12212=612=3.\frac{12}{2 \sqrt{12}} = \frac{6}{\sqrt{12}} = \sqrt{3}.
  1. Suppose g(1)=3g(1) = 3, g′(1)=−2g'(1) = -2 and f′(3)=5f'(3) = 5. Find (f∘g)′(1)(f \circ g)'(1).
Show the answer

The chain rule gives

(f∘g)′(1)=f′(g(1))⋅g′(1)=f′(3)⋅(−2)=−10.(f \circ g)'(1) = f'(g(1)) \cdot g'(1) = f'(3) \cdot (-2) = -10.
  1. Differentiate y=1(2x−5)3y = \frac{1}{(2x - 5)^3}.
Show the answer

Write y=(2x−5)−3y = (2x - 5)^{-3}. For x≠52x \neq \frac{5}{2} the chain rule gives

y′=−3(2x−5)−4⋅2=−6(2x−5)4.y' = -3(2x - 5)^{-4} \cdot 2 = -\frac{6}{(2x - 5)^4}.

How this lesson connects

It also uses composition of functions.