TExcelTAD
Home › Calculus in Depth › The Product and Quotient Rules

The Product and Quotient Rules

The derivative of a product is not the product of the derivatives, and the derivative of a quotient is not the quotient of the derivatives. This lesson proves the correct rules, uses them to extend the power rule to negative exponents, and shows how to keep the algebra under control.

For a gentler first look, see Product and Quotient Rules. The rules for single terms come from Derivatives of Polynomials and Exponential Functions.

A quick warning

Take f(x)=xf(x) = x and g(x)=x2g(x) = x^2. Then f⋅g=x3f \cdot g = x^3 has derivative 3x23x^2, but f′⋅g′=1⋅2x=2xf' \cdot g' = 1 \cdot 2x = 2x. Wrong. Products need a better rule.

The product rule

If ff and gg are differentiable at xx, then

(f⋅g)′=f′⋅g+f⋅g′(f \cdot g)' = f' \cdot g + f \cdot g'

Proof. Add and subtract f(x+h)⋅g(x)f(x + h) \cdot g(x) in the numerator, which splits the change into "ff changes" and "gg changes":

f(x+h)g(x+h)−f(x)g(x)h=f(x+h)⋅g(x+h)−g(x)h+g(x)⋅f(x+h)−f(x)h\begin{aligned} &\frac{f(x+h)g(x+h) - f(x)g(x)}{h} \\ &\qquad = f(x+h) \cdot \frac{g(x+h) - g(x)}{h} + g(x) \cdot \frac{f(x+h) - f(x)}{h} \end{aligned}

As h→0h \to 0, the two difference quotients tend to g′(x)g'(x) and f′(x)f'(x). Also f(x+h)→f(x)f(x + h) \to f(x) because a differentiable function is continuous (The Derivative as a Function). The limit is f(x)g′(x)+g(x)f′(x)f(x)g'(x) + g(x)f'(x). ∎

A picture helps: if ff and gg are the sides of a rectangle, a small change adds a strip f⋅Δgf \cdot \Delta g, a strip g⋅Δfg \cdot \Delta f and a tiny corner Δf⋅Δg\Delta f \cdot \Delta g. The corner is second order and vanishes in the limit.

For three factors, apply the rule twice: (fgk)′=f′gk+fg′k+fgk′(fgk)' = f'gk + fg'k + fgk'. Each term differentiates one factor and leaves the rest alone.

The quotient rule

If ff and gg are differentiable at xx and g(x)≠0g(x) \ne 0, then

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

Proof. First the reciprocal. For g(x)≠0g(x) \ne 0, continuity keeps g(x+h)≠0g(x + h) \ne 0 for small hh, and

1/g(x+h)−1/g(x)h=g(x)−g(x+h)h⋅1g(x+h)⋅g(x)→−g′(x)⋅1g(x)2\frac{1/g(x+h) - 1/g(x)}{h} = \frac{g(x) - g(x+h)}{h} \cdot \frac{1}{g(x+h) \cdot g(x)} \to -g'(x) \cdot \frac{1}{g(x)^2}

So (1/g)′=−g′/g2(1/g)' = -g'/g^2. Now write f/g=f⋅(1/g)f/g = f \cdot (1/g) and use the product rule:

