Unpack the chain rule
Differentiate (3x + 1)² by spotting its inner and outer functions.
A function inside a function
In (3x + 1)², first you calculate 3x + 1. Then you square that result. There are two layers: the inner function g(x) = 3x + 1 and the outer function f(u) = u².
Take it one layer at a time
- The derivative of the outer function u² is 2u.
- Put the inner function back: 2(3x + 1).
- The derivative of the inner function 3x + 1 is 3.
- Multiply: 2(3x + 1) × 3 = 6(3x + 1).
In symbols, when f and g are differentiable, the derivative of f(g(x)) is f′(g(x)) × g′(x).
Check it another way
Expand (3x + 1)² to get 9x² + 6x + 1. Differentiating term by term gives 18x + 6. This is the same as 6(3x + 1).
Expansion is a useful check for this example. The chain rule also works when expanding would be inconvenient.
The easy-to-miss step
If you stop at 2(3x + 1), you have only differentiated the outer function. The inner function changes three times as fast as x, so its derivative contributes the extra factor of 3.