Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 39 · Differentiation Rules

The Chain Rule

Differentiate composite functions with the chain rule, learn the outer-inner method, combine it with other rules, and confirm results with SymPy.

Many functions are built by feeding one function into another: (3x + 1)⁵, √(x² + 4). These are composite functions. The chain rule gives their derivative.

The rule

If y = f(g(x)), then

dy/dx = f'(g(x)) · g'(x)

Differentiate the outer function (leaving the inner one untouched), then multiply by the derivative of the inner function.

In Leibniz form, with u = g(x) and y = f(u): dy/dx = dy/du · du/dx. The du appears to cancel like fractions, which is a good memory aid.

Why it makes sense

If a car travels twice as fast as a bike, and the bike travels 3 times as fast as a walker, the car is 2 × 3 = 6 times as fast as the walker. Rates of change multiply along a chain.

Worked examples

y = (3x + 1)⁵. Outer: u⁵, derivative 5u⁴. Inner: 3x + 1, derivative 3. y' = 5(3x + 1)⁴ · 3 = 15(3x + 1)⁴.

y = √(x² + 4). Outer u^(1/2), derivative (1/2)u^(-1/2). Inner x² + 4, derivative 2x. y' = (1/2)(x² + 4)^(-1/2) · 2x = x / √(x² + 4).

y = 1 / (2x - 5)³ = (2x - 5)⁻³. y' = -3(2x - 5)⁻⁴ · 2 = -6 / (2x - 5)⁴.

flowchart LR
  X["x"] -->|"inner g"| U["u = g(x)"] -->|"outer f"| Y["y = f(u)"]

Differentiate from outside in, multiplying as you go.

Python Chain rule vs. numeric slope

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Several layers

For y = sin²(3x), think of (sin(3x))²: the layers are square, sine, then 3x. Multiply three derivatives: 2 sin(3x) · cos(3x) · 3. We will learn the sine derivative in the next lesson; SymPy can already confirm it.

Python Chain rule with SymPy

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Name the layers before you start: "outer is ..., inner is ...". Most chain-rule mistakes are forgetting the inner derivative.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. d/dx [(x² + 1)³] equals

    Outer derivative 3u², times the inner derivative 2x.
  2. 2. d/dx [√(2x + 7)] equals

    (1/2)(2x+7)^(-1/2) · 2 = 1/√(2x + 7).
  3. 3. In dy/dx = dy/du · du/dx, u represents

    u = g(x) is the inner expression.
  4. 4. The most common chain-rule mistake is

    The inner derivative is a required factor.

Summary

  • Chain rule: (f(g(x)))' = f'(g(x)) · g'(x).
  • Differentiate outside in and multiply the pieces.
  • Combine it freely with sum, product and quotient rules.

Next: Derivatives of Trigonometric, Exponential and Logarithmic Functions