The chain rule, step by step

To differentiate a function inside another function, differentiate the outside, keep the inside, and multiply by the derivative of the inside.

A Samir Tutors study guide · Calculus

Recognize a composite function.

In y = (2x + 1)³, the expression 2x + 1 sits inside the cubing function. Both layers change when x changes. The chain rule accounts for both rates of change.

For differentiable functions f and g, the rule is:

d/dx [f(g(x))] = f′(g(x)) · g′(x)

The first factor differentiates the outside function, evaluated at the inside. The second differentiates the inside function.

Example: differentiate (2x + 1)³.

  1. Name the inside. Let u = 2x + 1. Then y = u³.
  2. Differentiate the outside. The derivative of u³ with respect to u is 3u².
  3. Differentiate the inside. The derivative of 2x + 1 with respect to x is 2.
  4. Multiply and substitute back. The result is 3(2x + 1)² · 2 = 6(2x + 1)².

Writing only 3(2x + 1)² misses the inside derivative. At x = 0, that incomplete expression gives 3, while the correct derivative is 6.

Example: differentiate sin(x²).

The outside is the sine function; the inside is x². Differentiating the outside gives cos(x²), and differentiating the inside gives 2x.

d/dx [sin(x²)] = 2x cos(x²)

This standard trigonometric derivative uses radians. Keep x² inside the cosine; the chain rule does not replace it with its derivative.

Chain rule or product rule?

Use the chain rule for a composition such as (2x + 1)³. Use the product rule when multiplying two functions, such as x² sin(x). A problem can need both: differentiating x² sin(3x) gives 2x sin(3x) + 3x² cos(3x).

Try it yourself.

Name the inside and outside before calculating.

  1. Differentiate (4x − 3)².
  2. Differentiate cos(5x).
  3. Differentiate (x² + 2)⁴.
Show answers and reasoning

1. 8(4x − 3): multiply 2(4x − 3) by 4.
2. −5 sin(5x): multiply −sin(5x) by 5.
3. 8x(x² + 2)³: multiply 4(x² + 2)³ by 2x.

Keep working on the difficult step.

If identifying the two functions is the hard part, practice that before differentiating. If the calculus is clear but the algebra is not, work on those expressions separately.

Explore one-on-one calculus tutoring or get help with the algebra.

Further reading: OpenStax, Calculus Volume 1, §3.6: The Chain Rule. The examples on this page were prepared for this guide.