M5.4.7 Chapter 7

Chain, product and quotient rules

How do I differentiate a function inside another function, a product, or a fraction?

Your guess

Pick one before you read on. It is fine to be wrong.

Your guess
  • You picked A. Read on. At the end, the chapter comes back to your guess.

  • You picked B. Read on. At the end, the chapter comes back to your guess.

  • You picked C. Read on. At the end, the chapter comes back to your guess.

By the end you can

  • Differentiate (3x + 1)⁵ with the chain rule
  • Differentiate x² sin x with the product rule
  • Differentiate a fraction with the quotient rule

So far you can differentiate xⁿ, eˣ, ln x, sin x and cos x, and sums of them. But most functions are built in other ways. The function (3x + 1)⁵ is a function inside another function. The function x² sin x is a product of two functions. The function (2x + 1) ÷ (x − 3) is a quotient. Each needs a rule of its own.

The chain rule is for a function of a function. Write y = u⁵ where u = 3x + 1. Then y depends on u, and u depends on x, like links in a chain. Now think of rates. If u changes 3 times as fast as x, and y changes 5u⁴ times as fast as u, then y changes 5u⁴ × 3 times as fast as x.

Draw it first

The chain of rates

  1. Three boxes x, u and y joined by two arrows. The first arrow is named 3x + 1 and the second arrow is named u⁵. Step 1 writes a rate under each arrow: du/dx = 3 under the first and dy/du = 5u⁴ under the second. Step 2 writes the result dy/dx = 15u⁴ at the bottom.x3x + 1uu⁵ydu/dx = 3dy/du = 5u⁴

    1 The rate along each arrow is the derivative of that step.

  2. Three boxes x, u and y joined by two arrows. The first arrow is named 3x + 1 and the second arrow is named u⁵. Step 1 writes a rate under each arrow: du/dx = 3 under the first and dy/du = 5u⁴ under the second. Step 2 writes the result dy/dx = 15u⁴ at the bottom.x3x + 1uu⁵ydu/dx = 3dy/du = 5u⁴dy/dx = 15u⁴

    2 Multiply the two rates. This gives dy/dx = 5u⁴ × 3 = 15u⁴.

The chain rule says: if y is a function of u and u is a function of x, then dy/dx = dy/du × du/dx. The symbols dy/du and du/dx look like fractions, and in this case multiplying them works as if the du cancelled. It is a rule you can trust, but remember that dy/dx is one symbol and not a real fraction.

Worked example

Differentiate y = (3x + 1)⁵.

  1. Let u = 3x + 1. Then y = u⁵.
  2. Differentiate each link: dy/du = 5u⁴ and du/dx = 3.
  3. Multiply: dy/dx = 5u⁴ × 3 = 15u⁴.
  4. Put u = 3x + 1 back: dy/dx = 15(3x + 1)⁴.
  5. At x = 0, u = 1, so the gradient is 15 × 1⁴ = 15.

Answer: dy/dx = 15(3x + 1)⁴.

A table with the heads h and chord gradient. The rows read 0.1 and 27.1293, 0.01 and 15.9274, 0.001 and 15.0903.hchord gradient0.127.12930.0115.92740.00115.0903
Chords of y = (3x + 1)⁵ from x = 0 to x = h. The gradients close in on 15, as the chain rule says, and not on 5.

The same idea gives a quick set of results. Whenever the inside is a straight line ax + b, the rate of change of the inside is the constant a, and it multiplies the result.

A table with the heads y and dy/dx. The rows read e^(kx) and k e^(kx); sin kx and k cos kx; cos kx and −k sin kx; (ax+b)ⁿ and an(ax+b)ⁿ⁻¹; ln(ax+b) and a/(ax+b).ydy/dxe^(kx)k e^(kx)sin kxk cos kxcos kx−k sin kx(ax+b)ⁿan(ax+b)ⁿ⁻¹ln(ax+b)a/(ax+b)
Results from the chain rule when the inside is a straight line. The constants a, b and k stay as they are.

