Lemma
← All topics
Pure mathematics

Differentiation

The mathematics of instantaneous change.

Introduction

Differentiation answers one question: how fast is a quantity changing at a single instant? Average rates of change are easy, since they are just ratios of differences. The derivative refines that idea until the interval shrinks to a point. Mechanics, optimisation, curve sketching and differential equations all build on it, and so does a large part of analysis.

On this page we build the derivative from its definition. We then derive the rules that make it practical, and use them to analyse curves, solve optimisation problems and handle relations that are not written as y=f(x)y = f(x).

Mathematical motivation

Suppose a stone falls so that it has dropped s(t)=4.9t2s(t) = 4.9t^2 metres after tt seconds. Between t=2t = 2 and t=2+ht = 2 + h its average speed is

s(2+h)−s(2)h=4.9(4+4h+h2)−19.6h=19.6+4.9h.\frac{s(2+h) - s(2)}{h} = \frac{4.9(4 + 4h + h^2) - 19.6}{h} = 19.6 + 4.9h.

Make hh smaller and the average speed settles on 19.6 m s−119.6\ \text{m s}^{-1}. That limiting value is the instantaneous speed at t=2t = 2. Speedometers and marginal cost both rest on this one construction, and so does the slope of a tangent line.

Intuitive explanation

Zoom in far enough on a smooth curve and it looks straight. The derivative f′(a)f'(a) is the gradient of that apparent straight line, the tangent at x=ax = a.

IntuitionThe derivative as a local linear approximation

Near x=ax = a a differentiable function behaves like its tangent line:

f(a+h)≈f(a)+f′(a) h.f(a + h) \approx f(a) + f'(a)\,h.

The error is small compared with hh, so it vanishes faster than hh does. This is the most useful way to think about derivatives, and it is exactly the idea that generalises to several variables.

A chord through (a,f(a))(a, f(a)) and (a+h,f(a+h))(a+h, f(a+h)) has gradient f(a+h)−f(a)h\dfrac{f(a+h) - f(a)}{h}. As h→0h \to 0 the chord swings round into the tangent. Open the calculus visualiser to watch this happen.

Watching the limit happen

Take f(x)=x2f(x) = x^2 at x=3x = 3 and compute the gradient of the chord from (3,9)(3, 9) to (3+h,(3+h)2)(3 + h, (3+h)^2) for smaller and smaller hh:

hh(3+h)2−9h\dfrac{(3+h)^2 - 9}{h}
1177
0.10.16.16.1
0.010.016.016.01
0.0010.0016.0016.001
−0.001-0.0015.9995.999

The values close in on 66 from both sides. Algebra shows why: (3+h)2−9h=6h+h2h=6+h\frac{(3+h)^2 - 9}{h} = \frac{6h + h^2}{h} = 6 + h. The "error" is exactly hh, which disappears in the limit. So f′(3)=6f'(3) = 6, matching f′(x)=2xf'(x) = 2x.

IntuitionThe derivative is a zoom lens

If you zoom in on the graph of x2x^2 near (3,9)(3, 9) by a factor of 10001000, the curve becomes indistinguishable from the straight line y=9+6(x−3)y = 9 + 6(x - 3). A function is differentiable at a point exactly when this happens. Its graph is "locally straight", and the derivative is the slope of the line you see. A corner like ∣x∣|x| at 00 never straightens out, however far you zoom.

Formal definitions

DefinitionThe derivative

Let ff be defined on an open interval containing aa. We say ff is differentiable at aa if the limit

f′(a)=lim⁡h→0f(a+h)−f(a)hf'(a) = \lim_{h \to 0} \frac{f(a+h) - f(a)}{h}

exists (as a finite real number). The function f′f', defined wherever this limit exists, is the derivative of ff.

DefinitionStationary point

A point x=ax = a where f′(a)=0f'(a) = 0 is a stationary point. It is a local maximum if f(a)≥f(x)f(a) \ge f(x) for all xx near aa, a local minimum if f(a)≤f(x)f(a) \le f(x) for all xx near aa. A stationary point that is neither is a stationary point of inflection.

NoteDifferentiability implies continuity, but not conversely

If ff is differentiable at aa then ff is continuous at aa, because f(a+h)−f(a)=h⋅f(a+h)−f(a)h→0⋅f′(a)=0f(a+h) - f(a) = h \cdot \frac{f(a+h)-f(a)}{h} \to 0 \cdot f'(a) = 0. The converse fails: f(x)=∣x∣f(x) = |x| is continuous at 00, but its difference quotient is +1+1 for h>0h > 0 and −1-1 for h<0h < 0, so it has no limit.

Important notation

  • Leibniz: dydx\dfrac{dy}{dx}, d2ydx2\dfrac{d^2y}{dx^2}. These are best for the chain rule and for related rates.
  • Lagrange: f′(x)f'(x), f′′(x)f''(x), f(n)(x)f^{(n)}(x). These are best when the function has a name.
  • Newton: x˙\dot{x}, x¨\ddot{x} for derivatives with respect to time.
  • Operator: ddx( ⋅ )\dfrac{d}{dx}\big(\,\cdot\,\big) acting on an expression.

dydx\dfrac{dy}{dx} is not a fraction, but the notation is designed so that many fraction-like manipulations (such as the chain rule) turn out to be valid theorems.

Standard derivatives

IdentitiesResults to know fluently
ddxxn=nxn−1(n∈R)ddxekx=kekxddxln⁡x=1x(x>0)ddxax=axln⁡addxsin⁡x=cos⁡xddxcos⁡x=−sin⁡xddxtan⁡x=sec⁡2xddxsec⁡x=sec⁡xtan⁡xddxcsc⁡x=−csc⁡xcot⁡xddxcot⁡x=−csc⁡2xddxarcsin⁡x=11−x2ddxarctan⁡x=11+x2\begin{aligned} \frac{d}{dx} x^n &= n x^{n-1} \quad (n \in \mathbb{R}) &\qquad \frac{d}{dx} e^{kx} &= k e^{kx} \\ \frac{d}{dx} \ln x &= \frac{1}{x} \quad (x>0) &\qquad \frac{d}{dx} a^x &= a^x \ln a \\ \frac{d}{dx} \sin x &= \cos x &\qquad \frac{d}{dx} \cos x &= -\sin x \\ \frac{d}{dx} \tan x &= \sec^2 x &\qquad \frac{d}{dx} \sec x &= \sec x \tan x \\ \frac{d}{dx} \csc x &= -\csc x \cot x &\qquad \frac{d}{dx} \cot x &= -\csc^2 x \\ \frac{d}{dx} \arcsin x &= \frac{1}{\sqrt{1-x^2}} &\qquad \frac{d}{dx} \arctan x &= \frac{1}{1+x^2} \end{aligned}

Trigonometric results require xx in radians.

Theorems and rules

TheoremLinearity

If ff and gg are differentiable at xx and λ,μ\lambda, \mu are constants, then (λf+μg)′=λf′+μg′(\lambda f + \mu g)' = \lambda f' + \mu g'.

TheoremProduct rule

If uu and vv are differentiable at xx, then (uv)′=u′v+uv′(uv)' = u'v + uv'.

