SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 2.3.1 Power, constant and sum rulesConcept · 25 min
      2. 2.3.2 Product and quotient rulesConcept · 25 min
      3. 2.3.3 The chain ruleConcept · 30 min
      4. 2.3.4 Derivatives of exponentials and logarithmsConcept · 30 min
      5. 2.3.5 Derivatives of sine and cosineConcept · 35 min
      6. 2.3.6 Practice set: differentiationPractice set · 25 min
      7. 2.3.7 Case study: modified duration and elasticityCase study · 30 min

Level 2, Single-variable calculus 2.3 Differentiation rules Lesson 2 of 7

ConceptLesson 2.3.2 in Level 2, Single-variable calculus. About 25 minutes.

Product and quotient rules

Why a product needs its own rule

The derivative of a product is not the product of the derivatives. Lesson 2.3.1 showed one case: x2⋅x3=x5x^2 \cdot x^3 = x^5 has slope 5x45x^4. Multiplying the two slopes gives 2x⋅3x2=6x32x \cdot 3x^2 = 6x^3 instead, which is 6 at x=1x = 1 where the true slope is 5.

When both factors change, the product changes for two reasons at once. A picture shows how the two combine.

The area picture

Think of two functions f(x)f(x) and g(x)g(x) as the width and height of a rectangle. Its area is the product f⋅gf \cdot g. When xx grows by hh, the width grows by Δf\Delta f and the height by Δg\Delta g.

Take f(x)=x2f(x) = x^2 and g(x)=x+2g(x) = x + 2 at x=3x = 3. The rectangle is 9 wide and 5 tall, with area 45. A step of h=0.4h = 0.4 makes the width 11.56 and the height 5.4.

The rectangle f⋅gf \cdot g for f=x2f = x^2 and g=x+2g = x + 2, as xx goes from 3 to 3.4. The added area is two strips and a corner: 12.8+3.6+1.024=17.42412.8 + 3.6 + 1.024 = 17.424.

The new area is the old area plus three pieces.

  • A strip g⋅Δfg \cdot \Delta f, from the width growing.
  • A strip f⋅Δgf \cdot \Delta g, from the height growing.
  • A corner Δf⋅Δg\Delta f \cdot \Delta g, from both growing at once.

Now divide each piece by hh and let hh shrink.

gap hh0.10.010.001
strip g⋅Δfg \cdot \Delta f per hh30.530.0530.005
strip f⋅Δgf \cdot \Delta g per hh999
corner per hh0.610.06010.006001

The first row tends to g⋅f′=5×6=30g \cdot f' = 5 \times 6 = 30. The second is f⋅g′=9×1=9f \cdot g' = 9 \times 1 = 9. The corner is a small amount times a small amount, so even after dividing by hh it vanishes.

Rule: Product rule

(fg)′=f′g+fg′(fg)' = f'g + fg'

Differentiate the first factor and keep the second; then keep the first and differentiate the second; then add. Each term is one strip of the picture, and the corner shrinks away.

So the slope of x2(x+2)x^2(x + 2) at 3 is 30+9=3930 + 9 = 39. Algebra agrees: x2(x+2)=x3+2x2x^2(x + 2) = x^3 + 2x^2, with derivative 3x2+4x3x^2 + 4x, which is 27+12=3927 + 12 = 39 at 3. Multiplying the slopes would give 6×1=66 \times 1 = 6.

The units work like area. If the width and height were in metres and xx in seconds, each strip would grow in square metres per second.

Try it

The loop measures the two strips and the corner, each divided by hh, for the rectangle above.

round(…, 6) hides rounding noise in the last digits. SymPy then confirms the slope 39. Its answer, x**2 + 2*x*(x + 2), is the product rule itself: 2x(x+2)+x22x(x + 2) + x^2.

⌘/Ctrl + Enter runs the cell

A second example

For x2(x3+1)x^2(x^3 + 1), take f=x2f = x^2 and g=x3+1g = x^3 + 1, so f′=2xf' = 2x and g′=3x2g' = 3x^2. The product rule gives 2x(x3+1)+x2⋅3x2=5x4+2x2x(x^3 + 1) + x^2 \cdot 3x^2 = 5x^4 + 2x. At x=1x = 1 the slope is 7.

Expanding first gives the same: x5+x2x^5 + x^2 has derivative 5x4+2x5x^4 + 2x. The product rule matters when expanding is long or impossible, as with the exponentials of lesson 2.3.4.

When the factors pull in opposite directions

In x(6−x)x(6 - x) the first factor rises with slope 1 and the second falls with slope −1-1. The product rule gives 1⋅(6−x)+x⋅(−1)=6−2x1 \cdot (6 - x) + x \cdot (-1) = 6 - 2x. The two terms have opposite signs, and the larger one wins.

xx135
f′gf'g531
fg′fg'−1-1−3-3−5-5
slope of the product40−4-4

At 1 the rising factor wins and the product climbs. At 3 the terms cancel and the product is flat for an instant. At 5 the falling factor wins.

Constant factors and three factors

If one factor is a constant cc, its slope is 0 and the rule gives 0⋅g+c g′=c g′0 \cdot g + c\,g' = c\,g'. That is the constant rule of lesson 2.3.1, so nothing changes.

With three factors, apply the rule twice. Each term differentiates one factor and keeps the other two: (fgk)′=f′gk+fg′k+fgk′(fgk)' = f'gk + fg'k + fgk'. For x⋅x⋅xx \cdot x \cdot x that gives x2+x2+x2=3x2x^2 + x^2 + x^2 = 3x^2, as the power rule says.

