Instant PDF download, name-and-email checkout. Complete bundle: every Economics, Statistics and Mathematics book
Mathematics guide, Unit 3, step 13 of 33Previous stepNext step

Step 13: The Chain Rule

SyllabusAP 3.1 · 9709 P1 1.7 · IB SL 5.6
In 30 seconds
  • A composite function has an inside and an outside, as in \( (3x^2 + 1)^5 \). The chain rule says \( \dfrac{dy}{dx} = \dfrac{dy}{du} \times \dfrac{du}{dx} \): differentiate the outside, leave the inside alone, then multiply by the derivative of the inside.
  • Writing \( a^x = e^{x\ln a} \) gives \( \dfrac{d}{dx}(a^x) = a^x\ln a \), and \( \log_a x = \dfrac{\ln x}{\ln a} \) gives \( \dfrac{d}{dx}(\log_a x) = \dfrac{1}{x\ln a} \).
  • The tangent at \( (x_1, y_1) \) is \( y-y_1 = m(x-x_1) \) with \( m = f'(x_1) \); the normal has gradient \( -\dfrac{1}{m} \).
  • Exam point: a derivative is a rate, measured in units of \( y \) per unit of \( x \). Always state the units and say what the sign means.
Video lesson coming soonA short animated lesson for this step will appear here.

Functions inside functions

How would you differentiate \( (3x^2 + 1)^5 \)? Expanding the bracket first would be slow and error-prone, and the power rule from Step 12 does not apply directly, because the thing raised to the power 5 is not \( x \). This is a composite function (Step 3): an inside function \( u = 3x^2 + 1 \) is fed into an outside function \( y = u^5 \).

Key termChain rule: if \( y \) is a function of \( u \) and \( u \) is a function of \( x \), then \( \dfrac{dy}{dx} = \dfrac{dy}{du} \times \dfrac{du}{dx} \). In function notation, \( \dfrac{d}{dx}\,f\big(g(x)\big) = f’\big(g(x)\big)\,g'(x) \).

Why multiply? Rates of change multiply, like gears. If gear \( Y \) turns 3 times for each turn of gear \( U \), and \( U \) turns 2 times for each turn of gear \( X \), then \( Y \) turns \( 3 \times 2 = 6 \) times for each turn of \( X \). In symbols, for small changes \( \dfrac{\Delta y}{\Delta x} = \dfrac{\Delta y}{\Delta u} \cdot \dfrac{\Delta u}{\Delta x} \), which is just cancelling \( \Delta u \). As \( \Delta x \to 0 \), \( \Delta u \to 0 \) as well, and the chord gradients become derivatives. (A full proof also deals with the case where \( \Delta u \) is zero, but the idea is the same.) This is where Leibniz notation earns its keep: the \( du \)s look as if they cancel, and the rule says that, in effect, they do.

So for \( y = (3x^2 + 1)^5 \): \( \dfrac{dy}{du} = 5u^4 \) and \( \dfrac{du}{dx} = 6x \), giving \( \dfrac{dy}{dx} = 5(3x^2 + 1)^4 \cdot 6x = 30x(3x^2 + 1)^4 \). With practice you skip writing \( u \) and say it in words: “five times the bracket to the four, times the derivative of the bracket”.

Worked example

Differentiate (a) \( (2x^3-5)^4 \) (b) \( \dfrac{1}{\sqrt{4x + 1}} \) (c) \( e^{\sin x} \) (d) \( \ln(x^2 + 4) \).

Step 1(a) Outside \( u^4 \), inside \( u = 2x^3-5 \) with \( u’ = 6x^2 \): \( 4(2x^3-5)^3 \cdot 6x^2 = 24x^2(2x^3-5)^3 \).
Step 2(b) Rewrite as \( (4x + 1)^{-1/2} \): \( -\tfrac{1}{2}(4x + 1)^{-3/2} \cdot 4 = -\dfrac{2}{(4x + 1)^{3/2}} \).
Step 3(c) Outside \( e^u \), inside \( u = \sin x \): \( e^{\sin x} \cdot \cos x = \cos x\, e^{\sin x} \).
Step 4(d) Outside \( \ln u \), inside \( u = x^2 + 4 \): \( \dfrac{1}{x^2 + 4} \cdot 2x = \dfrac{2x}{x^2 + 4} \).

In every case the outside function was differentiated with its inside left untouched, then multiplied by the derivative of the inside.

Some chains appear so often that they are worth knowing on sight. Here \( k \) and \( b \) are constants and \( f \) is any differentiable function.

FunctionDerivativeExample
\( [f(x)]^n \)\( n[f(x)]^{n-1}f'(x) \)\( (1-x^2)^3 \to -6x(1-x^2)^2 \)
\( e^{f(x)} \)\( f'(x)e^{f(x)} \)\( e^{5x} \to 5e^{5x} \)
\( \ln f(x) \)\( \dfrac{f'(x)}{f(x)} \)\( \ln(3x + 2) \to \dfrac{3}{3x + 2} \)
\( \sin(kx + b) \)\( k\cos(kx + b) \)\( \sin 4x \to 4\cos 4x \)
\( \cos(kx + b) \)\( -k\sin(kx + b) \)\( \cos(2x-1) \to -2\sin(2x-1) \)
Common mistakeForgetting the inside. \( \dfrac{d}{dx}(\sin 3x) \) is \( 3\cos 3x \), not \( \cos 3x \). And read the notation carefully: \( \sin^2 x \) means \( (\sin x)^2 \), with derivative \( 2\sin x\cos x \), while \( \sin(x^2) \) has derivative \( 2x\cos(x^2) \). Before differentiating, ask yourself which function is applied last; that is the outside.

Chains combined with other rules

Real questions mix the rules. The trick is to see the overall structure first. Is the whole thing a product, a quotient or a chain? Apply that rule, and use the others for the pieces.

Worked example

Differentiate \( y = x(1-2x)^3 \) and simplify fully.

Step 1Overall it is a product: \( u = x \), \( v = (1-2x)^3 \).
Step 2\( u’ = 1 \). The chain rule gives \( v’ = 3(1-2x)^2 \cdot (-2) = -6(1-2x)^2 \).
Step 3\( \dfrac{dy}{dx} = x \cdot (-6)(1-2x)^2 + (1-2x)^3 \).
Step 4Take out the common factor \( (1-2x)^2 \): \( (1-2x)^2\big[(1-2x)-6x\big] = (1-2x)^2(1-8x) \).

Factorising rather than expanding shows at once that the gradient is zero at \( x = \tfrac{1}{2} \) and \( x = \tfrac{1}{8} \).

AP free-response questions often give no formulas at all, only a table of values, and ask for the derivative of a composite. The chain rule works just as well with numbers.

Worked example

The table gives values of the differentiable functions \( f \) and \( g \) and their derivatives.

\( x \)\( f(x) \)\( f'(x) \)\( g(x) \)\( g'(x) \)
14\( -3 \)24
2123\( -1 \)
36512

Find (a) \( h'(1) \), where \( h(x) = f\big(g(x)\big) \) (b) \( k'(2) \), where \( k(x) = [g(x)]^3 \).

Step 1(a) \( h'(x) = f’\big(g(x)\big) \cdot g'(x) \), so \( h'(1) = f’\big(g(1)\big) \cdot g'(1) = f'(2) \cdot g'(1) \).
Step 2From the table, \( f'(2) = 2 \) and \( g'(1) = 4 \), so \( h'(1) = 8 \).
Step 3(b) \( k'(x) = 3[g(x)]^2 \cdot g'(x) \), so \( k'(2) = 3 \times 3^2 \times (-1) = -27 \).

The classic slip in (a) is to use \( f'(1) \) instead of \( f'(g(1)) \). The outside derivative is evaluated at the inside value, \( g(1) = 2 \).

Any base: aˣ and logₐ x

The chain rule also explains the strange multipliers from Step 12, where the gradient of \( 2^x \) was about 0.693 times its height. Since \( a = e^{\ln a} \), we can write \( a^x = e^{x\ln a} \). That is \( e^{kx} \) with the constant \( k = \ln a \), so its derivative is \( (\ln a)\,e^{x\ln a} = a^x\ln a \). And indeed \( \ln 2 \approx 0.693 \) and \( \ln 3 \approx 1.099 \). For logarithms, the change of base rule gives \( \log_a x = \dfrac{\ln x}{\ln a} \), which is just a constant multiple of \( \ln x \).

\[ \frac{d}{dx}\left(a^x\right) = a^x\ln a \qquad \frac{d}{dx}\left(\log_a x\right) = \frac{1}{x\ln a} \]

The same idea finishes off the power rule for any real power. For \( x > 0 \), \( x^n = e^{n\ln x} \), so \( \dfrac{d}{dx}(x^n) = e^{n\ln x} \cdot \dfrac{n}{x} = x^n \cdot \dfrac{n}{x} = nx^{n-1} \).

Worked example

(a) Differentiate \( 3^{2x} \) and \( \log_{10}(5x) \). (b) Find the gradient of \( y = 5^x \) at \( x = 2 \), to 2 decimal places.

Step 1(a) Chain rule with inside \( 2x \): \( \dfrac{d}{dx}(3^{2x}) = 3^{2x}\ln 3 \cdot 2 = 2\ln 3 \cdot 3^{2x} \).
Step 2\( \log_{10}(5x) = \log_{10}5 + \log_{10}x \), and the first term is a constant, so the derivative is \( \dfrac{1}{x\ln 10} \).
Step 3(b) \( \dfrac{dy}{dx} = 5^x\ln 5 \). At \( x = 2 \): \( 25\ln 5 \approx 40.24 \).

Notice in Step 2 that the 5 disappeared, just as \( \ln(2x) \) and \( \ln x \) have the same derivative.

Exam tipThe chain rule is AP topic 3.1, Cambridge 9709 Paper 1 (for powers of a function, such as \( (2x-1)^5 \)) and Papers 2 and 3 for composites with \( e^x \), \( \ln x \) and trigonometric functions, and IB SL 5.6. The derivatives of \( a^x \) and \( \log_a x \) are listed explicitly only in IB HL (5.15); Cambridge 9709 excludes the change of base rule, but you can still meet \( a^x \) there by writing it as \( e^{x\ln a} \). AP questions occasionally use them too, so they are worth knowing.

Tangents and normals

The tangent at a point \( (x_1, y_1) \) on a curve has gradient \( m = f'(x_1) \). The normal is the line through the same point at right angles to the tangent. Perpendicular gradients multiply to \( -1 \) (Step 4), so the normal has gradient \( -\dfrac{1}{m} \), provided \( m \neq 0 \).

\[ \begin{aligned} \text{tangent: } \; y-y_1 &= m(x-x_1) \\ \text{normal: } \; y-y_1 &= -\frac{1}{m}(x-x_1) \end{aligned} \]
Worked example

Find the equations of the tangent and the normal to \( y = \sqrt{2x + 1} \) at the point where \( x = 4 \). Give the normal in the form \( ax + by + c = 0 \).

Step 1The point: \( y = \sqrt{9} = 3 \), so it is \( (4, 3) \).
Step 2The gradient: \( y = (2x + 1)^{1/2} \), so \( \dfrac{dy}{dx} = \tfrac{1}{2}(2x + 1)^{-1/2} \cdot 2 = \dfrac{1}{\sqrt{2x + 1}} \), which is \( \tfrac{1}{3} \) at \( x = 4 \).
Step 3Tangent: \( y-3 = \tfrac{1}{3}(x-4) \), so \( y = \tfrac{1}{3}x + \tfrac{5}{3} \).
Step 4Normal: gradient \( -3 \), so \( y-3 = -3(x-4) \), giving \( y = -3x + 15 \), or \( 3x + y-15 = 0 \).

Figure 1 shows both lines. The normal crosses the x-axis at \( (5, 0) \).

Tangent and normal to y = √(2x + 1) at (4, 3)
y = √(2x + 1)tangent: y = x/3 + 5/3 (gradient 1/3)normal: y = −3x + 15 (gradient −3)
123456789123450xy(4, 3)normal meets x-axis at (5, 0)
Figure 1. The tangent touches the curve at (4, 3) with the curve’s gradient, 1/3. The normal passes through the same point at right angles, with gradient −3, the negative reciprocal. The axes use equal scales so the right angle looks right.
Exam tipFind \( y_1 \) from the original equation of the curve, never from \( \dfrac{dy}{dx} \). If the answer must be in the form \( ax + by + c = 0 \), clear the fractions and give integer coefficients. When the tangent is horizontal (\( m = 0 \)), the normal is the vertical line \( x = x_1 \).

Rates of change, with units

A derivative is a rate. If \( y \) is measured in one unit and \( x \) in another, then \( \dfrac{dy}{dx} \) is measured in units of \( y \) per unit of \( x \). In context, an answer without units, or without a sentence saying what it means, usually loses a mark.

Worked example

A town’s population after \( t \) years is \( P = 3000e^{0.025t} \). Find \( \dfrac{dP}{dt} \) when \( t = 8 \) and interpret it.

Step 1Chain rule: \( \dfrac{dP}{dt} = 3000 \times 0.025e^{0.025t} = 75e^{0.025t} \).
Step 2At \( t = 8 \): \( 75e^{0.2} \approx 91.6 \).
Step 3Units: people per year. The sign is positive.

After 8 years the population is increasing at about 92 people per year.

An economics example: depreciation. A car bought for $20,000 loses 15% of its value each year, so after \( t \) years it is worth \( V = 20000 \times 0.85^t \) dollars. Using the \( a^x \) rule, \( \dfrac{dV}{dt} = 20000 \times 0.85^t \ln 0.85 \). At \( t = 3 \) this is \( 12282.50 \times (-0.1625) \approx -1996 \) dollars per year. The negative sign says the value is falling: three years in, the car is losing value at about $1,996 a year (Figure 2). Because \( \ln 0.85 \) is negative and \( 0.85^t \) shrinks, the losses get smaller every year.

A car worth $20,000 losing 15% of its value a year $
V = 20000 × 0.85ᵗtangent at t = 3: gradient ≈ −1996 $ per year
12345678910400080001200016000200000years, tvalue ($)(3, 12282.50)
Figure 2. The gradient of the value curve is negative and shrinking in size: the car loses about $1,996 a year at t = 3, but less each year after, because 15% of a smaller value is a smaller amount.

A second economics example: chains of causes. A workshop’s daily cost is \( C = 800 + 30L + 0.4L^2 \) dollars when it employs \( L \) workers, and it is hiring steadily, with \( L = 20 + 3t \) after \( t \) weeks. At \( t = 4 \), \( L = 32 \), and

\[ \frac{dC}{dt} = \frac{dC}{dL} \times \frac{dL}{dt} = (30 + 0.8L) \times 3. \]

At \( L = 32 \) this is \( 55.6 \times 3 = 166.8 \). Each extra worker adds $55.60 to the daily cost, and three workers arrive each week, so the daily cost is rising by $166.80 per week. The units chain together too: dollars per worker times workers per week gives dollars per week.

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. Differentiate \( y = (5x-3)^6 \). Show worked answer
Outside \( u^6 \), inside \( u = 5x-3 \) with \( u’ = 5 \).
\( \dfrac{dy}{dx} = 6(5x-3)^5 \times 5 \).
\( = 30(5x-3)^5 \).
EasyQ2. Differentiate \( y = e^{4x}-\cos 2x \). Show worked answer
The derivative of \( e^{4x} \) is \( 4e^{4x} \).
The derivative of \( \cos 2x \) is \( -2\sin 2x \), so subtracting it gives \( +2\sin 2x \).
\( \dfrac{dy}{dx} = 4e^{4x} + 2\sin 2x \).
MediumQ3. Find the gradient of \( y = \ln(3x^2 + 1) \) at \( x = 1 \). Show worked answer
\( \dfrac{d}{dx}\ln f(x) = \dfrac{f'(x)}{f(x)} \), so \( \dfrac{dy}{dx} = \dfrac{6x}{3x^2 + 1} \).
At \( x = 1 \): \( \dfrac{6}{4} = \dfrac{3}{2} \).
MediumQ4. Differentiate \( y = x^2\sqrt{1 + x} \), giving your answer as a single fraction. Show worked answer
Product rule: \( u = x^2,\ u’ = 2x,\ v = (1 + x)^{1/2},\ v’ = \dfrac{1}{2\sqrt{1 + x}} \).
\( \dfrac{dy}{dx} = 2x\sqrt{1 + x} + \dfrac{x^2}{2\sqrt{1 + x}} \).
Common denominator \( 2\sqrt{1 + x} \): \( \dfrac{4x(1 + x) + x^2}{2\sqrt{1 + x}} \).
\( = \dfrac{x(5x + 4)}{2\sqrt{1 + x}} \).
MediumQ5. An investment is worth \( V = 8000 \times 1.05^t \) dollars after \( t \) years. Find \( \dfrac{dV}{dt} \) when \( t = 10 \), with units, and interpret it. Show worked answer
\( \dfrac{dV}{dt} = 8000 \times 1.05^t \ln 1.05 \).
At \( t = 10 \): \( 8000 \times 1.62889 \times 0.04879 \approx 635.8 \).
Units: dollars per year.
After 10 years the investment’s value is growing at about $636 per year.
ExamQ6. The curve \( y = \dfrac{8}{(2x-1)^2} \) passes through the point \( P \) where \( x = \tfrac{3}{2} \). (a) Find \( \dfrac{dy}{dx} \). [2] (b) Find the equation of the tangent at \( P \), and show that the normal at \( P \) has equation \( 2x-8y + 13 = 0 \). [4] (c) The tangent and the normal at \( P \) meet the x-axis at \( A \) and \( B \). Find the area of triangle \( APB \). [3] Show worked answer
(a) \( y = 8(2x-1)^{-2} \), so \( \dfrac{dy}{dx} = -16(2x-1)^{-3} \times 2 = -\dfrac{32}{(2x-1)^3} \). [M1 A1]
(b) At \( x = \tfrac{3}{2} \): \( 2x-1 = 2 \), so \( y = \tfrac{8}{4} = 2 \) and \( \dfrac{dy}{dx} = -\tfrac{32}{8} = -4 \). [M1]
Tangent: \( y-2 = -4(x-\tfrac{3}{2}) \), so \( y = -4x + 8 \). [A1]
Normal gradient \( \tfrac{1}{4} \): \( y-2 = \tfrac{1}{4}(x-\tfrac{3}{2}) \). [M1]
Multiply by 8: \( 8y-16 = 2x-3 \), so \( 2x-8y + 13 = 0 \). [A1]
(c) Tangent meets \( y = 0 \) at \( x = 2 \), so \( A = (2, 0) \). Normal meets \( y = 0 \) at \( x = -\tfrac{13}{2} \), so \( B = (-\tfrac{13}{2}, 0) \). [M1 A1]
Base \( AB = 2 + \tfrac{13}{2} = \tfrac{17}{2} \), height = y-coordinate of \( P \) = 2.
Area \( = \tfrac{1}{2} \times \tfrac{17}{2} \times 2 = \tfrac{17}{2} \). [A1]
Total: 9 marks.

Check yourself

1. What is \( \dfrac{d}{dx}(\sin 5x) \)?

Differentiate the outside, \( \sin u \to \cos u \), then multiply by the derivative of the inside, \( 5x \to 5 \): \( 5\cos 5x \).

2. What is \( \dfrac{d}{dx}(2^x) \)?

\( 2^x = e^{x\ln 2} \), so the derivative is \( \ln 2 \cdot e^{x\ln 2} = 2^x\ln 2 \). The power rule does not apply, because the variable is in the index.

3. The tangent to a curve at a point has gradient 4. What is the gradient of the normal there?

Perpendicular gradients multiply to \( -1 \), so the normal has gradient \( -\tfrac{1}{4} \).

Your score: 0 out of 3

The short version

  • Chain rule: \( \dfrac{dy}{dx} = \dfrac{dy}{du} \times \dfrac{du}{dx} \), or \( f’\big(g(x)\big)\,g'(x) \). Differentiate the outside, keep the inside, multiply by the inside’s derivative.
  • Standard chains: \( e^{kx} \to ke^{kx} \), \( \ln f(x) \to \dfrac{f'(x)}{f(x)} \), \( \sin(kx + b) \to k\cos(kx + b) \), \( [f(x)]^n \to n[f(x)]^{n-1}f'(x) \).
  • \( \dfrac{d}{dx}(a^x) = a^x\ln a \) and \( \dfrac{d}{dx}(\log_a x) = \dfrac{1}{x\ln a} \).
  • Tangent \( y-y_1 = m(x-x_1) \); normal gradient \( -\dfrac{1}{m} \). Take \( y_1 \) from the curve’s equation.
  • A derivative is a rate in units of \( y \) per unit of \( x \). In chains of causes, the rates and the units multiply.
  • The full chapter in Mathematics Made Simple has many more worked examples and a full set of practice questions with a complete answer key.
Want more questions like these, with worked answers?
The practice book has hundreds more, graded from easy to exam level.
Next: step 14 of 33Implicit Differentiation and Inverse Functions