(f/g)′=f′⋅(1/g)+f⋅(−g′/g2)=f′g−fg′g2■(f/g)' = f' \cdot (1/g) + f \cdot (-g'/g^2) = \frac{f'g - fg'}{g^2} \qquad \blacksquare

A memory aid: "low d-high minus high d-low, over low squared". The order matters, because the numerator is a difference.

Negative powers

The reciprocal rule finishes the power rule for negative integers. With n=−mn = -m, m>0m > 0:

ddxx−m=ddx1xm=−m⋅xm−1x2m=−m⋅x−m−1\frac{d}{dx} x^{-m} = \frac{d}{dx} \frac{1}{x^m} = -\frac{m \cdot x^{m-1}}{x^{2m}} = -m \cdot x^{-m-1}

which is n⋅xn−1n \cdot x^{n-1} again. The power rule now holds for every integer exponent.

Checking with SymPy

SymPy applies these rules automatically. Below it differentiates a product and a quotient, then we confirm the quotient rule formula symbolically for arbitrary functions ff and gg.

python · try it yourself
import sympy as sp

x = sp.symbols('x')
prod = x**3 * sp.exp(x)
quot = (x**2 + 1) / (x - 2)
print("d/dx x³eˣ        =", sp.factor(sp.diff(prod, x)))
print("d/dx (x²+1)/(x−2) =", sp.factor(sp.diff(quot, x)))

f, g = sp.Function('f')(x), sp.Function('g')(x)
rule = (sp.diff(f, x)*g - f*sp.diff(g, x)) / g**2
print("quotient rule holds:", sp.simplify(sp.diff(f/g, x) - rule) == 0)
d/dx x³eˣ        = x**2*(x + 3)*exp(x)
d/dx (x²+1)/(x−2) = (x**2 - 4*x - 1)/(x - 2)**2
quotient rule holds: True

By hand: (x3ex)′=3x2ex+x3ex=x2(x+3)ex(x^3e^x)' = 3x^2e^x + x^3e^x = x^2(x + 3)e^x, and

(x2+1x−2)′=2x(x−2)−(x2+1)⋅1(x−2)2=x2−4x−1(x−2)2\left(\frac{x^2 + 1}{x - 2}\right)' = \frac{2x(x - 2) - (x^2 + 1) \cdot 1}{(x - 2)^2} = \frac{x^2 - 4x - 1}{(x - 2)^2}

Tip: Before reaching for the quotient rule, simplify. x3+2xx\frac{x^3 + 2x}{x} is just x2+2x^2 + 2 for x≠0x \ne 0, and 3/x43/x^4 is 3x−43x^{-4}, which the power rule handles in one step.

Where a rational function is flat

Setting the numerator of a quotient-rule derivative to zero finds horizontal tangents. For r(x)=xx2+4r(x) = \frac{x}{x^2 + 4}:

r′(x)=(x2+4)−x⋅2x(x2+4)2=4−x2(x2+4)2r'(x) = \frac{(x^2 + 4) - x \cdot 2x}{(x^2 + 4)^2} = \frac{4 - x^2}{(x^2 + 4)^2}

which is zero at x=±2x = \pm 2. The graph rises to a peak of r(2)=14r(2) = \frac{1}{4}.

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-8, 8, 400)
r = x / (x**2 + 4)
dr = (4 - x**2) / (x**2 + 4)**2

plt.figure(figsize=(6, 4))
plt.plot(x, r, label="r(x) = x/(x² + 4)")
plt.plot(x, dr, "--", label="r′(x)")
plt.axhline(0, color="gray", lw=0.8)
for a in (-2, 2):
    plt.axvline(a, color="gray", ls=":", lw=0.8)
plt.legend()
plt.title("r′ changes sign where r has its peak and trough")
print("max of r on grid:", round(float(r.max()), 4), "at x =", round(float(x[r.argmax()]), 2))
max of r on grid: 0.25 at x = 1.98

The grid maximum sits next to x=2x = 2 because x=2x = 2 itself is not a grid point; the exact peak is 14\frac{1}{4} at x=2x = 2.