Worked example

Differentiate y = (x² + 1)³, and find the gradient at x = 1.

  1. Let u = x² + 1. Then y = u³.
  2. Differentiate each link: dy/du = 3u² and du/dx = 2x.
  3. Multiply: dy/dx = 3u² × 2x = 6xu².
  4. Put u = x² + 1 back: dy/dx = 6x(x² + 1)².
  5. At x = 1: 6 × 1 × (1 + 1)² = 6 × 1 × 4 = 24.

Answer: dy/dx = 6x(x² + 1)².

See it three ways

With things

Gears in a line: turn the first gear once and the second turns 3 times. The second drives a third that turns 5 times for each turn of the second. One turn of the first makes the third turn 3 × 5 = 15 times. Rates multiply along the chain.

As a picture

Three boxes x, u and y joined by two arrows. The first arrow is named x² and the second arrow is named sin u. Under the arrows are the rates 2x and cos u. At the bottom is dy/dx = 2x cos u.xx²usin uy2xcos udy/dx = 2x cos u

In words

To differentiate a function of a function, differentiate the outside and the inside, and multiply the two results.

In symbols

dy/dx = dy/du × du/dx. For y = sin(x²), u = x² gives dy/dx = cos(x²) × 2x.

The product rule is for two functions multiplied together, y = uv, where u and v are both functions of x. A rectangle helps. It has sides u and v, so its area is uv. Let x grow a little, so that u grows by δu and v grows by δv. The new area is (u + δu)(v + δv).

A rectangle with width u and height v, hatched, and labelled uv. It grows by a strip of width δu on the right, labelled v δu, a strip of height δv on top, labelled u δv, and a small corner labelled δu δv.u δvv δuδu δvuvuδuvδv
The change in area is the two strips v δu and u δv, and the tiny corner δu δv. The corner is so small that it does not count when δx shrinks.

The change in area is v δu + u δv + δu δv. Divide by δx and let δx shrink. The two strips give v du/dx + u dv/dx. The corner gives δu δv ÷ δx, which goes to 0, since it is du/dx × δv with δv going to 0. So the product rule is: if y = uv, then dy/dx = u dv/dx + v du/dx.

Worked example

Differentiate y = x² sin x, and find the gradient at x = π.

  1. Let u = x² and v = sin x.
  2. Then du/dx = 2x and dv/dx = cos x.
  3. Product rule: dy/dx = u dv/dx + v du/dx = x² cos x + sin x × 2x.
  4. So dy/dx = x² cos x + 2x sin x.
  5. At x = π, cos π = −1 and sin π = 0. To 2 decimal places, dy/dx = π² × (−1) + 2π × 0 = −9.87.

Answer: dy/dx = x² cos x + 2x sin x. At x = π the gradient is −9.87.

The quotient rule is for a fraction y = u ÷ v. If y = u/v, then dy/dx = (v du/dx − u dv/dx) ÷ v². The order of the two terms on top matters, because there is a minus between them. Start with v du/dx, the bottom times the derivative of the top. Then subtract u dv/dx, the top times the derivative of the bottom.

Worked example

Differentiate y = (2x + 1) ÷ (x − 3), and find the gradient at x = 4.

  1. Let u = 2x + 1 and v = x − 3. Then du/dx = 2 and dv/dx = 1.
  2. The top of the quotient rule is v du/dx − u dv/dx = (x − 3) × 2 − (2x + 1) × 1.
  3. Expand: 2x − 6 − 2x − 1 = −7. The x terms cancel.
  4. So dy/dx = −7 ÷ (x − 3)².
  5. At x = 4: −7 ÷ 1² = −7.

Answer: dy/dx = −7/(x − 3)².

