STEM-TutorLearn • Practice • ExcelBook Free DemoFree demo

The chain rule, explained with examples

The chain rule is how you differentiate a function inside another function. It appears in almost every calculus question, so it is worth making it automatic.

On this page
  1. What the chain rule says
  2. Why it works
  3. How to spot the inner and outer function
  4. Worked examples
  5. A quick routine for every chain rule question
  6. Where the chain rule turns up next
  7. Common mistakes
  8. Practice questions
  9. Frequently asked questions
  10. Key takeaways
  11. Related guides

What the chain rule says

A composite function is a function of a function, such as sin(3x), (2x + 1)5 or ex². Each has an outer function applied to an inner function. The chain rule says:

If y = f(g(x)), then dy/dx = f'(g(x)) × g'(x).

In words: differentiate the outer function, leaving the inside alone, then multiply by the derivative of the inside. In Leibniz notation, with u = g(x), this is dy/dx = dy/du × du/dx. The notation makes the rule look like fractions cancelling, which is a useful way to remember it, even though derivatives are not really fractions.

Why it works

Think of rates of change multiplying. If u changes 3 times as fast as x, and y changes 5 times as fast as u, then y changes 15 times as fast as x. The chain rule is that idea made precise: the rate of the whole is the product of the rates of each link in the chain. This is also why it is called the chain rule.

How to spot the inner and outer function

Ask yourself: if I worked out this function on a calculator, what would I do last? The last step is the outer function. For (2x + 1)5, you would work out 2x + 1 first and then raise it to the fifth power, so the outer function is “to the fifth” and the inner is 2x + 1. For sin(3x), you find 3x first and then take sine, so sine is outer and 3x is inner.

Worked examples

Example 1: a power of a bracket

Differentiate y = (2x + 1)5.

Example 2: trigonometry

Differentiate y = sin(3x).

Example 3: an exponential

Differentiate y = ex².

Example 4: a logarithm

Differentiate y = ln(x² + 4).

Example 5: a square root

Differentiate y = √(1 − x²).

Example 6: a power of a trig function

Differentiate y = sin²x.

Example 7: three layers

Differentiate y = cos³(4x).

Example 8: chain rule with the product rule

Differentiate y = x(3x − 2)4.

Example 9: from a table (AP style)

f(2) = 5, f'(2) = −1, g(1) = 2 and g'(1) = 3. Find h'(1) where h(x) = f(g(x)).

A quick routine for every chain rule question

  1. Rewrite roots and fractions as powers, so √u becomes u1/2 and 1/u² becomes u−2.
  2. Name the inner function u and write down du/dx.
  3. Differentiate the outer function with respect to u, keeping u inside.
  4. Multiply the two results and replace u with the original expression.
  5. Simplify, often by taking out common factors.

Writing u and du/dx at the side of your working takes a few seconds and prevents most errors. Once the pattern is automatic, you can skip the u and do it in one line, which saves valuable time in the exam and leaves more time for checking.

Where the chain rule turns up next

Once you know the chain rule, several other topics become straightforward. Implicit differentiation is the chain rule applied to y as a function of x, which is why the derivative of y² is 2y(dy/dx). Related rates are the chain rule with time as the variable. Integration by substitution is the chain rule in reverse. Derivatives of inverse functions also come from it. If you are unsure about any of these, the chain rule is usually the place to start.

Common mistakes

Practice questions

Try each one before opening the answer.

Q1. Differentiate (x³ − 1)6.

Show answer
6(x³ − 1)5 × 3x² = 18x²(x³ − 1)5.

Q2. Differentiate cos(5x + 2).

Show answer
−5 sin(5x + 2).

Q3. Differentiate e−2x.

Show answer
−2e−2x.

Q4. Differentiate ln(sin x).

Show answer
cos x/sin x = cot x.

Q5. Differentiate tan(x²).

Show answer
2x sec²(x²).

Q6. If h(x) = g(x)², g(3) = 4 and g'(3) = −2, find h'(3).

Show answer
h'(3) = 2g(3)g'(3) = 2 × 4 × (−2) = −16.

Frequently asked questions

Is the chain rule on the AP Calculus exam?

Yes, in both AB and BC, in multiple-choice and free-response questions. It is part of Unit 3 on composite, implicit and inverse functions, and it is used throughout the rest of the course.

Is the chain rule in A level Maths?

Yes. It is in the second year of A level Maths, alongside the product and quotient rules.

How do I know when to use the chain rule?

Whenever there is something other than plain x inside a function: a bracket raised to a power, sin of something, e to the power of something, ln of something, or a square root of an expression.

Key takeaways