In software

  • Normalisation: softmax, ezi/∑ezje^{z_i} / \sum e^{z_j}, is a quotient. Its gradient, si(δij−sj)s_i(\delta_{ij} - s_j), comes straight from the quotient rule and drives every classifier and LLM output layer (Backpropagation Is the Chain Rule).
  • Autodiff: a framework that records mul and div nodes stores exactly these rules as their backward passes (Automatic Differentiation).
  • Rendering: perspective projection divides by depth, x/zx/z; screen-space derivatives used for texture filtering are quotient-rule derivatives.
  • Economics code: average cost C(q)/qC(q)/q is minimised where (C′q−C)/q2=0(C'q - C)/q^2 = 0, i.e. marginal cost equals average cost.

Exercises

Exercise 1: A product

Differentiate y=(2x+1)(x2−3)y = (2x + 1)(x^2 - 3) with the product rule, then expand and check.

Answer

y′=6x2+2x−6y' = 6x^2 + 2x - 6

Solution
y′=2⋅(x2−3)+(2x+1)⋅2x=2x2−6+4x2+2x=6x2+2x−6check: y=2x3+x2−6x−3,y′=6x2+2x−6\begin{aligned} &y' = 2 \cdot (x^2 - 3) + (2x + 1) \cdot 2x = 2x^2 - 6 + 4x^2 + 2x = 6x^2 + 2x - 6 \\ &\text{check: } y = 2x^3 + x^2 - 6x - 3, \quad y' = 6x^2 + 2x - 6 \end{aligned}

Exercise 2: A quotient

Differentiate y=3x−1x+2y = \frac{3x - 1}{x + 2}.

Answer

y′=7(x+2)2y' = \frac{7}{(x + 2)^2}

Solution
y′=3(x+2)−(3x−1)⋅1(x+2)2=3x+6−3x+1(x+2)2=7(x+2)2y' = \frac{3(x + 2) - (3x - 1) \cdot 1}{(x + 2)^2} = \frac{3x + 6 - 3x + 1}{(x + 2)^2} = \frac{7}{(x + 2)^2}

Exercise 3: Values from a table

f(1)=2f(1) = 2, f′(1)=−1f'(1) = -1, g(1)=4g(1) = 4, g′(1)=3g'(1) = 3. Find (fg)′(1)(fg)'(1) and (f/g)′(1)(f/g)'(1).

Answer

(fg)′(1)=2(fg)'(1) = 2, (f/g)′(1)=−58(f/g)'(1) = -\frac{5}{8}

Solution
(fg)′(1)=f′g+fg′=(−1)(4)+(2)(3)=2(f/g)′(1)=f′g−fg′g2=(−1)(4)−(2)(3)16=−1016=−58\begin{aligned} (fg)'(1) &= f'g + fg' = (-1)(4) + (2)(3) = 2 \\ (f/g)'(1) &= \frac{f'g - fg'}{g^2} = \frac{(-1)(4) - (2)(3)}{16} = -\frac{10}{16} = -\frac{5}{8} \end{aligned}

Exercise 4: Tangent to a rational curve

Find the tangent line to y=x2x+1y = \frac{x^2}{x + 1} at x=1x = 1, and check the slope in SymPy.

Answer

y=34x−14y = \frac{3}{4}x - \frac{1}{4}

Solution
y(1)=12y′=2x(x+1)−x2(x+1)2=x2+2x(x+1)2y′(1)=34tangent: y−12=34(x−1)→y=34x−14\begin{aligned} &y(1) = \tfrac{1}{2} \\ &y' = \frac{2x(x + 1) - x^2}{(x + 1)^2} = \frac{x^2 + 2x}{(x + 1)^2} \\ &y'(1) = \tfrac{3}{4} \\ &\text{tangent: } y - \tfrac{1}{2} = \tfrac{3}{4}(x - 1) \to y = \tfrac{3}{4}x - \tfrac{1}{4} \end{aligned}
python · try it yourself
import sympy as sp

x = sp.symbols('x')
y = x**2 / (x + 1)
m = sp.diff(y, x).subs(x, 1)
print("slope:", m, " tangent: y =", sp.expand(y.subs(x, 1) + m*(x - 1)))
slope: 3/4  tangent: y = 3*x/4 - 1/4

Exercise 5: Three factors

Differentiate y=x⋅ex⋅(x+1)y = x \cdot e^x \cdot (x + 1) with the three-factor product rule and simplify.

Answer

y′=ex(x2+3x+1)y' = e^x(x^2 + 3x + 1)

Solution
y′=1⋅ex(x+1)+x⋅ex(x+1)+x⋅ex⋅1=ex[(x+1)+x(x+1)+x]=ex[x2+3x+1]\begin{aligned} y' &= 1 \cdot e^x(x + 1) + x \cdot e^x(x + 1) + x \cdot e^x \cdot 1 \\ &= e^x[(x + 1) + x(x + 1) + x] \\ &= e^x[x^2 + 3x + 1] \end{aligned}

Test yourself

What is the derivative of f⋅gf \cdot g?

  1. f′⋅g′f' \cdot g'
  2. f′⋅g−f⋅g′f' \cdot g - f \cdot g'
  3. f′⋅g+f⋅g′f' \cdot g + f \cdot g'
  4. f′⋅g+f⋅g′g2\frac{f' \cdot g + f \cdot g'}{g^2}

Which step in the product-rule proof needs differentiable   ⟹  \implies continuous?

  1. Splitting the fraction
  2. f(x+h)→f(x)f(x + h) \to f(x) as h→0h \to 0
  3. Adding and subtracting f(x+h)g(x)f(x + h)g(x)
  4. Using the binomial theorem

What is the derivative of 1/g1/g?

  1. 1/g′1/g'
  2. −1/g2-1/g^2
  3. g′/g2g'/g^2
  4. −g′/g2-g'/g^2