A graph of the curve y = (2x + 1) ÷ (x − 3) with the x axis x and the y axis y. The curve has two branches, one on each side of x = 3. The point P at (4, 9) is on the right branch and a tangent at P slopes steeply down and is named tangent.Ptangent2468−6612180xy
The curve y = (2x + 1) ÷ (x − 3) has no point at x = 3. The tangent at P (4, 9) has gradient −7, and the curve falls steeply there.

Which rule to use? Look at how the function is built from its last step. If the last step is a function of a bracket, use the chain rule. If the last step multiplies two functions, use the product rule. If the last step divides, use the quotient rule. Some functions need two rules, one inside the other.

A table with the heads you see and use. The rows read (3x + 1)⁵ and chain rule; x² sin x and product rule; sin x ÷ x and quotient rule; e^(2x) and chain rule.you seeuse(3x + 1)⁵chain rulex² sin xproduct rulesin x ÷ xquotient rulee^(2x)chain rule
Look at the last step of the function to choose the rule.

Try it

Check the chain rule with chords

You need: a calculator, paper and a pencil.

  1. Take y = (3x + 1)⁵. At x = 0, y = 1. Work out y at x = 0.1: 1.3⁵ = 3.71293.
  2. The chord gradient is (3.71293 − 1) ÷ 0.1 = 27.1293. Write it down.
  3. Do the same for x = 0.01 and x = 0.001. The values of y are 1.159274 and 1.015090.
  4. Compare the chord gradients with 15, the chain rule result, and with 5, the answer from forgetting the 3.

What you will see: The chord gradients are 27.13, 15.93 and 15.09. They close in on 15, not on 5.

If you cannot try it, this is what happens.
A table with the heads rule and gradient. The rows read power only and 5, chain rule and 15, chords and about 15.rulegradientpower only5chain rule15chordsabout 15

A wrong idea many people have

The derivative of (3x + 1)⁵ is 5(3x + 1)⁴. The power rule works on the bracket.

Why it feels right: It looks like the power rule, with the bracket in place of x. The answer 5(3x + 1)⁴ has the same shape as the power rule result for x⁵.

The test that breaks it: At x = 0 the chords of (3x + 1)⁵ have gradients 27.13, 15.93 and 15.09. The claim 5(3x + 1)⁴ gives 5 at x = 0. The chords are nowhere near 5.

What is true: The bracket changes 3 times as fast as x, and the chain rule multiplies by that rate. The result is 5(3x + 1)⁴ × 3 = 15(3x + 1)⁴. Always multiply by the derivative of the inside.

A wrong idea many people have

The derivative of a product uv is du/dx × dv/dx. For x² sin x it is 2x cos x.

Why it feels right: Adding and subtracting work term by term, so it seems that multiplying should too. The derivative of a product being the product of the derivatives looks tidy.

The test that breaks it: At x = π the chord gradient of x² sin x for a step of 0.001 is about −9.876, close to the true −9.870. The claim 2x cos x gives 2π × (−1) = −6.28.

What is true: In a product, each factor changes while the other one stays, and both effects add. That gives u dv/dx + v du/dx. The product rule has two terms, not one.

A wrong idea many people have

The derivative of u/v is (du/dx) ÷ (dv/dx). For (2x + 1) ÷ (x − 3) it is 2 ÷ 1 = 2.

Why it feels right: It is the same trick as the previous mistake, with division in place of multiplication. It looks like the derivative should split over the fraction.

The test that breaks it: At x = 4 the curve has y = 9. At x = 4.01, y = 9.02 ÷ 1.01 = 8.9307. The chord gradient is (8.9307 − 9) ÷ 0.01 = −6.93. The curve falls, and 2 says that it rises.

What is true: Use the quotient rule: (v du/dx − u dv/dx) ÷ v². Here that is −7/(x − 3)², which is −7 at x = 4. Note that the bottom is squared and that the minus sign sits between the two terms on top.

Key words