Try it

SymPy checks the second example, the table for x(6−x)x(6 - x), and the three-factor case.

sp.factor tidies an answer, sometimes into a different but equal form: x*(5*x**3 + 2) is 5x4+2x5x^4 + 2x.

⌘/Ctrl + Enter runs the cell

The quotient rule

A quotient fg\frac{f}{g} has its own rule. It looks like the product rule with a minus sign and a new bottom.

Rule: Quotient rule

(fg)′=f′g−fg′g2\left(\frac{f}{g}\right)' = \frac{f'g - fg'}{g^2}

Derivative of the top times the bottom, minus the top times the derivative of the bottom, all over the bottom squared. The order on top matters, because of the minus sign.

Take xx+1\frac{x}{x + 1}, with f=xf = x and g=x+1g = x + 1, so f′=1f' = 1 and g′=1g' = 1. The rule gives

1⋅(x+1)−x⋅1(x+1)2=1(x+1)2\frac{1 \cdot (x + 1) - x \cdot 1}{(x + 1)^2} = \frac{1}{(x + 1)^2}

At x=1x = 1 that is 14\frac{1}{4}. The central difference from lesson 2.2.2 agrees.

gap hh0.10.010.001
central difference at 10.2506270.2500060.25

The rule also reproduces a result from lesson 2.2.2. For 1x\frac{1}{x}, take f=1f = 1 and g=xg = x: the slope is 0⋅x−1⋅1x2=−1x2\frac{0 \cdot x - 1 \cdot 1}{x^2} = -\frac{1}{x^2}.

Signs, and where a quotient breaks

The bottom g2g^2 is never negative, so the sign of the slope is the sign of the top, f′g−fg′f'g - fg'. Swapping the two terms flips the sign: it would give −14-\frac{1}{4} for xx+1\frac{x}{x + 1} at 1, which is wrong.

For x2x2+1\frac{x^2}{x^2 + 1} the top simplifies to 2x2x, so the slope is 2x(x2+1)2\frac{2x}{(x^2 + 1)^2}. It is −0.5-0.5 at x=−1x = -1, 0 at x=0x = 0 and 0.50.5 at x=1x = 1: falling, flat, then rising.

Where the bottom is 0, the quotient has no value, so it has no slope. xx+1\frac{x}{x + 1} has none at x=−1x = -1.

Use the quickest rule

The quotient rule always works when the bottom is not 0, but it is not always the quickest.

  • Constant top: 3x2=3x−2\frac{3}{x^2} = 3x^{-2}, so the power rule gives −6x3-\frac{6}{x^3}.
  • Constant bottom: x2+14\frac{x^2 + 1}{4} is 14(x2+1)\frac{1}{4}(x^2 + 1), with slope x2\frac{x}{2}.
  • A single power at the bottom: split it, as in lesson 2.3.1.
  • A sum at the bottom: use the quotient rule. 1x2+1\frac{1}{x^2 + 1} has slope 0−1⋅2x(x2+1)2=−2x(x2+1)2\frac{0 - 1 \cdot 2x}{(x^2 + 1)^2} = -\frac{2x}{(x^2 + 1)^2}.

Try it

The loop prints the central differences of xx+1\frac{x}{x + 1} at 1. SymPy then differentiates every quotient in this section.

The slopes of x2x2+1\frac{x^2}{x^2 + 1} at −1-1, 0 and 1 print as fractions.

⌘/Ctrl + Enter runs the cell

Lesson 2.3.3 handles a function inside another function, and lesson 2.6.2 runs the product rule backwards as integration by parts. Case study 2.3.7 applies the product rule to revenue, a price times a quantity.

Common mistakes

  1. (fg)′≠f′g′(fg)' \neq f'g'. For x2(x+2)x^2(x + 2) at 3 that gives 6; the product rule gives 39.
  2. Each term differentiates exactly one factor. f′g+fg′f'g + fg', never f′g′f'g' or f′g+f′gf'g + f'g.
  3. Keep the order on top of the quotient rule: f′g−fg′f'g - fg'. Swapping flips the sign of the answer.
  4. Square the bottom. The quotient rule divides by g2g^2, not by gg.
  5. No slope where the bottom is 0. xx+1\frac{x}{x + 1} has none at −1-1.
  6. Same names, different rules. The product and quotient rules of exponents (lesson 1.4.1) and logs (lesson 1.4.3) combine powers; these rules find slopes.

Product and quotient rules

0 of 11 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
  9. 9.
  10. 10.
  11. 11.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • The derivative of a product is not the product of the derivatives.
  • Product rule: (fg)′=f′g+fg′(fg)' = f'g + fg'. In the area picture, each term is one strip; the corner vanishes.
  • When one factor rises and the other falls, the two terms have opposite signs and the larger wins.
  • Quotient rule: (fg)′=f′g−fg′g2\left(\frac{f}{g}\right)' = \frac{f'g - fg'}{g^2}. Keep the order on top; there is no slope where g=0g = 0.
  • A constant top or a single-power bottom is quicker with the power rule. Check every derivative with sp.diff.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.

  • Derivatives

    Paul's Online Notes. Notes.

    The definition of the derivative and every differentiation rule, one page per rule.

  • Essence of Calculus

    3Blue1Brown. Video.

    An animated series that rebuilds calculus from pictures.