← MATH 347 MathScape 0 MATH347

The Chain Rule

9 min read

Jump to a section

Textbook Reference

Primary source OpenStax Calculus Volume 1, Section 3.6: “The Chain Rule”
Direct link https://openstax.org/books/calculus-volume-1/pages/3-6-the-chain-rule
Supplementary OpenStax Calculus Volume 1, Section 3.9: “Derivatives of Exponential and Logarithmic Functions”
Supplementary link https://openstax.org/books/calculus-volume-1/pages/3-9-derivatives-of-exponential-and-logarithmic-functions

Both sources are free and openly licensed.


Key idea

The chain rule is the rule for differentiating a function inside a function. It looks like a small computational trick, but in a differential equations course it does two large jobs, and you will use it constantly.

The first job is forward. When you check whether a proposed function solves a differential equation, you differentiate it, and most interesting solutions are composites such as $e^{kt}$ or $\ln(x^2 + 1)$. Without the chain rule you cannot differentiate these correctly, so you cannot verify a single nontrivial solution.

The second job is backward. The separation-of-variables method, which is the heart of a first differential equations course, is the chain rule run in reverse. When you write $\int \frac{1}{y}\, dy = \int k\, dx$ and integrate, the reason both sides match a genuine antiderivative is precisely the chain rule. Substitution, the most important integration technique you will use, is nothing more than the chain rule read from right to left.

So this is not a side topic. The chain rule is the engine underneath both halves of the course: checking solutions and finding them.


Prerequisite Check

Before this lesson, make sure you can do all of the following:

If basic derivatives are shaky, review a derivative-rules lesson first.


Quick Reference

The chain rule. If $y = f(g(x))$, then \[ \frac{dy}{dx} = f'(g(x)) \cdot g'(x). \] In words: the derivative of the outside (evaluated at the inside) times the derivative of the inside.

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

The most common special cases (each is the general rule with a specific outside function):