chain rule
dy/dx = dy/du × du/dx. It differentiates a function of a function.
product rule
if y = uv then dy/dx = u dv/dx + v du/dx.
quotient rule
if y = u/v then dy/dx = (v du/dx − u dv/dx) ÷ v².
composite function
a function built by putting one function inside another, such as (3x + 1)⁵.

Back to your guess

The answer is B: The derivative of y = (3x + 1)⁵ is 15(3x + 1)⁴.

The derivative is 15(3x + 1)⁴. The power rule brings down the 5 and lowers the power, but the bracket 3x + 1 changes 3 times as fast as x. So there is an extra factor 3. At x = 0, the chord gradients of (3x + 1)⁵ close in on 15, not on 5.

Check yourself

Try each one before you look. A wrong answer tells you where to go next.

  1. What is the derivative of y = (3x + 1)⁵?

    Tap your answer.
    1. Yes, that is right. Let u = 3x + 1. Then dy/du = 5u⁴ and du/dx = 3. Multiplying gives 15u⁴ = 15(3x + 1)⁴.

    2. Not this one. You used the power rule only. The chain rule multiplies by the derivative of the inside, 3x + 1, which is 3. Read this page again. Try another.

    3. Not this one. You multiplied by 3 and by 5 but did not lower the power. The power goes down by 1. Read this page again. Try another.

    See the answer

    15(3x + 1)⁴

    Let u = 3x + 1. Then dy/du = 5u⁴ and du/dx = 3. Multiplying gives 15u⁴ = 15(3x + 1)⁴.

    • If you chose B: You used the power rule only. The chain rule multiplies by the derivative of the inside, 3x + 1, which is 3. Read this page again.
    • If you chose C: You multiplied by 3 and by 5 but did not lower the power. The power goes down by 1. Read this page again.
  2. What is the derivative of y = sin 2x, with x in radians?

    Tap your answer.
    1. Not this one. You differentiated the outside, sin, but not the inside, 2x. The inside changes twice as fast as x. Read this page again. Try another.

    2. Not this one. The derivative of sin is cos, not −sin. The negative sign belongs to the derivative of cos. Read this page again. Try another.

    3. Yes, that is right. Let u = 2x. Then y = sin u, dy/du = cos u and du/dx = 2. Multiplying gives 2 cos u = 2 cos 2x.

    4. Not this one. The derivative of the outside function sin u is cos u, not sin u. Read this page again. Try another.

    See the answer

    2 cos 2x

    Let u = 2x. Then y = sin u, dy/du = cos u and du/dx = 2. Multiplying gives 2 cos u = 2 cos 2x.

    • If you chose A: You differentiated the outside, sin, but not the inside, 2x. The inside changes twice as fast as x. Read this page again.
    • If you chose B: The derivative of sin is cos, not −sin. The negative sign belongs to the derivative of cos. Read this page again.
    • If you chose D: The derivative of the outside function sin u is cos u, not sin u. Read this page again.
  3. Which rule do you use to differentiate y = x³ cos x?

    Tap your answer.
    1. Not this one. The chain rule is for a function inside another function. Here two separate functions are multiplied. Read this page again. Try another.

    2. Yes, that is right. The function x³ cos x is x³ multiplied by cos x. A product uses u dv/dx + v du/dx.

    3. Not this one. The quotient rule is for one function divided by another. Here the two are multiplied. Read this page again. Try another.

    See the answer

    The product rule

    The function x³ cos x is x³ multiplied by cos x. A product uses u dv/dx + v du/dx.

    • If you chose A: The chain rule is for a function inside another function. Here two separate functions are multiplied. Read this page again.
    • If you chose C: The quotient rule is for one function divided by another. Here the two are multiplied. Read this page again.
  4. Which rule is made for a fraction like y = (sin x) ÷ x?

    Tap your answer.
    1. Not this one. There is no function inside another function here. One function is divided by another. Read this page again. Try another.

    2. Not this one. You could write it as a product with x⁻¹, and that would work. But the question asks which rule is made for a fraction, and that is the quotient rule. Read this page again. Try another.

    3. Not this one. The power rule is for xⁿ alone. Here sin x is divided by x. Read this page again. Try another.

    4. Yes, that is right. The function is one function, sin x, divided by another, x. That is the quotient rule.

    See the answer

    The quotient rule

    The function is one function, sin x, divided by another, x. That is the quotient rule.

    • If you chose A: There is no function inside another function here. One function is divided by another. Read this page again.
    • If you chose B: You could write it as a product with x⁻¹, and that would work. But the question asks which rule is made for a fraction, and that is the quotient rule. Read this page again.
    • If you chose C: The power rule is for xⁿ alone. Here sin x is divided by x. Read this page again.
  5. Which rule do you use first to differentiate y = (x² + 1)⁴?

    Tap your answer.
    1. Not this one. There is no fraction in this function. Read this page again. Try another.

    2. Not this one. The function is a power of a bracket, not two separate functions multiplied. Read this page again. Try another.

    3. Yes, that is right. The bracket x² + 1 is inside the power 4. That is a function of a function, so use the chain rule.

    See the answer

    The chain rule

    The bracket x² + 1 is inside the power 4. That is a function of a function, so use the chain rule.

  6. From an earlier chapter

    What is the derivative of y = 4 cos x, with x in radians?

    Tap your answer.
    1. Yes, that is right. The constant 4 stays, and the derivative of cos x is −sin x. So dy/dx = −4 sin x.

    2. Not this one. The derivative of cos x is −sin x. The minus sign is needed. Go to M5.4.6. Try another.

    3. Not this one. The derivative of cos x is −sin x, not −cos x. Go to M5.4.6. Try another.

    See the answer

    −4 sin x

    The constant 4 stays, and the derivative of cos x is −sin x. So dy/dx = −4 sin x.

    • If you chose B: The derivative of cos x is −sin x. The minus sign is needed. Go to M5.4.6.
    • If you chose C: The derivative of cos x is −sin x, not −cos x. Go to M5.4.6.
  7. Find the gradient of y = (2x + 1)⁴ at x = 1.

    See the answer

    216

    The chain rule gives dy/dx = 4(2x + 1)³ × 2 = 8(2x + 1)³. At x = 1 this is 8 × 3³ = 8 × 27 = 216.

  8. Find the gradient of y = (x² + 1)(3x − 2) at x = 2. Use the product rule.

    See the answer

    31

    Let u = x² + 1 and v = 3x − 2. Then du/dx = 2x and dv/dx = 3. The product rule gives u × 3 + v × 2x. At x = 2, u = 5 and v = 4, so the gradient is 5 × 3 + 4 × 4 = 15 + 16 = 31.

  9. Find the gradient of y = (3x + 2) ÷ (x − 4) at x = 5. Use the quotient rule.

    See the answer

    −14

    The top of the quotient rule is (x − 4) × 3 − (3x + 2) × 1 = −14. So dy/dx = −14 ÷ (x − 4)². At x = 5 this is −14 ÷ 1 = −14.

  10. Find the gradient of y = x sin x at x = π, to 2 decimal places.

    See the answer

    −3.14

    The product rule gives dy/dx = x cos x + sin x. At x = π, cos π = −1 and sin π = 0, so the gradient is −π = −3.14.

Keep it

Copy this into your exercise book.

Chain: dy/dx = dy/du × du/dx. Product: u dv/dx + v du/dx. Quotient: (v du/dx − u dv/dx) ÷ v². Look at the last step of the function to choose.

Draw: A row of boxes x, u, y with the rate written under each arrow, and the three rules written below.

Reading with a child? A short page for the adult: what this chapter teaches and three questions to ask.

No internet tomorrow? Save the whole book as one file (925 KB). It opens on any phone.