TheoremQuotient rule

If u,vu, v are differentiable at xx and v(x)≠0v(x) \neq 0, then (uv)′=u′v−uv′v2\left(\dfrac{u}{v}\right)' = \dfrac{u'v - uv'}{v^2}.

TheoremChain rule

If gg is differentiable at xx and ff is differentiable at g(x)g(x), then f∘gf \circ g is differentiable at xx and

(f∘g)′(x)=f′(g(x)) g′(x),i.e.dydx=dydu⋅dudx.(f \circ g)'(x) = f'\big(g(x)\big)\, g'(x), \qquad \text{i.e.}\quad \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx}.
TheoremSecond derivative test

Suppose f′(a)=0f'(a) = 0 and f′′(a)f''(a) exists. If f′′(a)>0f''(a) > 0 then aa is a local minimum; if f′′(a)<0f''(a) < 0, a local maximum. If f′′(a)=0f''(a) = 0 the test is inconclusive.

CautionInconclusive really means inconclusive

x4x^4, −x4-x^4 and x3x^3 all have f′(0)=f′′(0)=0f'(0) = f''(0) = 0, yet 00 is respectively a minimum, a maximum and an inflection. When f′′(a)=0f''(a) = 0, examine the sign of f′f' either side of aa.

Proofs of important results

ProofThe power rule for positive integers

Let f(x)=xnf(x) = x^n with n∈Nn \in \mathbb{N}. By the binomial theorem,

(x+h)n−xnh=1h∑r=1n(nr)xn−rhr=nxn−1+(n2)xn−2h+⋯+hn−1.\frac{(x+h)^n - x^n}{h} = \frac{1}{h}\sum_{r=1}^{n} \binom{n}{r} x^{n-r} h^r = n x^{n-1} + \binom{n}{2}x^{n-2}h + \dots + h^{n-1}.

Every term after the first contains a positive power of hh, so the limit as h→0h \to 0 is nxn−1n x^{n-1}.

∎
ProofThe product rule

Add and subtract u(x+h)v(x)u(x+h)v(x) in the numerator:

u(x+h)v(x+h)−u(x)v(x)h=u(x+h) v(x+h)−v(x)h+v(x) u(x+h)−u(x)h.\frac{u(x+h)v(x+h) - u(x)v(x)}{h} = u(x+h)\,\frac{v(x+h)-v(x)}{h} + v(x)\,\frac{u(x+h)-u(x)}{h}.

As h→0h \to 0, u(x+h)→u(x)u(x+h) \to u(x) (differentiable functions are continuous) and the two difference quotients tend to v′(x)v'(x) and u′(x)u'(x). Hence (uv)′=uv′+vu′(uv)' = uv' + vu'.

∎
ProofThe chain rule

Define ϕ(k)=f(g(x)+k)−f(g(x))k\phi(k) = \dfrac{f(g(x)+k) - f(g(x))}{k} for k≠0k \ne 0 and ϕ(0)=f′(g(x))\phi(0) = f'(g(x)); then ϕ\phi is continuous at 00 and f(g(x)+k)−f(g(x))=ϕ(k) kf(g(x)+k) - f(g(x)) = \phi(k)\,k for all kk (including k=0k = 0). Put k=g(x+h)−g(x)k = g(x+h) - g(x), which tends to 00 as h→0h \to 0:

f(g(x+h))−f(g(x))h=ϕ(g(x+h)−g(x))⋅g(x+h)−g(x)h⟶f′(g(x)) g′(x).\frac{f(g(x+h)) - f(g(x))}{h} = \phi\big(g(x+h)-g(x)\big)\cdot \frac{g(x+h)-g(x)}{h} \longrightarrow f'(g(x))\,g'(x).

Defining ϕ(0)\phi(0) separately avoids the classic flaw of dividing by g(x+h)−g(x)g(x+h) - g(x), which may be zero for some small hh.

∎
ProofThe quotient rule

Write u/v=u⋅v−1u/v = u \cdot v^{-1}. By the chain rule (v−1)′=−v−2v′(v^{-1})' = -v^{-2}v', so by the product rule

