DIFFERENTIATION 08

The Chain Rule

The chain rule differentiates a function built inside another function.

The main idea

Suppose

\[ y=f(u) \]

and

\[ u=g(x). \]

Then \(y\) depends on \(x\) through the intermediate variable \(u\).

\[ x \longrightarrow u \longrightarrow y \]

The chain rule is

\[ \boxed{ \frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx} } \]

1. Why a chain appears

If \(x\) changes, then \(u\) changes.

Because \(y\) depends on \(u\), that change in \(u\) causes a change in \(y\).

So the overall rate of change is built from two rates:

\[ \text{change of }y\text{ with respect to }u \]

and

\[ \text{change of }u\text{ with respect to }x. \]

2. A simple example

Consider

\[ y=(3x+1)^4. \]

There is an inner function

\[ u=3x+1 \]

and an outer function

\[ y=u^4. \]

Differentiate the outer function:

\[ \frac{dy}{du}=4u^3. \]

Differentiate the inner function:

\[ \frac{du}{dx}=3. \]

Therefore,

\[ \frac{dy}{dx} = 4u^3(3). \]

Substitute back \(u=3x+1\):

\[ \boxed{ \frac{dy}{dx} = 12(3x+1)^3 } \]

3. The practical pattern

For

\[ y=[g(x)]^n, \]

differentiate the outer power first:

\[ n[g(x)]^{n-1}, \]

then multiply by the derivative of the inside:

\[ \boxed{ \frac{d}{dx}[g(x)]^n = n[g(x)]^{n-1}g'(x) } \]

4. Another example

Let

\[ y=(x^2+5)^3. \]

The outer derivative is

\[ 3(x^2+5)^2. \]

The inner derivative is

\[ 2x. \]

Therefore,

\[ \frac{dy}{dx} = 3(x^2+5)^2(2x). \]

So

\[ \boxed{ \frac{dy}{dx} = 6x(x^2+5)^2 } \]

5. Chain rule with exponential functions

Consider

\[ y=e^{2x}. \]

The outer function is

\[ e^u, \]

whose derivative is

\[ e^u. \]

The inner function is

\[ u=2x, \]

so

\[ \frac{du}{dx}=2. \]

Therefore,

\[ \boxed{ \frac{d}{dx}e^{2x} = 2e^{2x} } \]

6. Chain rule with logarithms

Consider

\[ y=\ln(3x+1). \]

For

\[ y=\ln u, \]

we have

\[ \frac{dy}{du} = \frac{1}{u}. \]

Also,

\[ u=3x+1 \]

gives

\[ \frac{du}{dx}=3. \]

Therefore,

\[ \frac{dy}{dx} = \frac{1}{3x+1}(3). \]

So

\[ \boxed{ \frac{dy}{dx} = \frac{3}{3x+1} } \]

7. Chain rule with trigonometric functions

Consider

\[ y=\sin(5x). \]

The outer derivative is

\[ \cos(5x), \]

and the inner derivative is

\[ 5. \]

Therefore,

\[ \boxed{ \frac{dy}{dx} = 5\cos(5x) } \]

8. Several layers

The chain rule can be applied repeatedly.

Consider

\[ y=\sin\left((2x+1)^3\right). \]

The layers are

\[ x \longrightarrow 2x+1 \longrightarrow (2x+1)^3 \longrightarrow \sin\left((2x+1)^3\right). \]

Differentiate from the outside inward:

\[ \frac{dy}{dx} = \cos\left((2x+1)^3\right) \cdot 3(2x+1)^2 \cdot 2. \]

Therefore,

\[ \boxed{ \frac{dy}{dx} = 6(2x+1)^2 \cos\left((2x+1)^3\right) } \]

9. Why the Leibniz notation is useful

The chain rule can be written

\[ \frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx}. \]

The \(du\) terms appear to cancel:

\[ \frac{dy}{\cancel{du}} \frac{\cancel{du}}{dx} = \frac{dy}{dx}. \]

This is a useful way to remember the structure.

But the chain rule is the mathematical reason the calculation is valid; it is not justified merely by treating derivatives as ordinary fractions.

10. Function notation form

If

\[ y=f(g(x)), \]

then

\[ \boxed{ \frac{d}{dx}f(g(x)) = f'(g(x))\,g'(x) } \]

The derivative of the outer function is evaluated at the inner function, then multiplied by the derivative of the inner function.

11. A useful way to identify the layers

Start from the outside and ask:

What operation is being performed last?

For

\[ (1+x^2)^5, \]

the last operation is “raise to the fifth power”.

So the outer function is

\[ u^5 \]

and the inner function is

\[ u=1+x^2. \]

This makes the chain rule easier to see.

12. Common mistake

For

\[ y=(x^2+1)^4, \]

do not write only

\[ 4(x^2+1)^3. \]

That differentiates the outer function but ignores the changing inner function.

The correct derivative is

\[ 4(x^2+1)^3(2x). \]

Therefore,

\[ \boxed{ \frac{dy}{dx} = 8x(x^2+1)^3 } \]

13. The central structure

\[ \boxed{ \text{outer rate} \times \text{inner rate} = \text{overall rate} } \]

In symbols,

\[ \boxed{ \frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx} } \]

The chain rule is one of the most important ideas in all of calculus.