Derivatives

Chain Rule Explained: Formula, Steps and 8 Examples

Chain Rule Explained: Formula, Steps and 8 Examples

The chain rule finds derivatives of composite functions. For f(g(x)), the derivative is f'(g(x)) · g'(x). Leibniz notation shows dy/dx = (dy/du) · (du/dx). To solve chain rule examples, differentiate the outer layer first. Keep the inner part unchanged. Then, multiply by the inner layer’s derivative.

You will use the chain rule frequently. In fact, it is second only to the power rule. Nearly every non-trivial calculus problem involves nested functions. Once you recognize the outer and inner layers, differentiating composite functions becomes a straightforward procedure.

What is the chain rule formula?

The chain rule uses two common notations. For example, you can use Lagrange notation (prime notation). Also, you can use Leibniz notation (fraction notation). Both express the exact same mathematical idea, useful in various chain rule examples.

Chain rule examples: Metal chain links hanging vertically

In Lagrange notation, for a composite function f(g(x)):

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

In Leibniz notation, if y = f(u) where u = g(x):

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

In other words, you calculate the derivative of the main outer function. Evaluate it at the original inside function. Then, you multiply it by the derivative of the tucked-inside function.

Why nested rates of change multiply

To understand the chain rule intuitively, think of instantaneous rates of change. Consider them as gear ratios. If variable u changes 3 times faster than variable x, then variable y changes 2 times faster than variable u. So, y must change 2 × 3 = 6 times faster than x. The nested rates naturally multiply together.

Why nested rates of change multiply

A physical gear assembly clearly illustrates this concept. Suppose Gear A turns Gear B three times. This happens for every full rotation of A. Gear B also turns Gear C twice. This occurs for every rotation of B. As a result, Gear C turns six times for every turn of Gear A. Each individual gear ratio represents a derivative. The total system’s rate of change is their product. This is one of many chain rule examples.

Visualizing the inner derivative on a graph

Compare sin(x) and sin(2x). Both trigonometric graphs share wave amplitude. However, sin(2x) compresses horizontally by 2. The wave oscillates twice as fast. Each curve point is twice as steep. This applies to the uncompressed sine wave. Consider these as chain rule examples.

The derivative of sin(2x) is 2cos(2x). We find this using chain rule examples. The outer derivative, cos(2x), sets the general slope. Also, it shows a cosine wave profile. The inner derivative factor of 2 accounts for horizontal compression. Forgetting the inside derivative ignores graph squeezing.

You can also verify this using simple polynomial algebra. If you expand (2x + 1)² into 4x² + 4x + 1, its derivative using standard term-by-term rules is 8x + 4. Applying the chain rule directly to (2x + 1)² yields 2(2x + 1) · 2, which expands to 8x + 4. Both methods yield the exact same result.

Why the chain rule formula works mathematically

Let u = g(x) and y = f(u). A small Δx input change occurs. This creates a Δu change in the interior function. Then it causes a Δy change in the final output. If Δu ≠ 0, you can write the ratio of changes. You write it as an algebraic product. This is useful for chain rule examples.

Albert Einstein writing an equation on a blackboard

$$\frac{\Delta y}{\Delta x} = \frac{\Delta y}{\Delta u}\cdot\frac{\Delta u}{\Delta x}$$

Taking the limit as Δx → 0 causes Δu → 0 because differentiable functions are continuous. The fraction Δy/Δu approaches the derivative f'(u) = f'(g(x)), and the fraction Δu/Δx approaches g'(x). In the limit, the rates multiply, yielding the standard chain rule formula.

How to identify inner and outer functions

First, decompose the function. Do this before any derivative. Ask: “If evaluating for x on a calculator, what operation is last?” That final operation is the outer layer. This applies to chain rule examples.

Function Outer Function f(u) Inner Function u = g(x)
(3x² + 1)⁵ u⁵ 3x² + 1
sin(x²) sin(u) x²
e³ˣ eᵘ 3x
ln(cos x) ln(u) cos x
sin²(x) u² sin x

Notice the critical distinction in the final row. Notation like sin²(x) really means (sin x)². The squaring operation occurs last. Therefore, it is the outer function. The sine function, however, is the inner layer. You can find a complete breakdown of trigonometric powers in our walkthrough for the derivative of cos²x.

The 3-step chain rule method

  1. Identify the layers: First, separate the expression. You will find its outer function f(u). Then you will find its inner function u = g(x).
  2. Differentiate the outer layer: Take the derivative of the outer function, leaving the inner expression entirely untouched inside it.
  3. Multiply by the inner derivative: Find g'(x). Next, multiply it by the result from Step 2. If the inner piece itself contains nested functions, repeat the process. Work from the outside in.

Essential chain rule shortcut formulas

Applying the general chain rule formula creates standard shortcut patterns. You should memorize these patterns. g represents any differentiable function of x:

Complex mathematical equations on a dark background

