III.5 · Calculus
Why does a product's rate need both factors?
Grow a rectangle whose sides are two changing quantities and see the product rule appear as two strips and a vanishing corner. Then divide, and meet the points where a quotient — and its rule — stop existing.
Derive sum, product and quotient rules
w(x) = u(x) · v(x) and its tangent at x = 1
u(x) = x + 1 (dashed blue), v(x) = x² + 1 (dashed green) and w = u · v (solid). At x = 1: w = 4, tangent slope by the rule 6.
Product as an area: u·v and its increment
Rectangle with sides u = 2 and v = 2. After Δx = 0.5 the sides become 2.5 and 3.25. The added area 4.125 is vΔu = 1 (blue strip) + uΔv = 2.5 (green strip) + ΔuΔv = 0.625 (corner).
- Point
- 1
- First factor
- 2
- Second factor
- 2
- Rate of u
- 1
- Rate of v
- 2
- Combined value u · v
- 4
- Derivative by the rule
- 6
- Check: expand, then differentiate
- 6
- Exact agreement
- yes, exactly equal
Exact values use =; binary64 approximations use ≈. Undefined values state their reason.
Product rule: each factor's rate is weighted by the OTHER factor's value. Exact result 6, equal to differentiating the expanded product. The corner ΔuΔv is second-order: it vanishes from the rate as Δx → 0.
Evaluate the factors
u(1) = 2, v(1) = 2.
from −3 to 3, up to 2 decimal places
from −3 to 3, up to 2 decimal places
from −3 to 3, up to 2 decimal places
from −2.5 to 2.5, up to 2 decimal places
from −1 to 1, up to 2 decimal places
The product plane shows as the area of a rectangle with sides and . When grows by , the area gains a blue strip , a green strip and a small corner . The inspector confirms that these three pieces add up exactly to the change of the product. Now choose Quotient with v(x) = 0: there is no value, no tangent and no rule result at that .
Intuition: a rate is a sensitivity
says how fast changes per unit of . In a sum , the two changes simply add. In a product, a change in matters more when the other factor is large: a 1-unit wider rectangle gains area equal to its height. Each factor’s rate is weighted by the other factor’s value.
Definition
For differentiable , and constants , :
and, wherever ,
Mechanics: what the explorer computes
The factors have rational coefficients, so every value is exact. The rule row applies the formula above. The check row reaches the same derivative independently: for sums and products by expanding the polynomial first and differentiating term by term; for a quotient by differentiating the identity with the product rule. The agreement row is an exact rational comparison. Where , the quotient is undefined and every row says so.
Derivation: the product rule from area
Let and . Then exactly
Divide by :
As , the two quotients tend to and , while because a differentiable is continuous. The corner term disappears, leaving .
Quotient. If and , then , so and
This derivation divides by ; it is meaningless where .
Worked example
Take , at . Then , , , .
- Product: . Expanding first, has derivative .
- Quotient: .
With : grows to and to . The area changes by , which is plus plus .
Replay the worked derivation
Evaluate the factors
u(1) = 2, v(1) = 2.
Domains and failures
A quotient rule result exists only where the quotient itself exists. For the quotient is undefined at . At with , cancelling removes a hole, but the derivative at still does not exist in the original function, because the original function has no value there. The explorer draws dashed caution lines where vanishes.
Executable reference code
The reference checks the product and quotient rules against expansion with Fraction and raises an error where the denominator is zero. The NumPy version differentiates polynomial products with numpy.polynomial and masks points where a quotient is undefined.
"""Product and quotient rules checked against expansion, with exact Fractions (III.5)."""
from fractions import Fraction as F
def poly_eval(c, x):
return sum(ck * x**k for k, ck in enumerate(c))
def poly_mul(a, b):
out = [F(0)] * (len(a) + len(b) - 1)
for i, x in enumerate(a):
for j, y in enumerate(b):
out[i + j] += x * y
return out
def poly_der(c):
return [k * ck for k, ck in enumerate(c)][1:]
u, v = [F(1), F(1)], [F(1), F(0), F(1)] # u = x + 1, v = x**2 + 1
x = F(1)
product_rule = poly_eval(poly_der(u), x) * poly_eval(v, x) + poly_eval(u, x) * poly_eval(poly_der(v), x)
assert product_rule == poly_eval(poly_der(poly_mul(u, v)), x) == 6
def quotient_rule(u, v, x):
vx = poly_eval(v, x)
if vx == 0:
raise ZeroDivisionError("v(x) = 0: u/v and its derivative are undefined")
return (poly_eval(poly_der(u), x) * vx - poly_eval(u, x) * poly_eval(poly_der(v), x)) / vx**2
assert quotient_rule(u, v, x) == F(-1, 2)
try:
quotient_rule(u, [F(-1), F(0), F(1)], F(1)) # v = x**2 - 1 vanishes at 1
except ZeroDivisionError:
pass
else:
raise AssertionError("the quotient rule must not apply where v = 0")"""Rules with numpy.polynomial: products differentiate like expansions; quotients are masked where v = 0 (III.5)."""
import numpy as np
from numpy.polynomial import Polynomial as P
u, v = P([1, 1]), P([1, 0, 1])
x = np.linspace(-2, 2, 9)
assert np.allclose((u * v).deriv()(x), u.deriv()(x) * v(x) + u(x) * v.deriv()(x))
w = P([-1, 0, 1]) # x**2 - 1: zero at +-1
valid = w(x) != 0
q_prime = (u.deriv()(x[valid]) * w(x[valid]) - u(x[valid]) * w.deriv()(x[valid])) / w(x[valid]) ** 2
assert valid.sum() == len(x) - 2 and np.all(np.isfinite(q_prime))Explore
Make negative with Negative factor: the area picture still balances, with signed strips. Set so is constant: the product rule reduces to . In quotient mode, move below zero and slide toward a root of .
Common mistakes
: try . In the quotient rule, the order matters. A rule result is not valid at points where the function is undefined, even if the formula’s numerator looks harmless.
Numerical considerations
These rules are exact identities; numerical issues appear only in evaluation. A quotient near a zero of divides by a tiny number, amplifying any error in or ; the derivative over amplifies even more. Exact arithmetic sidesteps this here; floating-point code should check how close is to zero.
Engineering and ML connections
Automatic differentiation (III.10) applies exactly these local rules — sum, product, quotient — at every node of a computation. Normalisations such as softmax or layer normalisation contain quotients, and their derivatives inherit the same domain restrictions near a vanishing denominator.
Exercises
Summary and checkpoints
Derivatives are linear; a product’s rate weights each factor’s rate by the other factor’s value; a quotient’s rule follows from the product rule and holds only where the denominator is nonzero. Next, III.6 handles functions of functions: the chain rule.