Math Solver Free

Calculus

Chain Rule: Formula, Method and Worked Examples

Math Solver Free Team

Student working through chain rule examples on paper, differentiating composite functions step by step

The chain rule differentiates a function inside another function: if y = f(g(x)), then dy/dx = f′(g(x)) · g′(x) — differentiate the outside function while leaving the inside untouched, then multiply by the derivative of the inside. One-line summary: outside derivative, times inside derivative. Headline example: d/dx sin(x²) = cos(x²) · 2x = 2x·cos(x²). Almost every interesting derivative — sin(x²), (3x² + 1)⁵, e^(2x), √(x³ + 2), ln(5x) — is a composite like this, so the chain rule is the single most-used differentiation rule after the power rule itself. This guide shows how to spot the inside function, works three examples with no step skipped, and ends with the one mistake that costs more marks than all the others combined. Every result below was verified symbolically before publication.

When to use the chain rule: a function inside a function

Reach for the chain rule whenever the argument of a function is more than a bare x. If you can point at an expression and say "that whole thing is sitting inside something else", you have a composite. sin(x²): the inside is x², the outside is sine. (3x² + 1)⁵: the inside is 3x² + 1, the outside is "raise to the 5th power". √(x³ + 2): the inside is x³ + 2, the outside is the square root. e^(2x): the inside is 2x, the outside is the exponential. By contrast, plain sin(x), x⁵ and eˣ have the bare variable inside, so the basic rules apply directly and no chain rule is needed. A quick test: rewrite the function as f(g(x)) with named pieces. If g(x) is anything other than x itself, the chain rule is in play — and the derivative will always end with "times g′(x)". If a problem mixes a product of two composites, you will need the chain rule inside the product rule; our product and quotient rule guide works that combination. To check any answer instantly, the derivative calculator applies exactly the method on this page.

The outside-inside method in three steps

  1. Name the inside and the outside. Write the function as outside(inside). For (3x² + 1)⁵: inside u = 3x² + 1, outside = u⁵.
  2. Differentiate the outside, inside untouched. Pretend the inside is a single letter and differentiate as usual: u⁵ becomes 5u⁴, i.e. 5(3x² + 1)⁴. Do not simplify or alter the inside in this step.
  3. Multiply by the derivative of the inside. u = 3x² + 1 has derivative 6x, so the full answer is 5(3x² + 1)⁴ · 6x = 30x(3x² + 1)⁴.

That third step is the whole rule. The derivative of the outside alone is never the final answer for a composite — it is only the first factor. A useful picture: the composite is a machine inside a machine, and the total rate of change is the outside machine's rate multiplied by the inside machine's rate. Rates multiply; they do not add.

Worked example 1: d/dx sin(x²) = 2x·cos(x²)

Inside: u = x². Outside: sin(u), whose derivative is cos(u). Step 2 gives cos(x²) — note the argument stays x², not x. Step 3: the inside derivative is u′ = 2x. Multiply: d/dx sin(x²) = 2x·cos(x²). Compare with the plain d/dx sin(x) = cos(x): the composite version carries the extra factor 2x, and that factor is exactly the chain rule's contribution. Sanity check at x = 1: the formula gives 2·cos(1) ≈ 2(0.5403) ≈ 1.0806, and a numeric difference quotient of sin(x²) at x = 1 gives the same 1.0806. If your answer were just cos(x²), the numeric check would expose it immediately — it predicts 0.5403, half the true slope.

Worked example 2: d/dx (3x² + 1)⁵ = 30x(3x² + 1)⁴

Inside: u = 3x² + 1. Outside: u⁵, derivative 5u⁴. Step 2: 5(3x² + 1)⁴. Step 3: u′ = 6x. Multiply and tidy the constants: 5 · 6x = 30x, so d/dx (3x² + 1)⁵ = 30x(3x² + 1)⁴. Notice the exponent drops from 5 to 4 on the bracket, exactly as the plain power rule drops x⁵ to 5x⁴ — the only new ingredient is the final × 6x. Spot check at x = 1: the formula gives 30 · (4)⁴ = 30 · 256 = 7,680. A difference quotient, ((3(1.001)² + 1)⁵ − 4⁵)/0.001, gives ≈ 7,683, matching to rounding. Large numbers are normal here: the fifth power amplifies the inside's growth, and the chain rule is what carries that amplification into the answer.