$$\begin{aligned}\frac{d}{dx}g^n &= n,g^{n-1}\cdot g' \\ \frac{d}{dx}e^{g} &= e^{g}\cdot g' \\ \frac{d}{dx}\ln g &= \frac{g'}{g} \\ \frac{d}{dx}\sin g &= \cos g\cdot g'\end{aligned}$$

You often call the first pattern the general power rule. Each pattern maintains the same fundamental principle. You differentiate the outer container. You preserve the interior. Then, you multiply by the derivative of what was inside.

8 step-by-step worked examples

Example 1: Polynomial to a power
Differentiate y = (3x² + 1)⁵.
Outer function is u⁵; inner function is u = 3x² + 1.
Outer derivative: 5(3x² + 1)⁴.
Inner derivative: 6x.
Multiply together:

A student studying math at a desk with a calculator

$$5(3x^2+1)^4\cdot 6x = 30x(3x^2+1)^4$$

Example 2: Trigonometric function with inner power
We differentiate y = sin(x²).
The outer function is sin(u). The inner function is x².
Its outer derivative keeps the inside fixed. This gives cos(x²).
The inner derivative is 2x. These are chain rule examples.
So, the result is 2x cos(x²).

Example 3: Exponential with linear exponent
You can differentiate y = e³ˣ. This is one of the chain rule examples.
First, identify the outer function. It is eᵘ. Next, find the inner function. This is 3x.
So, the derivative is 3e³ˣ. For a similar pattern with a quadratic exponent, see the guide on the derivative of e^2x.

Example 4: Square root of a polynomial
Differentiate y = √(1 + x³) = (1 + x³)^(1/2).
First, find the outer derivative: (1/2)(1 + x³)^(-1/2).
Next, find the inner derivative: 3x².
Therefore, the combined result is:

$$\frac{3x^2}{2\sqrt{1 + x^3}}$$

Example 5: Natural log of a trig function
Differentiate y = ln(cos x).
First, find the outer derivative: 1 / (cos x).
Then, find the inner derivative: -sin x.
Therefore, the result is:

$$\frac{-\sin x}{\cos x} = -\tan x$$

Three nested function examples

Example 6: Three nested layers
Differentiate y = sin(e²ˣ).
Here, you have three layers. Sine is the outermost layer. The exponential is the middle layer. The linear 2x is the innermost layer. Therefore, work systematically from outside to inside:

$$\cos\left(e^{2x}\right)\cdot e^{2x}\cdot 2 = 2e^{2x}\cos\left(e^{2x}\right)$$

Example 7: Power of a trig function with inner polynomial
Differentiate y = cos²(x³) = [cos(x³)]².
Three layers: square power, cosine, and x³.
Step 1 (square power): 2 cos(x³).
Next, Step 2 (cosine): -sin(x³).
Finally, Step 3 (cubic interior): 3x².
Multiplying all three pieces together gives:

$$2\cos(x^3)\cdot\left(-\sin(x^3)\right)\cdot 3x^2 = -6x^2\cos(x^3)\sin(x^3)$$

Example 8: Rational expression with powered denominator
Differentiate y = 1 / (x² + 4)³.
You can rewrite this with a negative exponent. It becomes (x² + 4)⁻³.
Then, apply the chain rule directly.

$$-3(x^2+4)^{-4}\cdot 2x = -\frac{6x}{(x^2+4)^4}$$

Rewriting rational terms as negative powers allows you to avoid using the longer quotient rule.

Multi-layer chain rule examples

You can prevent computational errors. To do this, peel nested functions one layer at a time. This is important when functions are three or four levels deep.

Pink Russian nesting dolls lined up by size

Example 9: Exponential of a trig function
Differentiate y = e^(sin x). The exponential layer is outermost. So, it remains unchanged. You multiply it by the derivative of the trigonometric exponent:

$$\frac{d}{dx}e^{\sin x} = \cos x\cdot e^{\sin x}$$

Example 10: Cube of a trigonometric term with a linear coefficient
Differentiate y = sin³(2x) = [sin(2x)]³. The three layers are: power of 3, sine function, and 2x linear interior.

$$3\sin^2(2x)\cdot\cos(2x)\cdot 2 = 6\sin^2(2x)\cos(2x)$$

Combining the chain rule with product and quotient rules

In calculus exams and real applications, the chain rule rarely appears in isolation. However, it frequently sits inside a broader expression requiring the product rule or quotient rule.

For example, you differentiate x² sin(3x). First, identify the overarching structure. It is a product of x² and sin(3x). Apply the product rule formula (u’v + uv’). Also, use the chain rule specifically when differentiating the second term sin(3x).

$$\frac{d}{dx}\left[x^2\sin(3x)\right] = 2x\sin(3x) + x^2\cdot 3\cos(3x)$$

Example 11: Product with a negative quadratic exponent
Differentiate y = x e^(-x²). The global structure is a product of x and e^(-x²). The second factor requires the chain rule because its exponent is -x² (which has a derivative of -2x):

$$\frac{d}{dx}\left[x e^{-x^2}\right] = 1\cdot e^{-x^2} + x\cdot e^{-x^2}(-2x) = e^{-x^2}\left(1 - 2x^2\right)$$

The chain rule provides the theoretical backbone for differential calculus involving time derivatives and non-explicit functions.

In related rates problems, variables are functions of time t. For example, consider a circular ripple. Its radius r grows at 2 cm/s. You want to find how fast area A expands when r = 5 cm. Differentiate A = π r² with respect to time t. Use the chain rule, as seen in many chain rule examples.

$$\frac{dA}{dt} = 2\pi r\cdot\frac{dr}{dt} = 2\pi(5)(2) = 20\pi \approx 62.83\text{ cm}^2/\text{s}$$

Consider implicit differentiation. Similarly, you use the chain rule here. You differentiate a term with y concerning x. As a result, the chain rule requires an extra dy/dx factor. This is because y represents an underlying function of x.

Common mistakes to avoid

  • Forgetting the inner derivative: Writing d/dx [sin(x²)] = cos(x²) is the single most common error. Always remember to multiply by the interior derivative 2x.
  • Prematurely changing the inner function during step 1: Keep the inner layer intact. When you take the outer layer’s derivative, do not change the inner layer. For example, write cos(x²). Do not write cos(2x).
  • Stopping one layer early: You must differentiate multi-layer expressions completely. For example, consider sin(e²ˣ). Make sure you differentiate all the way down to the innermost linear variable.
  • Confusing function composition with multiplication: Expression sin(x²) is a composite function, not a product sin(x) · x². Therefore, do not attempt to use the product rule on nested arguments.
  • Misinterpreting trigonometric powers: Remember that notation like cos⁴(3x) means [cos(3x)]⁴. The exponent 4 sits on the outside of the entire cosine function.

Interactive chain rule solver

You can use this solver. It traces how outer and inner functions break down layer by layer:

A tablet, stylus, and cup of coffee on a wooden table

Step-by-step solverExact symbolic engine

Interactive Calculus Problem Solver

Derivatives, antiderivatives, definite and improper integrals, and limits. Every answer comes with the rules used, and antiderivatives are verified by differentiating them back.

Try:
Input syntax
  • Powers x^2, roots sqrt(x), cbrt(x), absolute value |x|
  • Implicit multiplication works: 3x sin(2x)
  • sin cos tan sec csc cot, asin acos atan, sinh cosh tanh
  • e^x or exp(x); ln(x) is the natural log. In this solver log(x) also means the natural log (the usual calculus convention); type log10(x) for base 10
  • Constants pi and e; bounds accept inf and -inf
Enter a function and press Solve to see a full worked solution.

For more custom problem verification, our derivative calculator displays full step-by-step solutions for composite functions.

Practice problems

Test your understanding with these practice problems before checking the solutions below.

A person typing on a laptop at a desk with notes
  1. $$\frac{d}{dx}(2x - 5)^{7}$$
  2. $$\frac{d}{dx}\cos(\ln x)$$
  3. $$\frac{d}{dx}\sqrt{\tan x}$$
  4. $$\frac{d}{dx}e^{x^2}$$
  5. $$\frac{d}{dx}\ln(x^2 + 1)$$
  6. $$\frac{d}{dx}\cos^4(3x)$$
  7. $$\frac{d}{dx}\tan(5x)$$

Solutions:

  1. 14(2x – 5)⁶ — Outer derivative gives 7(2x – 5)⁶, multiplied by inner derivative 2.
  2. -sin(ln x) / x — Outer derivative is -sin(ln x), multiplied by 1/x.
  3. sec²(x) / (2√(tan x)) — Outer derivative is (1/2)(tan x)^(-1/2), multiplied by sec²(x).
  4. 2x e^(x²) — Outer exponential stays unchanged, multiplied by 2x.
  5. 2x / (x² + 1) — Natural log rule gives 1/(x² + 1), multiplied by derivative of x² + 1.
  6. -12 cos³(3x) sin(3x) — Three layers: 4 cos³(3x) · (-sin(3x)) · 3.
  7. 5 sec²(5x) — Outer derivative of tangent is sec²(5x), multiplied by 5.

Frequently asked questions

How do I know when to use the chain rule?

You must use the chain rule whenever an expression contains an inner function inside an outer operation. This differs from a simple isolated variable x. Look for expressions inside brackets, roots, powers, trig functions, exponents, or logarithms.

How many times do I apply the chain rule in a single problem?

You apply the chain rule once for every layer nested beneath the outermost function. Continue working inward. Multiply by inside derivatives until you reach a basic term. Its derivative with respect to x is 1.

What is the relationship between the chain rule and integration?

Running the chain rule in reverse produces the fundamental integration technique known as u-substitution, which undoes nested derivatives by identifying inner functions and their differential pairs.

Does the chain rule apply in multivariable calculus?

Yes, the chain rule expands in multivariable calculus. It sums paths using partial derivatives. For example, consider a function z(x, y). Here, x and y depend on t. The total derivative is dz/dt = (∂z/∂x)(dx/dt) + (∂z/∂y)(dy/dt).

Further reading

Calculators for this topic

Get new calculus guides by email

Free worked examples and new calculators, at most once a day. Unsubscribe with one click.

Leave a comment

Your email address will not be published. Required fields are marked *