Composite Derivative
$\left[g(x)\right]^n$ $n\left[g(x)\right]^{n-1} g'(x)$
$e^{g(x)}$ $e^{g(x)} g'(x)$
$\ln\!\left(g(x)\right)$ $\dfrac{g'(x)}{g(x)}$
$\sin\!\left(g(x)\right)$ $\cos\!\left(g(x)\right) g'(x)$

Read backward (substitution). $\displaystyle \int f'(g(x))\, g'(x)\, dx = f(g(x)) + C.$


Key Concepts

1. What a Composite Function Is

A composite function is a function applied to the output of another function. The notation $f(g(x))$ means: take $x$, run it through $g$ to get $g(x)$, then run that result through $f$. The function $g$ is the inside and $f$ is the outside.

Reading a composite correctly, from the outside in, is the whole skill. The derivative rule then follows the same reading.

Function Outside $f$ Inside $g$
$(x^2 + 1)^5$ “raise to the fifth power” $x^2 + 1$
$e^{3x}$ “exponentiate” $3x$
$\ln(x^2 + 1)$ “natural log” $x^2 + 1$
$\sin(4x)$ “sine” $4x$

2. The Chain Rule Itself

If $y = f(g(x))$, then \[ \frac{dy}{dx} = f'(g(x)) \cdot g'(x). \] You differentiate the outside function, leave the inside untouched in its argument, and then multiply by the derivative of the inside. That final factor, $g'(x)$, is the part students most often forget.

Example 1. Differentiate $y = (x^2 + 1)^5$.

The outside is “fifth power,” the inside is $g(x) = x^2 + 1$. Differentiate the outside (bring down the $5$, drop the exponent by one), keep the inside, then multiply by $g'(x) = 2x$: \[ \frac{dy}{dx} = 5(x^2 + 1)^4 \cdot 2x = 10x(x^2 + 1)^4. \]

Important: do not forget the derivative of the inside. The single most common chain-rule error is writing $5(x^2 + 1)^4$ and stopping, omitting the factor $2x$. The rule has two parts multiplied together; the inside derivative is not optional.


3. The Exponential Case (the one you will use most in this course)

The derivative of $e^{g(x)}$ is $e^{g(x)}$ times the derivative of the exponent: \[ \frac{d}{dx}\, e^{g(x)} = e^{g(x)} \cdot g'(x). \] This is the case that appears every time you check an exponential solution of a differential equation.

Example 2. Differentiate $y = e^{3x}$.

The inside is $g(x) = 3x$, so $g'(x) = 3$: \[ \frac{dy}{dx} = e^{3x} \cdot 3 = 3e^{3x}. \]

Example 3. Verify that $P(t) = Ce^{kt}$ satisfies $\dfrac{dP}{dt} = kP$.

Differentiate $P$ with the chain rule. The constant $C$ stays, the inside is $kt$ with derivative $k$: \[ \frac{dP}{dt} = C \cdot e^{kt} \cdot k = k\left(Ce^{kt}\right) = kP. \] The derivative equals $k$ times the original function, so $P(t) = Ce^{kt}$ solves the equation. This is the prototype calculation of the whole course, and it is pure chain rule.


4. The Logarithm Case

The derivative of $\ln(g(x))$ is the derivative of the inside over the inside: \[ \frac{d}{dx}\,\ln\!\left(g(x)\right) = \frac{g'(x)}{g(x)}. \]

Example 4. Differentiate $y = \ln(x^2 + 1)$.

The inside is $g(x) = x^2 + 1$ with derivative $2x$: \[ \frac{dy}{dx} = \frac{2x}{x^2 + 1}. \]

This case matters for differential equations because the reverse direction, recognizing $\frac{g'(x)}{g(x)}$ as the derivative of a logarithm, is how many separated integrals are evaluated.


5. Leibniz Notation and the Cancellation Picture

Writing $u = g(x)$ and $y = f(u)$, the chain rule reads \[ \frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}. \] The notation suggests that the $du$ terms “cancel,” and although a derivative is not literally a fraction, this picture is reliable and is the bridge to the substitution method in integration.

Example 5. If $y = u^3$ and $u = x^2 + 1$, find $\dfrac{dy}{dx}$.

Compute the two pieces: $\dfrac{dy}{du} = 3u^2$ and $\dfrac{du}{dx} = 2x$. Multiply, then write the answer in terms of $x$: \[ \frac{dy}{dx} = 3u^2 \cdot 2x = 3(x^2 + 1)^2 \cdot 2x = 6x(x^2 + 1)^2. \]

Common error

substituting back too early or not at all. A correct final answer is written in terms of the original variable $x$, not the helper variable $u$. Leaving $\dfrac{dy}{dx} = 3u^2 \cdot 2x$ as the final answer is incomplete; replace $u$ with $x^2 + 1$.


6. Reading the Chain Rule Backward: Substitution

Run the rule from right to left. If an integrand has the shape $f'(g(x))\, g'(x)$, the antiderivative is $f(g(x))$: \[ \int f'(g(x))\, g'(x)\, dx = f(g(x)) + C. \] In practice you set $u = g(x)$, replace $g'(x)\, dx$ with $du$, integrate in $u$, and substitute back.

Example 6. Compute $\displaystyle \int 2x\,(x^2 + 1)^4\, dx$.

The inside is $x^2 + 1$, and its derivative $2x$ is present. Let $u = x^2 + 1$, so $du = 2x\, dx$: \[ \int u^4\, du = \frac{u^5}{5} + C = \frac{(x^2 + 1)^5}{5} + C. \] Check by differentiating, using the chain rule forward: \[ \frac{d}{dx}\left(\frac{(x^2 + 1)^5}{5}\right) = \frac{5(x^2 + 1)^4 \cdot 2x}{5} = 2x(x^2 + 1)^4. \] The check returns the integrand, so the answer is correct. Notice that the forward chain rule and the substitution are the same equation read in opposite directions.


Common Errors Summary

Error Example Correction
Forgetting the inside derivative $\frac{d}{dx}(x^2+1)^5 = 5(x^2+1)^4$ Multiply by $2x$: $10x(x^2+1)^4$
Forgetting it on exponentials $\frac{d}{dx}e^{3x} = e^{3x}$ $\frac{d}{dx}e^{3x} = 3e^{3x}$
Differentiating the inside in place of leaving it $\frac{d}{dx}\sin(4x) = \cos(4)$ $\frac{d}{dx}\sin(4x) = 4\cos(4x)$
Leaving the answer in terms of $u$ $3u^2 \cdot 2x$ Substitute back: $6x(x^2+1)^2$
Misreading which part is inside treating $e^{3x}$ as inside $e$ Inside is the exponent $3x$

Leveled Practice

Level 1 -- Direct Application

Problem 1. Differentiate $y = (3x + 2)^4$.

Show answer

Outside is “fourth power,” inside is $3x + 2$ with derivative $3$: \[ \frac{dy}{dx} = 4(3x + 2)^3 \cdot 3 = 12(3x + 2)^3. \]


Problem 2. Differentiate $y = e^{-5x}$.

Show answer

Inside is $-5x$ with derivative $-5$: \[ \frac{dy}{dx} = e^{-5x} \cdot (-5) = -5e^{-5x}. \]


Problem 3. Differentiate $y = \ln(2x + 7)$.

Show answer

Inside is $2x + 7$ with derivative $2$: \[ \frac{dy}{dx} = \frac{2}{2x + 7}. \]


Level 2 -- Multiple Steps

Problem 4. Differentiate $y = \sqrt{x^2 + 9}$.

Show answer

Rewrite as a power: $y = (x^2 + 9)^{1/2}$. Inside is $x^2 + 9$ with derivative $2x$: \[ \frac{dy}{dx} = \frac{1}{2}(x^2 + 9)^{-1/2} \cdot 2x = \frac{x}{\sqrt{x^2 + 9}}. \]


Problem 5. Differentiate $y = e^{x^2 - 3x}$.

Show answer

Inside is $x^2 - 3x$ with derivative $2x - 3$: \[ \frac{dy}{dx} = e^{x^2 - 3x}(2x - 3). \]


Problem 6. If $y = u^4$ and $u = \cos x$, find $\dfrac{dy}{dx}$.

Show answer

$\dfrac{dy}{du} = 4u^3$ and $\dfrac{du}{dx} = -\sin x$. Multiply and substitute back: \[ \frac{dy}{dx} = 4u^3 \cdot (-\sin x) = -4\cos^3 x \,\sin x. \]


Level 3 -- Backward and Connections

Problem 7. Compute $\displaystyle \int 3x^2\,(x^3 + 5)^6\, dx$ by recognizing the chain rule in reverse.

Show answer

Inside is $x^3 + 5$, derivative $3x^2$ is present. Let $u = x^3 + 5$, so $du = 3x^2\, dx$: \[ \int u^6\, du = \frac{u^7}{7} + C = \frac{(x^3 + 5)^7}{7} + C. \] Check: $\dfrac{d}{dx}\left(\frac{(x^3+5)^7}{7}\right) = (x^3+5)^6 \cdot 3x^2$. $\checkmark$


Problem 8. Verify that $y = e^{-2t}$ is a solution of the differential equation $\dfrac{dy}{dt} = -2y$.

Show answer

Differentiate with the chain rule: inside is $-2t$, derivative $-2$: \[ \frac{dy}{dt} = e^{-2t} \cdot (-2) = -2e^{-2t} = -2y. \] The derivative equals $-2$ times the function, so $y = e^{-2t}$ solves the equation. $\checkmark$

This is the exact skill used to confirm solutions throughout the course.


Problem 9. Differentiate $y = \ln\!\left(\dfrac{1}{1 + e^{-x}}\right)$ and simplify.

Show answer

Use a logarithm property first: $\ln\!\left(\frac{1}{1 + e^{-x}}\right) = -\ln(1 + e^{-x})$. Now differentiate with the logarithm chain rule. The inside is $1 + e^{-x}$, whose derivative is $-e^{-x}$: \[ \frac{dy}{dx} = -\frac{-e^{-x}}{1 + e^{-x}} = \frac{e^{-x}}{1 + e^{-x}}. \] Multiplying numerator and denominator by $e^{x}$ gives the tidy form $\dfrac{1}{1 + e^{x}}$. This logistic-shaped expression reappears when the logistic differential equation is solved.


Mastery Checklist

You have mastered this skill when you can do all of the following without referring to notes:


Mental Model

Think of a composite function as two gears meshed together.

The inside gear $g$ turns at its own rate $g'(x)$. The outside gear $f$ is driven by the inside gear and turns at rate $f'$ measured per turn of the inside. The overall rate at which the outside gear turns, measured against $x$, is the product of the two rates: how fast the outside turns per unit of inside, times how fast the inside turns per unit of $x$. That product is exactly $f'(g(x)) \cdot g'(x)$.

The inside-derivative factor is the gear ratio. Forgetting it is like reporting how fast the second gear spins while ignoring that the first gear is what drives it.

Holding this picture also makes substitution feel natural. Integration asks you to find the function whose gears produce a given combined rate. When the integrand already shows both gear rates multiplied together, you can read off the inside gear, integrate the outside, and reassemble the composite.


Connections

Within MATH347 (Differential Equations)

Toward Later Coursework

Audience Notes

For students who find math intimidating: The rule is two steps you already know, multiplied: differentiate the outside, then multiply by the derivative of the inside. The only discipline is to never skip that second factor. Say “times the derivative of the inside” out loud every time until it is automatic.

For students interested in proof: The chain rule follows from the definition of the derivative as a limit of difference quotients, with care taken where the inside derivative is zero. OpenStax Section 3.6 gives the rigorous argument.

For students interested in careers: The chain rule is the backbone of automatic differentiation, the technique that trains every modern neural network. Backpropagation is the chain rule applied across the layers of a computation, from the output back to the inputs.

For gifted and curious students: The chain rule generalizes to many variables, where it becomes a statement about matrices of partial derivatives (the Jacobian). The single-variable product of rates becomes a product of matrices, and the same composition principle drives multivariable change-of-variables in integration.


Back to MATH347 Week 0 | Previous: Antiderivatives and Indefinite Integrals | Next: Exponential Growth and Decay