Differentiation Rules

Why the product rule has two terms and the chain rule multiplies. Growing rectangles, linked number lines, the number e, and a machine that differentiates anything you type

Differentiation Rules

Nobody differentiates from the limit definition every time. A handful of rules, for sums, products, quotients and compositions, plus a short table of basic functions, are enough to differentiate any formula built from them. Each rule has a picture behind it, and once you have seen the picture the formula is hard to forget.

The Product Rule as Area

A rectangle with sides f(x) and g(x) has area f(x)g(x). Nudge x and it grows by two strips and a small corner. Press shrink and watch the corner vanish from the limit, leaving exactly two terms.

0.45
right strip g·Δf
1.103
top strip f·Δg
0.4961
corner Δf·Δg
32%
corner ÷ strips

Area grows by Δ(fg) = g·Δf + f·Δg + Δf·Δg. Divided by Δx = 0.45: 1 + 2.45 + 1.103 = 4.552, against f′g + fg′ = 3. The corner is a product of two small changes, so each time Δx halves the strips halve but the corner quarters: it vanishes from the limit, leaving (fg)′ = f′g + fg′.

The functions here are positive and increasing on the range shown, so every piece is a real area. The rule holds for any differentiable f and g; with a decreasing factor a strip simply counts negatively.

Go deeper:Products and Quotients

Write Δf = f(x + Δx) − f(x) and Δg likewise. Then, exactly,

Δ(fg) = (f + Δf)(g + Δg) − fg = g·Δf + f·Δg + Δf·Δg.

Divide by Δx. The first two terms tend to g·f′ and f·g′. The last is (Δf/Δx)·Δg, a bounded quantity times something going to zero, so it disappears:

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

Leibniz wrote the rule as d(xy) = x dy + y dx in his notes of 1675, after first guessing, wrongly, that d(xy) might be dx·dy. The rectangle shows why the guess fails: dx·dy is the corner, the one piece that does not matter.

Quotient rule. If q = f/g then f = qg, so f′ = q′g + qg′ by the product rule. Solving for q′ gives

(f/g)′ = (f′g − fg′)/g²,

valid wherever g ≠ 0. The minus sign is the only part people misremember; a quick check with f = 1, g = x must give (1/x)′ = −1/x².

The Chain Rule: Machines in a Row

Three number lines carry x, then u = g(x), then y = f(u). Drag x and watch a small interval get stretched by each machine in turn. Shrink the interval and the two stretch factors multiply to the total.

2.4
g′(x)
0.1304
f′(g(x))
0.313
product f′(g(x))·g′(x)
0.2866
measured stretch Δy/Δx

y = f(g(x)) = sin(x²). The first machine stretches the interval by 2.4, the second by 0.1194; stretches multiply, so the whole trip stretches it by 0.28656. As Δx shrinks this settles on g′(x)·f′(g(x)) = 0.31302.

dy/dx = 2x cos(x²)

Drag on the picture to move x. The measured stretches use the endpoints of the interval, so they are difference quotients; the exact values come from differentiating g and f symbolically. Where g′(x) = 0 the u-interval collapses and the middle ratio is a 0/0 that only the limit can settle.

Go deeper:Why Stretches Multiply

Near a point, a differentiable function acts like multiplication by its derivative: g sends a short interval of length Δx to one of length about g′(x)·Δx. Feed that into f, which stretches by f′(u) near u = g(x), and the total is

(f ∘ g)′(x) = f′(g(x)) · g′(x).

In Leibniz’s notation it reads dy/dx = dy/du · du/dx, which looks like cancelling fractions. It is not quite that, since dy, du and dx are not numbers, but the notation was designed so that this kind of manipulation gives the right answer.

The naive proof writes Δy/Δx = (Δy/Δu)(Δu/Δx) and lets Δx → 0. It has a gap: Δu can be exactly zero for small Δx (try g(x) = x² sin(1/x) near 0), and then the first factor is undefined. The standard repair defines the first factor to be f′(u) whenever Δu = 0; the product still equals Δy/Δx, and the limit goes through.

Worked example: for sin(x²), the inside is u = x² with u′ = 2x and the outside is sin u with derivative cos u, so the derivative is cos(x²)·2x. Where g′(x) < 0 the fibres in the demo cross, because g reverses the interval, and the stretch factor is negative.

Why e?

The slope of aˣ, measured numerically, is plotted with it in pink. Slide the base and notice the ratio of slope to height is the same at every x. Then let bisection find the one base where the two curves coincide.

2
height aˣ at x = 1
1.3863
slope there
0.693147
slope ÷ height
0.693147
ln a