(uv)′=u′v−uv′v2=u′v−uv′v2.\left(\frac{u}{v}\right)' = \frac{u'}{v} - \frac{uv'}{v^2} = \frac{u'v - uv'}{v^2}.
∎

Step-by-step derivations

The derivative of sin⁡x\sin x from first principles

Using sin⁡(A+B)=sin⁡Acos⁡B+cos⁡Asin⁡B\sin(A+B) = \sin A\cos B + \cos A \sin B:

sin⁡(x+h)−sin⁡xh=sin⁡xcos⁡h+cos⁡xsin⁡h−sin⁡xh=sin⁡x⋅cos⁡h−1h+cos⁡x⋅sin⁡hh.\begin{aligned} \frac{\sin(x+h) - \sin x}{h} &= \frac{\sin x\cos h + \cos x\sin h - \sin x}{h}\\ &= \sin x\cdot\frac{\cos h - 1}{h} + \cos x\cdot\frac{\sin h}{h}. \end{aligned}

The two standard limits lim⁡h→0sin⁡hh=1\displaystyle\lim_{h\to0}\frac{\sin h}{h} = 1 and lim⁡h→0cos⁡h−1h=0\displaystyle\lim_{h\to0}\frac{\cos h - 1}{h} = 0 hold in radians; the first follows from the squeeze cos⁡h≤sin⁡hh≤1\cos h \le \frac{\sin h}{h} \le 1 obtained by comparing areas in the unit circle.

Therefore ddxsin⁡x=sin⁡x⋅0+cos⁡x⋅1=cos⁡x\dfrac{d}{dx}\sin x = \sin x \cdot 0 + \cos x \cdot 1 = \cos x.

The derivative of ln⁡x\ln x

If y=ln⁡xy = \ln x then x=eyx = e^y. Differentiating with respect to xx (chain rule): 1=eydydx1 = e^y \dfrac{dy}{dx}, so

dydx=1ey=1x.\frac{dy}{dx} = \frac{1}{e^y} = \frac{1}{x}.

The derivative of axa^x

Since ax=exln⁡aa^x = e^{x\ln a}, the chain rule gives ddxax=exln⁡a⋅ln⁡a=axln⁡a\dfrac{d}{dx}a^x = e^{x \ln a}\cdot \ln a = a^x \ln a.

The product rule

Let y=uvy = uv. If xx increases by δx\delta x, then uu and vv change by δu\delta u and δv\delta v, and

δy=(u+δu)(v+δv)−uv=u δv+v δu+δu δv.\delta y = (u + \delta u)(v + \delta v) - uv = u\,\delta v + v\,\delta u + \delta u\,\delta v.

Divide by δx\delta x:

δyδx=uδvδx+vδuδx+δu δvδx.\frac{\delta y}{\delta x} = u\frac{\delta v}{\delta x} + v\frac{\delta u}{\delta x} + \delta u\,\frac{\delta v}{\delta x}.

As δx→0\delta x \to 0, δuδx→u′\frac{\delta u}{\delta x} \to u' and δvδx→v′\frac{\delta v}{\delta x} \to v', while δu→0\delta u \to 0. So the last term vanishes:

ddx(uv)=uv′+vu′.\frac{d}{dx}(uv) = uv' + vu'.
IntuitionThe area picture

Think of uvuv as the area of a rectangle with sides uu and vv. Growing the sides by δu\delta u and δv\delta v adds two thin strips (areas u δvu\,\delta v and v δuv\,\delta u) and a tiny corner square (δu δv\delta u\,\delta v). The corner is "second order small" and does not survive the limit. That is the whole product rule.

The chain rule

If y=f(u)y = f(u) and u=g(x)u = g(x), then for small changes

δyδx=δyδu⋅δuδx  ⟶  dydu⋅dudx.\frac{\delta y}{\delta x} = \frac{\delta y}{\delta u}\cdot\frac{\delta u}{\delta x} \;\longrightarrow\; \frac{dy}{du}\cdot\frac{du}{dx}.

Rates multiply. If uu changes 3 times as fast as xx, and yy changes 5 times as fast as uu, then yy changes 15 times as fast as xx.

This argument has a gap: δu\delta u might be 00 for some small δx\delta x, so we cannot divide by it. The section Proving the rules properly below repairs this.

The quotient rule (from the other two)

Write uv=u⋅v−1\frac uv = u\cdot v^{-1}. The chain rule gives ddxv−1=−v−2v′\frac{d}{dx}v^{-1} = -v^{-2}v', so by the product rule

ddx(uv)=u′v−1−uv−2v′=u′v−uv′v2.\frac{d}{dx}\left(\frac uv\right) = u'v^{-1} - uv^{-2}v' = \frac{u'v - uv'}{v^2}.

You never need to memorise the quotient rule separately.

The derivative of exe^x

Everything rests on one limit. From the definition,

ddxex=lim⁡h→0ex+h−exh=exlim⁡h→0eh−1h.\frac{d}{dx}e^x = \lim_{h \to 0}\frac{e^{x+h} - e^x}{h} = e^x\lim_{h\to0}\frac{e^h - 1}{h}.

For axa^x with any base aa we would get ax⋅lim⁡ah−1ha^x\cdot\lim\frac{a^h - 1}{h}. Numerically, that limit is about 0.6930.693 for a=2a = 2 and about 1.0991.099 for a=3a = 3. The number e≈2.71828e \approx 2.71828 is defined to be the base for which the limit equals exactly 11. That is why ee is the natural base: ddxex=ex\frac{d}{dx}e^x = e^x, with no awkward constant.

The derivative of ln⁡x\ln x

y=ln⁡xy = \ln x means x=eyx = e^y. Differentiate with respect to xx:

1=eydydx⇒dydx=1ey=1x.1 = e^y\frac{dy}{dx} \quad\Rightarrow\quad \frac{dy}{dx} = \frac{1}{e^y} = \frac{1}{x}.

The derivative of axa^x

ax=exln⁡aa^x = e^{x\ln a}, so by the chain rule

ddxax=exln⁡a⋅ln⁡a=axln⁡a.\frac{d}{dx}a^x = e^{x\ln a}\cdot\ln a = a^x\ln a.

This explains the numbers above: ln⁡2≈0.693\ln 2 \approx 0.693 and ln⁡3≈1.099\ln 3 \approx 1.099.

Powers with any real exponent

For x>0x > 0, xn=enln⁡xx^n = e^{n\ln x}, so

ddxxn=enln⁡x⋅nx=xn⋅nx=nxn−1.\frac{d}{dx}x^n = e^{n\ln x}\cdot\frac{n}{x} = x^n\cdot\frac nx = nx^{n-1}.

This one line proves the power rule for every real nn: fractions, negatives, even x2x^{\sqrt2}.

The other trigonometric functions

  • ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x. Write cos⁡x=sin⁡(π2−x)\cos x = \sin\left(\frac\pi2 - x\right) and use the chain rule: cos⁡(π2−x)⋅(−1)=−sin⁡x\cos\left(\frac\pi2 - x\right)\cdot(-1) = -\sin x.
  • ddxtan⁡x=cos⁡x⋅cos⁡x−sin⁡x⋅(−sin⁡x)cos⁡2x=1cos⁡2x=sec⁡2x\frac{d}{dx}\tan x = \frac{\cos x\cdot\cos x - \sin x\cdot(-\sin x)}{\cos^2x} = \frac{1}{\cos^2x} = \sec^2x.
  • ddxsec⁡x=ddx(cos⁡x)−1=−(cos⁡x)−2(−sin⁡x)=sec⁡xtan⁡x\frac{d}{dx}\sec x = \frac{d}{dx}(\cos x)^{-1} = -(\cos x)^{-2}(-\sin x) = \sec x\tan x.
  • ddxcosec⁡x=−cosec⁡xcot⁡x\frac{d}{dx}\operatorname{cosec}x = -\operatorname{cosec}x\cot x and ddxcot⁡x=−cosec⁡2x\frac{d}{dx}\cot x = -\operatorname{cosec}^2x, in the same way.

Inverse trigonometric functions

If y=arctan⁡xy = \arctan x then x=tan⁡yx = \tan y, so 1=sec⁡2y dydx=(1+tan⁡2y)dydx=(1+x2)dydx1 = \sec^2y\,\frac{dy}{dx} = (1 + \tan^2y)\frac{dy}{dx} = (1 + x^2)\frac{dy}{dx}, giving

ddxarctan⁡x=11+x2.\frac{d}{dx}\arctan x = \frac{1}{1 + x^2}.

Similarly ddxarcsin⁡x=11−x2\frac{d}{dx}\arcsin x = \frac{1}{\sqrt{1-x^2}} and ddxarccos⁡x=−11−x2\frac{d}{dx}\arccos x = -\frac{1}{\sqrt{1-x^2}}.

Worked examples

ExampleProduct and chain together

Differentiate y=x2sin⁡(3x)y = x^2 \sin(3x).

With u=x2u = x^2, v=sin⁡3xv = \sin 3x: u′=2xu' = 2x and v′=3cos⁡3xv' = 3\cos 3x (chain rule). So

dydx=2xsin⁡3x+3x2cos⁡3x.\frac{dy}{dx} = 2x\sin 3x + 3x^2 \cos 3x.
ExampleImplicit differentiation

Find dydx\dfrac{dy}{dx} for the circle x2+y2=25x^2 + y^2 = 25 at (3,4)(3, 4).

Differentiate every term with respect to xx, treating yy as a function of xx:

2x+2ydydx=0  ⟹  dydx=−xy=−34.2x + 2y\frac{dy}{dx} = 0 \implies \frac{dy}{dx} = -\frac{x}{y} = -\frac{3}{4}.

Check: the radius to (3,4)(3,4) has gradient 43\tfrac43, and the tangent is perpendicular, so its gradient is −34-\tfrac34.

ExampleClassifying stationary points

For f(x)=x3−3xf(x) = x^3 - 3x: f′(x)=3x2−3=3(x−1)(x+1)f'(x) = 3x^2 - 3 = 3(x-1)(x+1), zero at x=±1x = \pm 1. f′′(x)=6xf''(x) = 6x, so f′′(1)=6>0f''(1) = 6 > 0 gives a minimum at (1,−2)(1, -2) and f′′(−1)=−6<0f''(-1) = -6 < 0 gives a maximum at (−1,2)(-1, 2).

Common mistakes

Common mistakeForgetting the chain rule

ddxsin⁡(x2)=2xcos⁡(x2)\dfrac{d}{dx}\sin(x^2) = 2x\cos(x^2), not cos⁡(x2)\cos(x^2). Whenever the input to a standard function is anything other than plain xx, multiply by the derivative of that input.

Common mistakeDifferentiating products term by term

(uv)′≠u′v′(uv)' \neq u'v'. For example ddx(x⋅x)=2x\frac{d}{dx}(x \cdot x) = 2x, whereas 1⋅1=11 \cdot 1 = 1.

Common mistakeUsing degrees

ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x only in radians. In degrees, ddxsin⁡x∘=π180cos⁡x∘\frac{d}{dx}\sin x^\circ = \frac{\pi}{180}\cos x^\circ.

Common mistakeTreating f′(a)=0f'(a) = 0 as proof of a turning point

A stationary point need not be a maximum or minimum (x3x^3 at 00), and a maximum need not be stationary (∣x∣|x| has a minimum at 00 with no derivative there; endpoints of a closed interval can be extrema too).

Applications

  • Kinematics: velocity v=s˙v = \dot{s} and acceleration a=v˙=s¨a = \dot{v} = \ddot{s}.
  • Optimisation: maximise volume, minimise cost or time. Find stationary points, classify them, and check the endpoints.
  • Related rates: if a balloon's volume grows at a known rate, drdt=dV/dtdV/dr\frac{dr}{dt} = \frac{dV/dt}{dV/dr} gives the rate at which its radius grows.
  • Approximation: f(a+h)≈f(a)+hf′(a)f(a+h) \approx f(a) + hf'(a) underlies error estimates and Newton–Raphson.
  • Economics: marginal cost and marginal revenue are derivatives.

Connections to other topics

  • Integration reverses differentiation, by the Fundamental Theorem of Calculus.
  • Taylor series extend the tangent-line approximation to higher-order polynomials.
  • Differential equations relate a function to its own derivatives.
  • Real analysis makes the limit rigorous, using ε\varepsilon–δ\delta language and the Mean Value Theorem.
  • Partial derivatives generalise the idea to functions of several variables.

Summary

  • f′(a)=lim⁡h→0f(a+h)−f(a)hf'(a) = \lim_{h\to 0}\frac{f(a+h) - f(a)}{h} is the gradient of the tangent, i.e. the instantaneous rate of change.
  • The linearity, product, quotient and chain rules reduce almost every derivative to the standard list.
  • Implicit differentiation: differentiate both sides, then remember that ddxg(y)=g′(y)dydx\frac{d}{dx}g(y) = g'(y)\frac{dy}{dx}.
  • Stationary points satisfy f′(x)=0f'(x) = 0. Classify them with f′′f'', or with the sign of f′f' when f′′=0f'' = 0.
  • Differentiable implies continuous, but not conversely.
Beyond the specification

University-level ideas and the deeper mathematics behind this topic. Not needed for exams, but this is where the subject really opens up.

Limits made rigorous (university)

At A level, "h→0h \to 0" is treated intuitively. University analysis makes it precise. This matters because intuition about infinity and the infinitely small is famously unreliable. Berkeley mocked Newton's infinitesimals as "the ghosts of departed quantities", and it took nearly 150 years, until Cauchy and Weierstrass, to put calculus on solid ground.

DefinitionLimit of a function (Weierstrass, ε–δ)

lim⁡x→af(x)=L\displaystyle\lim_{x \to a}f(x) = L means: for every ε>0\varepsilon > 0 there exists δ>0\delta > 0 such that

0<∣x−a∣<δ⟹∣f(x)−L∣<ε.0 < |x - a| < \delta \quad\Longrightarrow\quad |f(x) - L| < \varepsilon.

Read it as a game. Your opponent names a tolerance ε\varepsilon, however tiny. You must find a distance δ\delta such that every xx within δ\delta of aa (except aa itself) gives f(x)f(x) within ε\varepsilon of LL. If you can always win, the limit is LL. Notice that f(a)f(a) itself plays no part: the function need not even be defined at aa.

ExampleProving lim⁡x→2x2=4\lim_{x\to 2}x^2 = 4

We need ∣x2−4∣=∣x−2∣ ∣x+2∣|x^2 - 4| = |x - 2|\,|x + 2| to be small. The factor ∣x−2∣|x - 2| is the one we control. To stop ∣x+2∣|x + 2| getting large, first insist ∣x−2∣<1|x - 2| < 1, so 1<x<31 < x < 3 and ∣x+2∣<5|x + 2| < 5. Then ∣x2−4∣<5∣x−2∣|x^2 - 4| < 5|x - 2|.

So given ε>0\varepsilon > 0, choose δ=min⁡(1,ε5)\delta = \min\left(1, \frac{\varepsilon}{5}\right). If 0<∣x−2∣<δ0 < |x - 2| < \delta:

∣x2−4∣<5∣x−2∣<5⋅ε5=ε.■|x^2 - 4| < 5|x - 2| < 5\cdot\frac\varepsilon5 = \varepsilon. \qquad\blacksquare

The derivative as the best linear approximation

The definition f′(a)=lim⁡h→0f(a+h)−f(a)hf'(a) = \lim_{h\to0}\frac{f(a+h) - f(a)}{h} can be rewritten without division:

f(a+h)=f(a)+f′(a) h+ε(h) h,where ε(h)→0 as h→0.f(a + h) = f(a) + f'(a)\,h + \varepsilon(h)\,h, \qquad\text{where } \varepsilon(h) \to 0 \text{ as } h \to 0.

So the tangent line f(a)+f′(a)hf(a) + f'(a)h approximates ff with an error that is small even compared with hh. No other straight line does this. This is the version that generalises to several variables, to vectors and to infinite-dimensional spaces. It is the one mathematicians really use.

TheoremCarathéodory's criterion

ff is differentiable at aa if and only if there is a function φ\varphi, continuous at aa, with

f(x)−f(a)=φ(x)(x−a)for all x.f(x) - f(a) = \varphi(x)(x - a) \quad\text{for all } x.

Then f′(a)=φ(a)f'(a) = \varphi(a).

Proof

If ff is differentiable, define φ(x)=f(x)−f(a)x−a\varphi(x) = \frac{f(x) - f(a)}{x - a} for x≠ax \neq a and φ(a)=f′(a)\varphi(a) = f'(a). Continuity of φ\varphi at aa is exactly the statement that the difference quotient tends to f′(a)f'(a). Conversely, if such a φ\varphi exists, then f(x)−f(a)x−a=φ(x)→φ(a)\frac{f(x) - f(a)}{x - a} = \varphi(x) \to \varphi(a).

∎
TheoremDifferentiable implies continuous

If ff is differentiable at aa, then ff is continuous at aa.

Proof

f(x)−f(a)=φ(x)(x−a)→φ(a)⋅0=0f(x) - f(a) = \varphi(x)(x - a) \to \varphi(a)\cdot 0 = 0 as x→ax \to a.

∎

The converse is false: ∣x∣|x| is continuous at 00 but has a corner there. Worse is possible, as the last section shows.

Proving the rules properly (university)

The informal chain-rule argument divided by δu\delta u, which can be zero. Take u=x2sin⁡1xu = x^2\sin\frac1x: it equals 00 at infinitely many points near 00. Carathéodory's criterion avoids division altogether and gives short, watertight proofs.

TheoremThe product rule

If f,gf, g are differentiable at aa, so is fgfg, and (fg)′(a)=f′(a)g(a)+f(a)g′(a)(fg)'(a) = f'(a)g(a) + f(a)g'(a).

Proof

Write f(x)−f(a)=φ(x)(x−a)f(x) - f(a) = \varphi(x)(x - a) and g(x)−g(a)=χ(x)(x−a)g(x) - g(a) = \chi(x)(x - a), with φ,χ\varphi, \chi continuous at aa. Then

f(x)g(x)−f(a)g(a)=(f(x)−f(a))g(x)+f(a)(g(x)−g(a))=[φ(x)g(x)+f(a)χ(x)](x−a).f(x)g(x) - f(a)g(a) = \big(f(x) - f(a)\big)g(x) + f(a)\big(g(x) - g(a)\big) = \big[\varphi(x)g(x) + f(a)\chi(x)\big](x - a).

The bracket is continuous at aa (because gg is continuous there, being differentiable), so by Carathéodory

(fg)′(a)=φ(a)g(a)+f(a)χ(a)=f′(a)g(a)+f(a)g′(a).(fg)'(a) = \varphi(a)g(a) + f(a)\chi(a) = f'(a)g(a) + f(a)g'(a).
∎
TheoremThe chain rule

If gg is differentiable at aa and ff is differentiable at g(a)g(a), then f∘gf \circ g is differentiable at aa and

(f∘g)′(a)=f′(g(a)) g′(a).(f\circ g)'(a) = f'\big(g(a)\big)\,g'(a).
Proof

Write g(x)−g(a)=φ(x)(x−a)g(x) - g(a) = \varphi(x)(x - a) with φ\varphi continuous at aa, and f(y)−f(g(a))=ψ(y)(y−g(a))f(y) - f(g(a)) = \psi(y)\big(y - g(a)\big) with ψ\psi continuous at g(a)g(a). Put y=g(x)y = g(x):

f(g(x))−f(g(a))=ψ(g(x))(g(x)−g(a))=ψ(g(x)) φ(x) (x−a).f(g(x)) - f(g(a)) = \psi\big(g(x)\big)\big(g(x) - g(a)\big) = \psi\big(g(x)\big)\,\varphi(x)\,(x - a).

Now ψ∘g\psi\circ g is continuous at aa (a continuous function of a continuous function), so the product ψ(g(x))φ(x)\psi(g(x))\varphi(x) is continuous at aa. By Carathéodory the derivative is ψ(g(a))φ(a)=f′(g(a))g′(a)\psi(g(a))\varphi(a) = f'(g(a))g'(a). Nothing was ever divided by g(x)−g(a)g(x) - g(a).

∎
TheoremThe inverse function rule

Let ff be continuous and strictly monotonic on an interval, differentiable at aa with f′(a)≠0f'(a) \ne 0. Then f−1f^{-1} is differentiable at b=f(a)b = f(a) and (f−1)′(b)=1f′(a)\left(f^{-1}\right)'(b) = \dfrac{1}{f'(a)}.

Proof

Write f(x)−f(a)=φ(x)(x−a)f(x) - f(a) = \varphi(x)(x - a). For y=f(x)y = f(x) near bb: y−b=φ(f−1(y)) (f−1(y)−a)y - b = \varphi(f^{-1}(y))\,(f^{-1}(y) - a). Since ff is strictly monotonic, φ(x)≠0\varphi(x) \ne 0 for x≠ax \ne a, and φ(a)=f′(a)≠0\varphi(a) = f'(a) \ne 0. So

f−1(y)−f−1(b)=1φ(f−1(y))(y−b).f^{-1}(y) - f^{-1}(b) = \frac{1}{\varphi(f^{-1}(y))}(y - b).

The inverse of a continuous strictly monotonic function is continuous, so 1φ∘f−1\frac{1}{\varphi\circ f^{-1}} is continuous at bb, with value 1f′(a)\frac{1}{f'(a)}.

∎

Building eˣ and ln x from scratch (university)

At A level, ee is introduced as "the number whose exponential is its own derivative". It is not obvious that such a number exists, or that axa^x even makes sense for irrational xx. Analysis builds everything from a power series.

DefinitionThe exponential function
exp⁡(x)=∑n=0∞xnn!=1+x+x22!+x33!+⋯\exp(x) = \sum_{n=0}^{\infty}\frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots

By the ratio test, this converges for every real (indeed complex) xx.

TheoremTerm-by-term differentiation

A power series ∑cnxn\sum c_nx^n with radius of convergence ρ\rho is differentiable on (−ρ,ρ)(-\rho, \rho), and its derivative is ∑ncnxn−1\sum nc_nx^{n-1}, which has the same radius of convergence.

This is proved using uniform convergence. Applied to exp⁡\exp:

exp⁡′(x)=∑n=1∞nxn−1n!=∑n=1∞xn−1(n−1)!=exp⁡(x).\exp'(x) = \sum_{n=1}^\infty\frac{nx^{n-1}}{n!} = \sum_{n=1}^\infty\frac{x^{n-1}}{(n-1)!} = \exp(x).

The key limit, proved

∣exp⁡(h)−1h−1∣=∣h2!+h23!+⋯ ∣≤∣h∣(12!+13!+⋯ )=∣h∣(e−2)for ∣h∣≤1,\left|\frac{\exp(h) - 1}{h} - 1\right| = \left|\frac{h}{2!} + \frac{h^2}{3!} + \cdots\right| \le |h|\left(\frac1{2!} + \frac1{3!} + \cdots\right) = |h|(e - 2) \quad\text{for } |h| \le 1,

which tends to 00. So lim⁡h→0eh−1h=1\lim_{h\to0}\frac{e^h - 1}{h} = 1, the fact we assumed in the derivations above.

TheoremUniqueness

If f′=ff' = f on R\mathbb{R} and f(0)=1f(0) = 1, then f=exp⁡f = \exp.

Proof

First, exp⁡(x)exp⁡(−x)=1\exp(x)\exp(-x) = 1 (differentiate the product: exp⁡⋅exp⁡(−x)−exp⁡⋅exp⁡(−x)=0\exp\cdot\exp(-x) - \exp\cdot\exp(-x) = 0, so it is constant, equal to its value 11 at 00). Hence exp⁡\exp is never zero. Let g(x)=f(x)exp⁡(−x)g(x) = f(x)\exp(-x). Then g′=f′exp⁡(−x)−fexp⁡(−x)=0g' = f'\exp(-x) - f\exp(-x) = 0, so gg is constant (by the Mean Value Theorem, next section), and g(0)=1g(0) = 1. So f=exp⁡f = \exp.

∎

Everything else follows

  • The law of indices exp⁡(a+b)=exp⁡(a)exp⁡(b)\exp(a + b) = \exp(a)\exp(b): fix bb and show exp⁡(x+b)exp⁡(−x)\exp(x + b)\exp(-x) has zero derivative.
  • exp⁡\exp is strictly increasing and positive: exp⁡′=exp⁡>0\exp' = \exp > 0.
  • ln⁡\ln is defined as the inverse of exp⁡\exp, so the inverse function rule gives ln⁡′(x)=1x\ln'(x) = \frac{1}{x}.
  • Real powers are defined by ax=exp⁡(xln⁡a)a^x = \exp(x\ln a). This is how 222^{\sqrt2} gets a meaning.
  • ee is defined as exp⁡(1)=∑1n!\exp(1) = \sum\frac{1}{n!}. Then ex=exp⁡(xln⁡e)=exp⁡(x)e^x = \exp(x\ln e) = \exp(x), so the notation is consistent.
  • The other classical definition: e=lim⁡n→∞(1+1n)ne = \lim_{n\to\infty}\left(1 + \frac1n\right)^n. Expanding binomially, the kkth term (nk)1nk=1k!⋅n(n−1)⋯(n−k+1)nk→1k!\binom nk\frac{1}{n^k} = \frac{1}{k!}\cdot\frac{n(n-1)\cdots(n-k+1)}{n^k} \to \frac1{k!}, so the limit is the series.
Mathematical curiosityWhy eiθe^{i\theta} makes sense

The series works for complex numbers too. Splitting exp⁡(iθ)\exp(i\theta) into real and imaginary parts gives exactly the series for cos⁡θ\cos\theta and sin⁡θ\sin\theta, which is Euler's formula eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta. The derivative rules for sin⁡\sin and cos⁡\cos then come for free from exp⁡′=exp⁡\exp' = \exp.

The Mean Value Theorem and its consequences (university)

A level uses facts like "if f′>0f' > 0 then ff is increasing" and "if f′=0f' = 0 everywhere then ff is constant" without proof. Both are consequences of one theorem, which is perhaps the most useful result in single-variable calculus.

TheoremExtreme Value Theorem

A continuous function on a closed bounded interval [a,b][a, b] attains a maximum and a minimum value.

This needs the completeness of the real numbers. It fails on Q\mathbb{Q}: f(x)=xf(x) = x on {x∈Q:0≤x≤2}\{x \in \mathbb{Q} : 0 \le x \le \sqrt2\} has no maximum.

TheoremFermat's theorem (interior extrema)

If ff has a local maximum or minimum at an interior point cc, and f′(c)f'(c) exists, then f′(c)=0f'(c) = 0.

Proof

Suppose a local maximum. For small h>0h > 0: f(c+h)≤f(c)f(c + h) \le f(c), so f(c+h)−f(c)h≤0\frac{f(c+h) - f(c)}{h} \le 0, and letting h→0+h \to 0^+ gives f′(c)≤0f'(c) \le 0. For small h<0h < 0 the quotient is ≥0\ge 0 (a non-positive number over a negative one), giving f′(c)≥0f'(c) \ge 0. So f′(c)=0f'(c) = 0.

∎
TheoremRolle's theorem

If ff is continuous on [a,b][a, b], differentiable on (a,b)(a, b), and f(a)=f(b)f(a) = f(b), then f′(c)=0f'(c) = 0 for some c∈(a,b)c \in (a, b).

Proof

By the Extreme Value Theorem, ff attains a maximum MM and a minimum mm. If both occur at the endpoints, then M=m=f(a)M = m = f(a), so ff is constant and f′=0f' = 0 everywhere. Otherwise one of them occurs at an interior point cc, and Fermat gives f′(c)=0f'(c) = 0.

∎
TheoremThe Mean Value Theorem

If ff is continuous on [a,b][a, b] and differentiable on (a,b)(a, b), then for some c∈(a,b)c \in (a, b)

f′(c)=f(b)−f(a)b−a.f'(c) = \frac{f(b) - f(a)}{b - a}.
Proof

Subtract the chord: g(x)=f(x)−[f(a)+f(b)−f(a)b−a(x−a)]g(x) = f(x) - \left[f(a) + \frac{f(b) - f(a)}{b - a}(x - a)\right]. Then g(a)=g(b)=0g(a) = g(b) = 0, so by Rolle g′(c)=0g'(c) = 0, i.e. f′(c)=f(b)−f(a)b−af'(c) = \frac{f(b) - f(a)}{b - a}.

∎

In words: somewhere, the instantaneous rate equals the average rate. If you drive 120 km in 1.5 hours, at some instant your speedometer read exactly 80 km/h. (This has been used in court to prove speeding from average-speed cameras.)

The consequences A level relies on

  • f′=0f' = 0 on an interval ⇒\Rightarrow ff is constant. For any x<yx < y, f(y)−f(x)=f′(c)(y−x)=0f(y) - f(x) = f'(c)(y - x) = 0. This is why the "+c+c" in integration is the only freedom.
  • f′>0f' > 0 on an interval ⇒\Rightarrow ff is strictly increasing. For x<yx < y, f(y)−f(x)=f′(c)(y−x)>0f(y) - f(x) = f'(c)(y - x) > 0. This justifies the first derivative test for stationary points.
  • Bounds: if ∣f′∣≤K|f'| \le K then ∣f(x)−f(y)∣≤K∣x−y∣|f(x) - f(y)| \le K|x - y|. For example ∣sin⁡x−sin⁡y∣≤∣x−y∣|\sin x - \sin y| \le |x - y|, and so ∣sin⁡x∣≤∣x∣|\sin x| \le |x|.
  • The converse fails: x3x^3 is strictly increasing but f′(0)=0f'(0) = 0. So "f′>0f' > 0" is sufficient for increasing, not necessary.
TheoremCauchy's Mean Value Theorem

If f,gf, g are continuous on [a,b][a, b] and differentiable on (a,b)(a, b), then for some c∈(a,b)c \in (a, b)

(f(b)−f(a))g′(c)=(g(b)−g(a))f′(c).\big(f(b) - f(a)\big)g'(c) = \big(g(b) - g(a)\big)f'(c).
Proof

Apply Rolle to h(x)=(f(b)−f(a))g(x)−(g(b)−g(a))f(x)h(x) = \big(f(b) - f(a)\big)g(x) - \big(g(b) - g(a)\big)f(x). Expanding shows h(a)=h(b)=f(b)g(a)−f(a)g(b)h(a) = h(b) = f(b)g(a) - f(a)g(b).

∎
TheoremL'Hôpital's rule

Suppose f(a)=g(a)=0f(a) = g(a) = 0, ff and gg are differentiable near aa, g′(x)≠0g'(x) \ne 0 near aa (except possibly at aa), and lim⁡x→af′(x)g′(x)=L\lim_{x\to a}\frac{f'(x)}{g'(x)} = L. Then lim⁡x→af(x)g(x)=L\lim_{x\to a}\frac{f(x)}{g(x)} = L.

Proof

For x>ax > a, Cauchy's MVT on [a,x][a, x] gives cx∈(a,x)c_x \in (a, x) with

f(x)g(x)=f(x)−f(a)g(x)−g(a)=f′(cx)g′(cx).\frac{f(x)}{g(x)} = \frac{f(x) - f(a)}{g(x) - g(a)} = \frac{f'(c_x)}{g'(c_x)}.

As x→a+x \to a^+, cx→ac_x \to a (it is squeezed between aa and xx), so the right-hand side tends to LL. The case x<ax < a is identical.

∎
ExampleA triple application
lim⁡x→0sin⁡x−xx3=lim⁡cos⁡x−13x2=lim⁡−sin⁡x6x=−16.\lim_{x\to0}\frac{\sin x - x}{x^3} = \lim\frac{\cos x - 1}{3x^2} = \lim\frac{-\sin x}{6x} = -\frac16.

Each step is a 00\frac00 form. The answer says sin⁡x≈x−x36\sin x \approx x - \frac{x^3}{6} for small xx, the start of the Taylor series.

Common mistakeUsing L'Hôpital when the form is not 00\frac00

lim⁡x→0x+1x+2=12\lim_{x\to0}\frac{x + 1}{x + 2} = \frac12, but "differentiating top and bottom" gives 11. The rule needs both numerator and denominator to tend to 00 (or both to ±∞\pm\infty).

Taylor's theorem: the derivative's full story (university)

The tangent line uses f(a)f(a) and f′(a)f'(a). Adding higher derivatives gives better and better polynomial approximations, and Taylor's theorem says exactly how good they are.

TheoremTaylor's theorem with Lagrange remainder

If ff is (n+1)(n+1) times differentiable on an interval containing aa and xx, then for some cc strictly between aa and xx,

f(x)=∑k=0nf(k)(a)k!(x−a)k  +  f(n+1)(c)(n+1)!(x−a)n+1.f(x) = \sum_{k=0}^{n}\frac{f^{(k)}(a)}{k!}(x - a)^k \;+\; \frac{f^{(n+1)}(c)}{(n+1)!}(x - a)^{n+1}.

For n=0n = 0 this is exactly the Mean Value Theorem.

Proof

Fix x≠ax \ne a and write PnP_n for the Taylor polynomial. Choose the constant MM so that f(x)=Pn(x)+M(x−a)n+1f(x) = P_n(x) + M(x - a)^{n+1}, and let

g(t)=f(t)−Pn(t)−M(t−a)n+1.g(t) = f(t) - P_n(t) - M(t - a)^{n+1}.

By construction of PnP_n, g(a)=g′(a)=⋯=g(n)(a)=0g(a) = g'(a) = \cdots = g^{(n)}(a) = 0, and by the choice of MM, g(x)=0g(x) = 0.

Rolle on [a,x][a, x] gives c1c_1 with g′(c1)=0g'(c_1) = 0. Rolle on [a,c1][a, c_1] (since g′(a)=g′(c1)=0g'(a) = g'(c_1) = 0) gives c2c_2 with g′′(c2)=0g''(c_2) = 0. Continue n+1n+1 times to reach cc with g(n+1)(c)=0g^{(n+1)}(c) = 0. But Pn(n+1)=0P_n^{(n+1)} = 0 and dn+1dtn+1(t−a)n+1=(n+1)!\frac{d^{n+1}}{dt^{n+1}}(t-a)^{n+1} = (n+1)!, so

0=f(n+1)(c)−(n+1)! M⇒M=f(n+1)(c)(n+1)!.0 = f^{(n+1)}(c) - (n+1)!\,M \quad\Rightarrow\quad M = \frac{f^{(n+1)}(c)}{(n+1)!}.
∎
ExampleHow accurate is 1+1+12!+⋯+18!1 + 1 + \frac1{2!} + \cdots + \frac1{8!} as a value of ee?

With f=exp⁡f = \exp, a=0a = 0, x=1x = 1, n=8n = 8, the remainder is ec9!\frac{e^c}{9!} with 0<c<10 < c < 1. So the error is less than 39!≈8.3×10−6\frac{3}{9!} \approx 8.3\times10^{-6}. Indeed the sum is 2.71827882.7182788 and e=2.7182818e = 2.7182818, an error of 3.1×10−63.1\times10^{-6}.

The second derivative test, proved

Suppose f′(a)=0f'(a) = 0, and f′′f'' is continuous with f′′(a)>0f''(a) > 0. Taylor with n=1n = 1:

f(x)=f(a)+0+12f′′(c)(x−a)2.f(x) = f(a) + 0 + \tfrac12f''(c)(x - a)^2.

By continuity, f′′(c)>0f''(c) > 0 for xx close to aa, so f(x)>f(a)f(x) > f(a): a strict local minimum.

When f′′(a)=0f''(a) = 0, look at the first non-zero derivative f(k)(a)f^{(k)}(a). If kk is even, the point is a maximum or minimum (by the sign of f(k)(a)f^{(k)}(a)). If kk is odd, it is a point of inflection. This settles x3x^3, x4x^4 and x5x^5 at 00 at a stroke.

CounterexampleSmooth but not equal to its Taylor series

f(x)=e−1/x2f(x) = e^{-1/x^2} (x≠0x \ne 0), f(0)=0f(0) = 0, has every derivative equal to 00 at the origin. So its Maclaurin series is identically 00, yet f(x)>0f(x) > 0 for all x≠0x \ne 0. Infinitely differentiable ("smooth") does not imply analytic. Complex differentiable functions are completely different: there, one derivative forces infinitely many, and the Taylor series always converges to the function.

Derivatives in several variables (university)

Real problems have many inputs: temperature depends on position (x,y,z)(x, y, z) and time tt. Derivatives generalise in a beautiful way.

DefinitionPartial derivative

For f(x,y)f(x, y), ∂f∂x\dfrac{\partial f}{\partial x} is the derivative with respect to xx with yy held constant. For f=x2y+sin⁡yf = x^2y + \sin y: fx=2xyf_x = 2xy and fy=x2+cos⁡yf_y = x^2 + \cos y.

DefinitionGradient

∇f=(∂f∂x,∂f∂y)\nabla f = \left(\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}\right). It points in the direction of steepest ascent, and its length is that steepest rate. The rate of change in the direction of a unit vector u\mathbf u is ∇f⋅u\nabla f\cdot\mathbf u.

The real definition: a linear map

In one variable, f(a+h)≈f(a)+f′(a)hf(a + h) \approx f(a) + f'(a)h. For f:Rn→Rmf: \mathbb{R}^n \to \mathbb{R}^m we ask for a linear map Df(a)Df(a) (an m×nm\times n matrix) with

f(a+h)=f(a)+Df(a) h+o(∣h∣).f(\mathbf a + \mathbf h) = f(\mathbf a) + Df(\mathbf a)\,\mathbf h + o(|\mathbf h|).

That matrix is the Jacobian, the matrix of partial derivatives (∂fi∂xj)\left(\frac{\partial f_i}{\partial x_j}\right). The derivative is no longer a number but a transformation, the best linear approximation.

TheoremThe chain rule in many variables
D(f∘g)(a)=Df(g(a)) Dg(a).D(f\circ g)(\mathbf a) = Df\big(g(\mathbf a)\big)\,Dg(\mathbf a).

The chain rule becomes matrix multiplication. The one-variable rule "rates multiply" is the 1×11\times1 case. The proof is the Carathéodory argument with matrices in place of numbers.

CounterexamplePartial derivatives are not enough

Let f(x,y)=xyx2+y2f(x, y) = \dfrac{xy}{x^2 + y^2} for (x,y)≠(0,0)(x, y) \ne (0, 0), and f(0,0)=0f(0, 0) = 0. On both axes f=0f = 0, so fx(0,0)=fy(0,0)=0f_x(0,0) = f_y(0,0) = 0. But along the line y=xy = x, f=12f = \frac12, so ff is not even continuous at the origin, let alone differentiable. Partial derivatives only look along two directions.

The fix (a standard theorem): if the partial derivatives exist and are continuous near a point, then ff is differentiable there.

Beyond the syllabusWhere this leads
  • Optimisation: at an interior maximum, ∇f=0\nabla f = \mathbf 0. Classify with the Hessian matrix of second partials, whose eigenvalues play the role of the sign of f′′f''.
  • Lagrange multipliers: to optimise ff subject to g=0g = 0, solve ∇f=λ∇g\nabla f = \lambda\nabla g. At the optimum, the level curve of ff is tangent to the constraint.
  • Inverse and implicit function theorems: if the Jacobian is invertible, the function is locally invertible. This is what makes implicit differentiation legitimate.
  • Differential geometry: derivatives on curved spaces (manifolds), the language of general relativity.
  • Functional analysis: the Fréchet derivative in infinite-dimensional spaces, where the "points" are whole functions. This is the setting of the calculus of variations.

Strange functions: where intuition fails (university)

Every function met at A level is differentiable except at a few isolated points. That is a very special situation.

TheoremWeierstrass (1872)

For 0<a<10 < a < 1 and bb an odd integer with ab>1+3π2ab > 1 + \frac{3\pi}{2}, the function

W(x)=∑n=0∞ancos⁡(bnπx)W(x) = \sum_{n=0}^\infty a^n\cos(b^n\pi x)

is continuous everywhere and differentiable nowhere.

Why it is continuous: ∣ancos⁡(⋅)∣≤an|a^n\cos(\cdot)| \le a^n and ∑an\sum a^n converges, so the series converges uniformly (the Weierstrass MM-test). A uniform limit of continuous functions is continuous.

Why it is nowhere differentiable: each new term adds wiggles bb times faster, with amplitude reduced only by aa. The steepness of the nnth term grows like (ab)n→∞(ab)^n \to \infty. Zoom in anywhere and you find more corners, never a straight line. The graph is a fractal.

Mathematicians of the time were appalled. Hermite wrote of turning away "with fear and horror from this lamentable plague of continuous functions which do not have derivatives". Then Banach (1931) showed, using the Baire category theorem, that in a precise sense most continuous functions are nowhere differentiable. The smooth functions of A level are the rare exceptions.

Mathematical curiosityBrownian motion

The path of a pollen grain jiggling in water (Brownian motion) is, with probability 11, continuous and nowhere differentiable. The grain has a position at every instant but no velocity at any instant. This is why the calculus of random processes, Itô calculus, needs new rules. In it, (dW)2=dt(dW)^2 = dt rather than 00, and it underpins modern financial mathematics.

Mathematical curiosityA derivative that is not integrable

Volterra (1881) built a function VV that is differentiable everywhere, with V′V' bounded, yet V′V' is not Riemann integrable. So ∫abV′(x) dx=V(b)−V(a)\int_a^b V'(x)\,dx = V(b) - V(a) fails for the Riemann integral. This was one of the motivations for Lebesgue's theory of integration.

HistoryFrom Newton to Weierstrass

Newton (fluxions, 1660s) and Leibniz (differentials, 1670s) invented calculus independently, and their notations survive as x˙\dot{x} and dydx\frac{dy}{dx}. Their foundations were shaky, but the results were spectacular. Cauchy (1821) introduced limits, and Weierstrass (1860s) gave the ε–δ definitions used today. Robinson's non-standard analysis (1960s) finally made Leibniz's infinitesimals rigorous, using mathematical logic.

Why does this work?

Why does this work?Why is ddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1}?

(x+h)n=xn+nxn−1h+(n2)xn−2h2+…(x + h)^n = x^n + nx^{n-1}h + \binom n2x^{n-2}h^2 + \dots, so (x+h)n−xnh=nxn−1+h(… )\frac{(x + h)^n - x^n}{h} = nx^{n-1} + h(\dots), which tends to nxn−1nx^{n-1}. For non-integer nn, use xn=enln⁡xx^n = e^{n\ln x} and the chain rule: ddxenln⁡x=enln⁡x⋅nx=nxn−1\frac{d}{dx}e^{n\ln x} = e^{n\ln x}\cdot\frac nx = nx^{n-1}.

Why does this work?Why does the chain rule multiply?

If uu changes by a small δu\delta u when xx changes by δx\delta x, and yy changes by δy\delta y when uu changes by δu\delta u, then δyδx=δyδu⋅δuδx\frac{\delta y}{\delta x} = \frac{\delta y}{\delta u}\cdot\frac{\delta u}{\delta x}. Rates multiply, like gear ratios.

Beyond the syllabus

Beyond the syllabusThe rigorous definition of a limit

lim⁡x→af(x)=L\lim_{x\to a}f(x) = L means: for every ε>0\varepsilon > 0 there is a δ>0\delta > 0 such that 0<∣x−a∣<δ⇒∣f(x)−L∣<ε0 < |x - a| < \delta \Rightarrow |f(x) - L| < \varepsilon. "However close you want f(x)f(x) to be to LL, you can guarantee it by taking xx close enough to aa." With this definition (Weierstrass, 1860s), calculus finally rests on solid ground, and statements like the mean value theorem can be proved rather than assumed.

Beyond the syllabusThe mean value theorem

If ff is continuous on [a,b][a, b] and differentiable on (a,b)(a, b), there is c∈(a,b)c \in (a, b) with f′(c)=f(b)−f(a)b−af'(c) = \frac{f(b) - f(a)}{b - a}: somewhere the instantaneous rate equals the average rate. If you drive 120 km in 1 hour, at some moment your speedometer read exactly 120 km/h. Consequences: a function with f′=0f' = 0 everywhere is constant, and f′>0f' > 0 means increasing.

Mathematical curiosities

Mathematical curiosityDifferentiable but not twice

f(x)=x∣x∣f(x) = x|x| has derivative 2∣x∣2|x|, which has no derivative at 00. And x2sin⁡1xx^2\sin\frac1x (with f(0)=0f(0) = 0) is differentiable everywhere, but its derivative is not continuous at 00.

Further exploration

Further explorationInvestigations
  • Prove ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x from first principles using sin⁡hh→1\frac{\sin h}{h} \to 1 and 1−cos⁡hh→0\frac{1 - \cos h}{h} \to 0.
  • Find the dimensions of the cylinder of volume 11 with least surface area. (Height == diameter.)

Reading pathway: Calculus (Spivak) for a rigorous but friendly treatment.

Now practise63 questions from Very easy to Extreme →