# Chain Rule for Derivatives: Formula, Examples and Common Forms

> The chain rule: the derivative of f(g(x)) is f'(g(x))·g'(x). The formula in both notations, a table of common forms, worked examples and mistakes.

Source: https://practicecalculus.com/rules/chain-rule
Updated: 2026-11-03

$$ \frac{d}{dx}\,f(g(x)) = f'(g(x))\,g'(x) $$

## At a glance

- **Applies to:** Compositions, a function inside another function
- **In words:** Derivative of the outside (inside left alone) times the derivative of the inside
- **Leibniz form:** $\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$
- **Spot it:** Anything other than plain $x$ inside a power, root, trig, exponential or log
- **Integral version:** U-substitution

## Key takeaways

- Differentiate the outer function, keep the inner function unchanged, then multiply by the derivative of the inner function.
- In Leibniz notation, $\frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx}$.
- Use it any time the input of a function is something other than plain $x$.
- For several layers, multiply one derivative per layer, working from the outside in.

The **chain rule** differentiates a composition, one function inside another. You take the derivative of the outer function, leave the inner function alone, and multiply by the derivative of the inner function. Almost every non-trivial derivative uses it.

## The chain rule formula

If $g$ is differentiable at $x$ and $f$ is differentiable at $g(x)$, then

$$\frac{d}{dx}\,f(g(x)) = f'(g(x))\,g'(x)$$

In Leibniz notation, with $y = f(u)$ and $u = g(x)$:

$$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$$

Think of rates multiplying: if $y$ changes 3 times as fast as $u$, and $u$ changes 2 times as fast as $x$, then $y$ changes $3 \cdot 2 = 6$ times as fast as $x$.

## Common chain rule forms

Here $u$ is any differentiable function of $x$ and $u'$ is its derivative.

| Function | Derivative |
| --- | --- |
| $u^n$ | $n\,u^{n-1}\,u'$ |
| $\sqrt{u}$ | $\frac{u'}{2\sqrt{u}}$ |
| $e^u$ | $e^u\,u'$ |
| $\ln u$ | $\frac{u'}{u}$ |
| $\sin u$ | $\cos u \cdot u'$ |
| $\cos u$ | $-\sin u \cdot u'$ |
| $\tan u$ | $\sec^2 u \cdot u'$ |

## Worked examples

**Example 1: a power of a polynomial.** Outer: $u^5$. Inner: $u = x^2 + 1$, $u' = 2x$:

$$\frac{d}{dx}\,(x^2 + 1)^5 = 5(x^2 + 1)^4 \cdot 2x = 10x(x^2 + 1)^4$$

**Example 2: trig.** Outer: $\sin u$. Inner: $u = 3x$:

$$\frac{d}{dx}\,\sin(3x) = \cos(3x) \cdot 3 = 3\cos(3x)$$

**Example 3: exponential.** Outer: $e^u$. Inner: $u = x^2$:

$$\frac{d}{dx}\,e^{x^2} = e^{x^2} \cdot 2x = 2x\,e^{x^2}$$

**Example 4: a square root.** Write $\sqrt{4x - 1} = (4x - 1)^{1/2}$:

$$\frac{1}{2}(4x - 1)^{-1/2} \cdot 4 = \frac{2}{\sqrt{4x - 1}}$$

**Example 5: logarithm.** Outer: $\ln u$. Inner: $u = \cos x$:

$$\frac{d}{dx}\,\ln(\cos x) = \frac{-\sin x}{\cos x} = -\tan x$$

**Example 6: three layers.** $\sin^2(5x)$ means $[\sin(5x)]^2$. Peel from the outside: square, then sine, then $5x$:

$$\frac{d}{dx}\,\sin^2(5x) = 2\sin(5x) \cdot \cos(5x) \cdot 5 = 10\sin(5x)\cos(5x)$$

## How to spot a composition

Ask: "To evaluate this at a number, what would I compute **last**?" That last operation is the outer function. Everything it acts on is the inner function.

- $(3x + 1)^4$: last step is raising to the 4th power. Inner is $3x + 1$.
- $e^{\sin x}$: last step is $e^{(\ )}$. Inner is $\sin x$.
- $\sin x^2$ usually means $\sin(x^2)$: inner is $x^2$. But $\sin^2 x$ means $(\sin x)^2$: inner is $\sin x$.

If the inner function is just $x$, the inner derivative is $1$ and the chain rule changes nothing.

## Common mistakes

1. **Forgetting the inner derivative.** $\frac{d}{dx}\,(3x + 1)^4 = 4(3x + 1)^3 \cdot 3$, not $4(3x + 1)^3$. This is the most common derivative error of all.
2. **Changing the inside.** The outer derivative is evaluated at the original inner function: $\frac{d}{dx}\sin(x^2) = \cos(x^2) \cdot 2x$, not $\cos(2x)$.
3. **Confusing it with the product rule.** $\sin(x^2)$ is a composition, while $x^2\sin x$ is a product. See the [product rule](/rules/product-rule).
4. **Stopping after one layer.** In $e^{\sin(2x)}$ there are three layers, and the answer $2\cos(2x)\,e^{\sin(2x)}$ needs all three derivatives.

The chain rule is also the engine behind [implicit differentiation](/rules/implicit-differentiation), related rates and [u-substitution](/rules/u-substitution-rule). For a longer walkthrough with more practice problems, read the full guide to [the chain rule](/blog/chain-rule).

## Frequently asked questions

### What is the chain rule in simple terms?

For a function inside another function, take the derivative of the outer function with the inside left as it is, then multiply by the derivative of the inside.

### How do you know when to use the chain rule?

Use it whenever a function is applied to something other than plain $x$, such as $(3x+1)^5$, $\sin(x^2)$ or $e^{4x}$. If you would need to compute an inner value first, there is a composition.

### What is the chain rule in Leibniz notation?

If $y$ depends on $u$ and $u$ depends on $x$, then $\frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx}$.

### How do you use the chain rule more than once?

Peel the layers from the outside in and multiply one derivative per layer. For $\sin^2(5x)$ that gives $2\sin(5x)\cdot\cos(5x)\cdot 5$.