For every base, (aˣ)′ = k·aˣ with the same k at every x: here k = 0.693147, which is ln a. The slope curve lies below the function. Raise a to lift it.

h(aʰ − 1)/h, the slope of aˣ at 0
11.00000000
10⁻¹0.71773463
10⁻²0.69555501
10⁻³0.69338746
10⁻⁴0.69317120
10⁻⁵0.69314958
10⁻⁶0.69314742
limitln a = 0.69314718

The pink curve is measured, not computed from a formula: a symmetric difference quotient with a Richardson step at every x. Drag on the plot to move the sample point; the ratio is the same wherever you put it, because aˣ⁺ʰ − aˣ = aˣ(aʰ − 1) factors out the height.

Go deeper:The Function That Is Its Own Derivative

For any base a > 0, the difference quotient factors:

(aˣ⁺ʰ − aˣ)/h = aˣ · (aʰ − 1)/h.

The second factor does not depend on x. Its limit as h → 0 is the slope of aˣ at x = 0, a constant k(a), so (aˣ)′ = k(a)·aˣ: every exponential is proportional to its own derivative. The table under the demo shows (aʰ − 1)/h settling as h shrinks.

k(2) ≈ 0.693 and k(3) ≈ 1.099, so somewhere between 2 and 3 there is a base with k = 1. That base is called e, and k(a) turns out to be ln a, the logarithm to base e. So

(eˣ)′ = eˣ, (aˣ)′ = aˣ ln a, (ln x)′ = 1/x.

The last follows by differentiating e^(ln x) = x with the chain rule: e^(ln x)·(ln x)′ = 1, so (ln x)′ = 1/x.

The number itself first surfaced in 1683, when Jacob Bernoulli studied compound interest and the limit of (1 + 1/n)ⁿ. Euler named it e, proved many of its properties, and computed it to 23 decimal places: 2.71828 18284 59045 23536 028.

The Derivative Machine

Type any formula, or pick a preset, and the machine differentiates it while showing every rule it uses as a tree. Each line hands smaller derivatives to the lines beneath it. Collapse a branch to see the shape of the whole calculation.

f′(x) = 2x sin(x) + x² cos(x)

  • Product ruled/dx [x² sin(x)] = 2x sin(x) + x² cos(x)
    (uw)′ = u′w + uw′
    • Power ruled/dx [x²] = 2x
      (xⁿ)′ = n xⁿ⁻¹
    • Table: sind/dx [sin(x)] = cos(x)
      (sin x)′ = cos x
3
rule applications
1
steps that needed smaller derivatives
2
depth of the derivation

Each line applies one rule to the expression on its left and lists, beneath it, the smaller derivatives that rule needs. Results are tidied as they are assembled (2·3x becomes 6x, x·x becomes x²), but no deeper simplification is attempted, so an answer may look different from a textbook’s while being equal to it. xˣ is handled by writing it as e^(x ln x).

Go deeper:Every Formula, Rule by Rule

Any formula built from numbers, x, the four operations, powers and the standard functions is a tree: the last operation performed sits at the root. Differentiation walks that tree from the top. A sum calls the sum rule and differentiates both branches; a product calls the product rule; a function applied to something other than x calls the chain rule and differentiates the inside. The recursion ends at constants and at x itself.

The table at the leaves is short:

  • (xⁿ)′ = n xⁿ⁻¹ (any real n)
  • (sin x)′ = cos x, (cos x)′ = −sin x, (tan x)′ = sec² x
  • (eˣ)′ = eˣ, (ln x)′ = 1/x
  • (arctan x)′ = 1/(1 + x²), (arcsin x)′ = 1/√(1 − x²)

Something like xˣ needs one more trick, since neither the power rule (fixed exponent) nor the exponential rule (fixed base) applies. Write xˣ = e^(x ln x); the chain rule and the product rule then give (xˣ)′ = xˣ(ln x + 1). This is logarithmic differentiation.

The consequence is striking: differentiation is entirely mechanical. Every computer algebra system does it this way, and so does automatic differentiation, the technique that computes gradients when neural networks are trained. Integration, the reverse problem, has no such guarantee: some simple formulas, like e^(−x²), have antiderivatives that cannot be written with these functions at all.

Key Takeaways

  • Product rule (fg)′ = f′g + fg′: two strips of a growing rectangle, while the tiny corner vanishes in the limit.
  • Chain rule (f ∘ g)′ = f′(g(x))·g′(x): composed functions stretch by the product of their local stretches.
  • Every exponential is proportional to its own derivative, (aˣ)′ = aˣ ln a, and e is the base where the constant is 1.
  • With the sum, product, quotient and chain rules and a short table, any formula can be differentiated mechanically.

Spot a mistake or have an idea?

Search