girgit.org

Continuity and Differentiability

The chain rule: peeling an onion

The big ideaTo differentiate a function inside a function, differentiate the outside and leave the inside alone, then multiply by the derivative of the inside: \( \frac{df}{dx} = \frac{dv}{dt} \cdot \frac{dt}{dx} \).

In simple words

Some functions are wrapped, like an onion. To see how fast the whole onion changes, peel one layer at a time. Ask how fast the outer layer changes, then how fast the next layer changes, and so on. Multiply all those answers together. That is the chain rule.

Why we need it

Try to differentiate \( f(x) = (3x - 2)^2 \). You could expand it: \( 9x^2 - 12x + 4 \), so \( f'(x) = 18x - 12 = 6(3x - 2) \). Now look at that answer another way. Put \( t = 3x - 2 \), so \( f = t^2 \). Then

\[ \frac{df}{dt} = 2t = 2(3x - 2), \qquad \frac{dt}{dx} = 3, \qquad \frac{df}{dt} \cdot \frac{dt}{dx} = 6(3x - 2) \]

The same answer, with no expanding. That matters when the power is 5, or 50, and expanding would take a page.

Theorem 4: the chain rule

Let \( f = v \circ u \) be a composite function: \( f(x) = v(u(x)) \). Put \( t = u(x) \). If \( \frac{dt}{dx} \) and \( \frac{dv}{dt} \) both exist, then

\[ \frac{df}{dx} = \frac{dv}{dt} \cdot \frac{dt}{dx} \]

The book skips the proof. With three layers, \( t = v(x) \), \( s = u(t) \) and \( f = w(s) \), the chain just gets longer:

\[ \frac{df}{dx} = \frac{dw}{ds} \cdot \frac{ds}{dt} \cdot \frac{dt}{dx} \]

Any number of layers works the same way, as long as every derivative in the chain exists. Always write the final answer in terms of \( x \).

Peel the onion: outside first

  • 1. Find the outermost operation. Differentiate it, keeping the inside exactly as it is.
  • 2. Multiply by the derivative of what was inside.
  • 3. If that inside is itself wrapped, repeat.

Try it: follow one number down through the layers of each worked example and watch the rates multiply.

Worked example 1: a power of a bracket

\( \frac{d}{dx}(3x - 2)^5 = 5(3x - 2)^4 \cdot 3 = 15(3x - 2)^4 \).

Worked example 2: a function of a power

\( y = \cos(x^3) \). Outside: cos, inside: \( x^3 \).

\( \frac{dy}{dx} = -\sin(x^3) \cdot 3x^2 = -3x^2 \sin(x^3) \).

Worked example 3: three layers

\( y = \sin^2(4x) = [\sin(4x)]^2 \). The layers are: square, then sin, then \( 4x \).

  1. Square: \( 2\sin(4x) \).
  2. Sine: \( \cos(4x) \).
  3. Inside: \( 4 \).

Multiply: \( \frac{dy}{dx} = 2\sin(4x) \cdot \cos(4x) \cdot 4 = 8\sin(4x)\cos(4x) = 4\sin(8x) \).

Worked example 4: a root of a trig function

\( y = \sqrt{1 + \tan x} = (1 + \tan x)^{1/2} \).

\( \frac{dy}{dx} = \frac{1}{2}(1 + \tan x)^{-1/2} \cdot \sec^2 x = \dfrac{\sec^2 x}{2\sqrt{1 + \tan x}} \).

Worked example 5: a quotient with a chain inside

\( y = \dfrac{\sin(2x)}{\cos(3x)} \). Quotient rule, with chain rule for each part: \( (\sin 2x)' = 2\cos 2x \), \( (\cos 3x)' = -3\sin 3x \).

\[ \frac{dy}{dx} = \frac{2\cos 2x \cos 3x + 3\sin 2x \sin 3x}{\cos^2 3x} \]

Guess first: what is the derivative of sin 2x?

We know \( \frac{d}{dx}\sin x = \cos x \). Guess: is \( \frac{d}{dx}\sin 2x = \cos 2x \)?

Pick an answer, then compare the true tangent with the one \( \cos 2x \) would give.

See what happens
No: it is \( 2\cos 2x \). The inside, \( 2x \), runs twice as fast as \( x \), so the sine wave is squeezed to half its width and is twice as steep everywhere. Check at \( x = 0 \): \( \sin 2x \approx 2x \) for small \( x \), so the slope there is 2, not 1. Forgetting to multiply by the inside's derivative is the most common slip in all of calculus.

Don't mix these up

  • \( \sin^2 x = (\sin x)^2 \): derivative \( 2\sin x\cos x \). But \( \sin(x^2) \): derivative \( 2x\cos(x^2) \). The order of the layers is different.
  • The chain rule multiplies; the product rule adds. \( x\sin x \) is a product (two functions side by side); \( \sin(x^2) \) is a composite (one inside the other).

Try it. Differentiate (a) \( \sin(x^2 + 3) \), (b) \( \cos(\sin x) \), (c) \( \tan^3(2x) \).

Answer
(a) \( 2x\cos(x^2 + 3) \). (b) \( -\sin(\sin x) \cdot \cos x \). (c) \( 3\tan^2(2x) \cdot \sec^2(2x) \cdot 2 = 6\tan^2(2x)\sec^2(2x) \).

Words to know

Composite function
One function applied to the output of another, \( v(u(x)) \).
Chain rule
\( \frac{df}{dx} = \frac{dv}{dt} \cdot \frac{dt}{dx} \): multiply the rates of each layer.
Outer function
The last operation done; it is differentiated first.
Inner function
What sits inside the outer function; its derivative is the extra factor.

What is \( \frac{d}{dx}(5x + 1)^4 \)?

  1. \( 4(5x + 1)^3 \)
  2. \( 20(5x + 1)^3 \)
  3. \( 20(5x + 1)^4 \)

What is \( \frac{d}{dx}\cos(x^2) \)?

  1. \( -\sin(x^2) \)
  2. \( 2x\sin(x^2) \)
  3. \( -2x\sin(x^2) \)

Which function needs the chain rule (and not only the product rule)?

  1. \( x^2 \sin x \)
  2. \( \sin\sqrt{x} \)
  3. \( x^3 + 2x \)