Worked example 3: d/dx √(x³ + 2) = 3x² / (2√(x³ + 2))

Rewrite the root as a power first: √(x³ + 2) = (x³ + 2)^(1/2). Inside: u = x³ + 2. Outside: u^(1/2), derivative (1/2)u^(−1/2). Step 2: (1/2)(x³ + 2)^(−1/2). Step 3: u′ = 3x². Multiply: (3x²/2) · (x³ + 2)^(−1/2), which written with the root back in place is 3x² / (2√(x³ + 2)). At x = 1 this is 3/(2√3) ≈ 0.8660, matching the numeric slope of √(x³ + 2) at x = 1. The pattern to memorise is structural, not the specific answer: power outside → bring the power down, reduce it by one, keep the inside intact, multiply by the inside's derivative. The same skeleton handles (anything)ⁿ, √(anything) and 1/(anything) — only the outside derivative changes.

Two layers deep, and the quiet case of ln(5x)

Composites can nest. In sin(3x² + 1) there are still two layers; in e^(sin x) the outside is the exponential and the inside is sin x, giving e^(sin x) · cos x. Work strictly outside-in, multiplying one inner derivative per layer. A deceptively quiet case is ln(5x): the inside 5x has derivative 5, and the outside derivative is 1/(inside), so d/dx ln(5x) = (1/(5x)) · 5 = 1/x — the 5 cancels, which is why ln(5x), ln(3x) and ln(x) all share the derivative 1/x. Cancellation is not a reason to skip the step; it is the step working. In multivariable work the same idea, one variable at a time, produces the partial derivatives in our partial derivative examples. The reference treatment is OpenStax Calculus Volume 1, §3.6 (The Chain Rule), free online.

Common mistakes

  • Forgetting the inner derivative. Writing d/dx sin(x²) = cos(x²) and stopping. This is the classic error — the answer is missing the factor 2x, and it is wrong everywhere except x = 1/2-style coincidences. If your derivative of a composite has no trace of the inside's derivative, it is not finished.
  • Changing the inside while differentiating the outside. In step 2 the inside must stay exactly as it was: (3x² + 1)⁵ becomes 5(3x² + 1)⁴, not 5(3x²)⁴ or 5(x² + 1)⁴.
  • Applying the power rule to the whole composite. (3x² + 1)⁵ is not 5(3x² + 1)⁴ alone, and it is certainly not 15x⁴ + 1-style term-by-term guesses. Expand-and-check with the calculator if tempted.
  • Losing the sign on trig and exponential insides. d/dx cos(u) = −sin(u) · u′ — the minus sign belongs to the outside derivative and survives multiplication.

Frequently asked questions

What is the chain rule in simple words?

Differentiate the outside function, keep the inside exactly as it is, then multiply by the derivative of the inside: d/dx f(g(x)) = f′(g(x)) · g′(x).

How do I know when to use the chain rule?

Whenever one function sits inside another — the argument is more than a bare x. If you can name an inside g(x) that is not just x, the chain rule applies.

What is the derivative of sin(x²)?

2x·cos(x²): the outside sine becomes cosine with the argument x² unchanged, multiplied by the inside derivative 2x.

Why is the derivative of ln(5x) just 1/x?

The chain rule gives (1/(5x)) · 5, and the 5 from the inner derivative cancels the 5 inside — so ln(kx) has derivative 1/x for any constant k.

Can the chain rule be used twice in one problem?

Yes — nested composites take one inner-derivative factor per layer, working strictly outside-in, as in e^(sin x) → e^(sin x) · cos x.

About the Math Solver Team

The Math Solver Team builds and maintains the calculators and step-by-step solvers on this site. Every tool is checked against worked textbook examples before it is published, and the method behind each solver is written out in full — in the worked examples on the page and in our guides — so you can see exactly how an answer is reached, not just the answer itself.

How we build and test our tools·More about the team