Chain Rule: Formula, Rules & Examples

The chain rule differentiates composite functions—functions placed inside other functions.
If:
y = f(g(x))
then:
dy/dx = f′(g(x)) × g′(x)
A common shorthand is:
Derivative of the outside × derivative of the inside
For example:
y = (3x+2)⁵
The outer function is:
u⁵
and the inner function is:
u=3x+2
Differentiate the outer expression:
5(3x+2)⁴
Then multiply by the derivative of the inside:
3
Therefore:
dy/dx = 15(3x+2)⁴
The chain rule appears whenever changing x affects an inner quantity, which then affects another function.
What Is a Composite Function?
A composite function has one function substituted into another.
If:
u=g(x)
and:
y=f(u)
then:
y=f(g(x))
For example:
g(x)=x²+1
and:
f(u)=u³
produce:
f(g(x))=(x²+1)³
Because the cube acts on the entire inner expression, differentiation must account for both layers.
Chain Rule Formula
The standard formula is:
d/dx[f(g(x))] = f′(g(x))g′(x)
Using intermediate variable u:
dy/dx = dy/du × du/dx
These expressions describe the same idea.
The outer rate:
dy/du
is multiplied by the inner rate:
du/dx
to obtain the total rate:
dy/dx
Why the Chain Rule Makes Sense
Suppose:
y
changes with:
u
and:
u
changes with:
x.
Then a small change in x produces a change in u, which produces a change in y.
The overall rate combines the two stages:
change in y per x = (change in y per u)(change in u per x)
Symbolically:
dy/dx = dy/du × du/dx
The intermediate units or differential factors cancel conceptually.
Basic Power Example
Differentiate:
y=(x²+4)⁵
Outer derivative:
5(x²+4)⁴
Inner derivative:
2x
Multiply:
y′=10x(x²+4)⁴
Without the chain rule, writing only:
5(x²+4)⁴
would miss the derivative of the inside.
Another Power Example
Differentiate:
y=(4x³−7)⁶
Outer derivative:
6(4x³−7)⁵
Inner derivative:
12x²
Multiply:
y′=72x²(4x³−7)⁵
Therefore:
d/dx[(4x³−7)⁶] = 72x²(4x³−7)⁵
Chain Rule With Square Roots
Differentiate:
y=√(5x+1)
Rewrite:
y=(5x+1)^(1/2)
Outer derivative:
(1/2)(5x+1)^(-1/2)
Inner derivative:
5
Therefore:
y′ = 5/[2√(5x+1)]
So:
d/dx√(5x+1) = 5/[2√(5x+1)]
The broader root notation follows the same fractional-exponent structure.
Chain Rule With Reciprocal Powers
Differentiate:
y=1/(x²+3)
Rewrite:
y=(x²+3)^-1
Differentiate outside:
-(x²+3)^-2
Differentiate inside:
2x
Therefore:
y′ = -2x/(x²+3)²
This is often cleaner than immediately applying the quotient rule.
Chain Rule With Exponential Functions
Differentiate:
y=e^(3x²)
The derivative of:
eᵘ
is:
eᵘ
So outer derivative:
e^(3x²)
Inner derivative:
6x
Therefore:
y′=6xe^(3x²)
Exponential With Linear Inner Function
Differentiate:
y=e^(7x−2)
Outer derivative:
e^(7x−2)
Inner derivative:
7
Therefore:
y′=7e^(7x−2)
Chain Rule With aˣ
For:
y=a^(g(x))
where:
a>0
the derivative is:
y′=a^(g(x))ln(a)g′(x)
For example:
y=2^(x²)
Then:
y′=2^(x²)ln2 × 2x
Therefore:
y′=2x ln(2) · 2^(x²)
Chain Rule With Natural Logarithms
Differentiate:
y=ln(x²+5)
Outer derivative:
1/(x²+5)
Inner derivative:
2x
Therefore:
y′ = 2x/(x²+5)
The chain rule turns a logarithm of a function into:
d/dx ln(g(x)) = g′(x)/g(x)
provided the real logarithm is defined.
Logarithm Example
Differentiate:
y=ln(4x³−1)
Inner derivative:
12x²
Therefore:
y′ = 12x²/(4x³−1)
on intervals where:
4x³−1 > 0
for the ordinary real logarithm.
Chain Rule With Sine
Differentiate:
y=sin(x²)
Outer derivative:
cos(x²)
Inner derivative:
2x
Therefore:
y′=2x cos(x²)
This is a classic example of a trigonometric function composed with a polynomial.
Chain Rule With Cosine
Differentiate:
y=cos(5x)
Outer derivative:
-sin(5x)
Inner derivative:
5
Therefore:
y′=-5sin(5x)
Chain Rule With Tangent
Differentiate:
y=tan(3x²+1)
Outer derivative:
sec²(3x²+1)
Inner derivative:
6x
Therefore:
y′=6x sec²(3x²+1)
Inverse Trigonometric Example
Differentiate:
y=arctan(2x)
Use:
d/du arctan(u)=1/(1+u²)
Inner derivative:
2
Therefore:
y′ = 2/(1+4x²)
Multiple Nested Layers
The chain rule can be applied repeatedly.
Differentiate:
y=sin[(x²+1)³]
There are three layers:
sine
cube
x²+1
Differentiate from outside inward.
Derivative of sine:
cos[(x²+1)³]
Derivative of the cube:
3(x²+1)²
Derivative of:
x²+1
is:
2x
Multiply:
y′=6x(x²+1)² cos[(x²+1)³]
Every nested layer contributes a factor.
Deeply Nested Example
Differentiate:
y=e^[sin(x³)]
Outer:
e^[sin(x³)]
Next layer:
cos(x³)
Inner:
3x²
Therefore:
y′=3x²e^[sin(x³)]cos(x³)
The safest approach is to work from the outermost function toward the innermost one.
Substitution Method
For:
y=(2x²+5)⁷
let:
u=2x²+5
Then:
y=u⁷
Differentiate:
dy/du=7u⁶
and:
du/dx=4x
Multiply:
dy/dx=28xu⁶
Substitute back:
dy/dx=28x(2x²+5)⁶
Using u can make complicated nesting easier to see.
Chain Rule and the Power Rule
The power rule says:
d/dx(xⁿ)=nx^(n−1)
The chain rule extends it to:
d/dx[g(x)]ⁿ = n[g(x)]^(n−1)g′(x)
For example:
d/dx(5x−4)⁸
=8(5x−4)⁷×5
=40(5x−4)⁷
So the ordinary power rule becomes a special case when the inner function is simply:
g(x)=x
Chain Rule vs. Product Rule
The product rule applies to:
f(x)g(x)
The chain rule applies to:
f(g(x))
These structures are different.
For:
x²sin x
use the product rule.
For:
sin(x²)
use the chain rule.
Some expressions require both rules.
Product Rule and Chain Rule Together
Differentiate:
y=x²sin(x³)
This is a product of:
x²
and:
sin(x³)
Use the product rule:
y′=2x sin(x³)+x²[d/dx sin(x³)]
Now chain rule:
d/dx sin(x³)=cos(x³)(3x²)
Therefore:
y′=2x sin(x³)+3x⁴cos(x³)
So:
y′=2x sin(x³)+3x⁴cos(x³)
Quotient Rule and Chain Rule Together
Differentiate:
y=(x²+1)/sin(3x)
The quotient rule gives:
y′ = [2x sin(3x) − (x²+1)d/dx(sin3x)] / sin²(3x)
Now:
d/dx sin(3x)=3cos(3x)
Therefore:
y′ = [2x sin(3x) − 3(x²+1)cos(3x)] / sin²(3x)
The quotient rule handles the outer quotient structure; the chain rule differentiates the composite denominator.
Chain Rule in Implicit Differentiation
The chain rule is essential in implicit differentiation because y is treated as a function of x.
Consider:
x²+y²=25
Differentiate:
2x + 2y(dy/dx)=0
Why does:
y²
produce:
2y(dy/dx)?
Because:
y=y(x)
so the chain rule gives:
d/dx[y(x)]² = 2y·y′
Solve:
y′=-x/y
Another Implicit Example
Differentiate:
x³+y³=6xy
Left side:
3x²+3y²y′
Right side uses product rule:
6(y+xy′)
So:
3x²+3y²y′=6y+6xy′
Collect y′ terms:
3y²y′−6xy′=6y−3x²
Factor:
y′(3y²−6x)=6y−3x²
Therefore:
y′=(6y−3x²)/(3y²−6x)
Simplify:
y′=(2y−x²)/(y²−2x)
The chain rule supplies the y′ factor whenever a function of y is differentiated with respect to x.
Chain Rule and Related Rates
Related rates problems differentiate quantities that depend on time.
Suppose:
A=πr²
and radius changes with time.
Differentiate with respect to:
t
Using the chain rule:
dA/dt=2πr dr/dt
If:
r=4
and:
dr/dt=3
then:
dA/dt=2π(4)(3)
=24π
Therefore:
Area is changing at 24π square units per unit time
The chain rule connects the change in area to the change in radius.
Volume Related-Rate Example
For a sphere:
V=(4/3)πr³
Differentiate with respect to time:
dV/dt=4πr² dr/dt
If:
r=5
and:
dr/dt=2
then:
dV/dt=4π(25)(2)
=200π
The nested dependence:
V(r(t))
is exactly the structure the chain rule handles.
Chain Rule and Differentials
The differentials notation makes the rule look especially natural.
If:
y=f(u)
and:
u=g(x)
then:
dy=f′(u)du
and:
du=g′(x)dx
Substitute:
dy=f′(u)g′(x)dx
Therefore:
dy/dx=f′(u)g′(x)
This should be understood as a mathematically justified derivative rule rather than casual fraction cancellation, but the notation captures the compositional structure well.
Chain Rule and Linear Approximation
For:
y=f(g(x))
the local change satisfies approximately:
Δy ≈ f′(g(x))g′(x)Δx
The linear approximation interpretation therefore mirrors the chain rule:
the inner function converts an input change into an intermediate change, and the outer derivative converts that intermediate change into output change.
Chain Rule and Continuity
Differentiability normally implies continuity at the point of differentiation.
For the usual chain rule, the inner function must be differentiable at the relevant input and the outer function differentiable at the corresponding inner value.
These assumptions ensure the local approximations compose properly.
A function failing continuity at the relevant point cannot be differentiable there in the ordinary sense.
Chain Rule and Area Under a Curve
The mapped area under a curve calculation uses definite integration, but composite integrands often require antiderivatives whose verification depends on the chain rule.
For example:
∫2x(x²+1)⁵dx
has antiderivative:
(x²+1)⁶/6
Differentiate to check:
(1/6)×6(x²+1)⁵×2x
=2x(x²+1)⁵
The chain rule verifies that the area integral was evaluated correctly.
Chain Rule and Area Between Curves
An area between curves problem may produce composite boundary functions or composite antiderivatives.
The geometric rule remains:
upper−lower
or:
right−left
The chain rule does not determine the geometric area setup, but it supports derivative analysis and verifies antiderivative expressions containing nested functions.
Keeping those roles separate prevents confusion between geometry and differentiation technique.
Chain Rule and Cross Product
The mapped cross product belongs to vector algebra, but the two concepts meet in vector-valued calculus.
If vectors:
r(u)
and:
s(u)
depend on an intermediate variable:
u=u(t)
then differentiating a vector expression such as:
r(u(t)) × s(u(t))
can involve both:
differentiation rules for the cross product
and:
the chain rule for the nested parameter dependence.
The cross product determines the vector operation; the chain rule tracks how the parameter changes.
Chain Rule in Multivariable Calculus
For:
z=f(x,y)
where:
x=x(t)
and:
y=y(t)
the multivariable chain rule gives:
dz/dt = ∂f/∂x · dx/dt + ∂f/∂y · dy/dt
For example:
z=x²+y²
with:
x=t
y=t²
Then:
∂z/∂x=2x
∂z/∂y=2y
dx/dt=1
dy/dt=2t
Therefore:
dz/dt=2x(1)+2y(2t)
Substitute:
x=t
y=t²
giving:
dz/dt=2t+4t³
The specialist partial derivative page develops the component derivatives used here.
Direct Check of the Multivariable Example
Substitute first:
z=t²+t⁴
Then differentiate directly:
dz/dt=2t+4t³
This matches the multivariable chain-rule result.
Such an independent route is a useful verification whenever possible.
Matrix Form of the Chain Rule
In higher dimensions, derivatives can be matrices.
For:
G:Rᵏ→Rⁿ
and:
F:Rⁿ→Rᵐ
the derivative of the composition satisfies:
D(F∘G)(x)=DF(G(x)) · DG(x)
The order matters.
The derivative matrices multiply in the same order in which the transformations are composed locally.
The dimensional structure is organized by basis and dimension.
Why Matrix Dimensions Match
Suppose:
DG
maps small changes in:
Rᵏ
into:
Rⁿ
and:
DF
maps those resulting changes from:
Rⁿ
into:
Rᵐ
Then:
DG
has compatible input/output dimensions for multiplication by:
DF
The product:
DF·DG
maps directly from:
Rᵏ
to:
Rᵐ
This is the multivariable equivalent of multiplying:
dy/du
by:
du/dx
Chain Rule and Gradient
If:
f:Rⁿ→R
and:
x=x(t)
is a vector path, then:
df/dt = ∇f · dx/dt
The gradient contains partial derivatives, while the path derivative describes how the inputs change.
Their dot product gives the rate of change of f along the path.
This is a geometric form of the multivariable chain rule.
Directional Derivative Connection
For a path moving with unit velocity:
dx/dt=u
the chain rule gives:
df/dt=∇f·u
which is the directional derivative:
Dᵤf=∇f·u
Thus directional differentiation can be viewed as a chain-rule calculation along a chosen line through the input space.
Chain Rule and Integration by Substitution
The integration by substitution method reverses the pattern created by the chain rule.
Chain rule:
d/dx F(g(x)) = F′(g(x))g′(x)
Reverse pattern:
∫F′(g(x))g′(x)dx = F(g(x))+C
For example:
∫2x cos(x²)dx
recognizes:
g(x)=x²
g′(x)=2x
Therefore:
∫2x cos(x²)dx=sin(x²)+C
This chain-rule reversal is one of the most important integration patterns.
Chain Rule With Higher Derivatives
Suppose:
y=f(g(x))
The first derivative is:
y′=f′(g(x))g′(x)
Finding:
y″
typically requires both the product rule and another chain-rule application.
Differentiate:
y″ = f″(g(x))[g′(x)]² + f′(g(x))g″(x)
Therefore:
y″ = f″(g)(g′)² + f′(g)g″
Nested structures become progressively richer with higher derivatives.
Second Derivative Example
Take:
y=(x²+1)³
First derivative:
y′=6x(x²+1)²
Differentiate using product rule:
y″=6(x²+1)² + 6x[2(x²+1)(2x)]
Therefore:
y″=6(x²+1)²+24x²(x²+1)
Factor:
y″=6(x²+1)(5x²+1)
Recognizing the Inner Function
A useful question is:
What whole expression is being acted on by another function?
For:
sin(5x²−1)
inner:
5x²−1
For:
ln(1+x⁴)
inner:
1+x⁴
For:
√(3−2x)
inner:
3−2x
For:
e^[cos x]
inner at the first layer:
cos x
and there is another nested layer inside it.
Correct recognition of the layers is the first step.
Outside-In Differentiation
A reliable chain-rule strategy is to differentiate from:
outside to inside
while leaving inner expressions temporarily unchanged.
For:
[sin(x²+1)]⁴
outermost function:
fourth power
next:
sine
inner:
x²+1
Derivative:
4[sin(x²+1)]³
then multiply:
cos(x²+1)
then multiply:
2x
Therefore:
y′=8x[sin(x²+1)]³cos(x²+1)
Common Mistake: Forgetting the Inner Derivative
Incorrect:
d/dx(x²+1)⁵ = 5(x²+1)⁴
Correct:
10x(x²+1)⁴
because:
d/dx(x²+1)=2x
Common Mistake: Differentiating the Inside but Not the Outside
For:
y=sin(x²)
writing:
2x
is incomplete.
That is only the derivative of the inner function.
The full derivative is:
2x cos(x²)
Common Mistake: Adding Derivatives Instead of Multiplying
The chain rule combines local rates by multiplication:
f′(g(x))g′(x)
not:
f′(g(x))+g′(x)
The composition structure determines multiplication.
Common Mistake: Using the Product Rule on a Composition
For:
sin(x²)
there are not two multiplied functions:
sin(x) × x²
The expression means sine of x².
Use the chain rule.
Common Mistake: Missing Multiple Layers
For:
e^[sin(x³)]
you need derivatives of:
eᵘ
sin(v)
and:
x³
The correct answer has three derivative factors:
e^[sin(x³)]cos(x³)3x²
Stopping after only one or two layers is incomplete.
Common Mistake: Losing Parentheses
For:
ln(x²+1)
the derivative is:
2x/(x²+1)
not:
2x/x² + 1
Keep the entire inner expression grouped.
Common Mistake: Confusing Inverse Functions With Reciprocals
For:
sin⁻¹(x)
the notation normally means inverse sine.
It does not mean:
1/sin(x)
Derivative rules for inverse trigonometric functions therefore differ from reciprocal trig functions.
How to Check a Chain Rule Derivative
First identify every layer again.
Then verify that your answer contains one derivative contribution from each layer.
For simple functions, expand before differentiating when possible and compare.
Example:
y=(x+1)²
Chain rule:
y′=2(x+1)
Expand first:
y=x²+2x+1
Derivative:
2x+2
Since:
2(x+1)=2x+2
the methods agree.
Numerical Rate Check
Suppose:
y=(2x+1)³
At:
x=1
chain-rule derivative:
y′=3(2x+1)²×2
At 1:
y′=6(3²)
=54
The derivative predicts that a tiny input change near x=1 changes y at roughly:
54 times the input change
which provides the local-rate interpretation of the formula.
Frequently Asked Questions
What is the chain rule?
The chain rule differentiates a composite function.
What is the chain rule formula?
d/dx[f(g(x))] = f′(g(x))g′(x)
What does dy/du × du/dx mean?
It means the rate of y with respect to an intermediate variable u multiplied by the rate of u with respect to x.
When should I use the chain rule?
Use it when one differentiable function is nested inside another.
What is the derivative of (x²+1)⁵?
10x(x²+1)⁴
What is the derivative of sin(x²)?
2x cos(x²)
What is the derivative of e^(3x)?
3e^(3x)
What is the derivative of ln(x²+1)?
2x/(x²+1)
Can the chain rule be used more than once?
Yes. Apply it once for every nested layer.
Can product and chain rules appear together?
Yes. A product may contain one or more composite factors.
Does implicit differentiation use the chain rule?
Yes. Differentiating expressions involving y(x) introduces factors of dy/dx.
How is substitution related to the chain rule?
Integration by substitution reverses a common chain-rule derivative pattern.
What is the multivariable chain rule?
It combines partial derivatives with rates of change of each input variable.
How does the chain rule look in matrix form?
D(F∘G)=DF·DG
with each derivative evaluated at the appropriate point.
Final Example
Differentiate:
y = [ln(1+x²)]⁴
Identify the layers.
Outermost:
u⁴
Next:
ln(v)
Innermost:
1+x²
Differentiate the outermost layer:
4[ln(1+x²)]³
Differentiate the logarithm:
1/(1+x²)
Differentiate the inner polynomial:
2x
Multiply all factors:
y′ = 4[ln(1+x²)]³ × 1/(1+x²) × 2x
Simplify:
y′ = 8x[ln(1+x²)]³/(1+x²)
The central chain-rule relationships are:
d/dx[f(g(x))] = f′(g(x))g′(x)
and:
dy/dx = dy/du × du/dx
For multiple nested functions, differentiate from the outermost layer inward and multiply by the derivative contributed by every layer. This preserves the full dependency path from the original input to the final output.



