Secants become a tangent
The slope of a straight line is rise over run. A curve has no single slope, but we can measure the slope of a chord, or secant, between two of its points: from \(x = a\) to \(x = a + h\), it's the difference quotient
\[ \frac{f(a + h) - f(a)}{h}. \]Now let \(h\) shrink. The second point slides along the curve towards the first, and the secant swings round towards the tangent line.
Swipe or scroll sideways to step through.
\(h = 1.2\)
A long secant: slope 2.82, far from the tangent's 1.02.
\(h = 0.5\)
Closer: slope 1.683.
\(h = 0.15\)
Slope 1.206, and the secant is nearly the tangent. As \(h \to 0\), the slopes tend to \(f'(a) = 1.02\).
Definition
\(f\) is differentiable at \(a\) if the limit
\[ f'(a) = \lim_{h\to0}\frac{f(a + h) - f(a)}{h} \]exists. The number \(f'(a)\) is the derivative of \(f\) at \(a\): the slope of the tangent line, or the instantaneous rate of change.
Examples
For \(f(x) = x^2\): \(\dfrac{(a + h)^2 - a^2}{h} = \dfrac{2ah + h^2}{h} = 2a + h \to 2a\). So \(f'(a) = 2a\).
For \(f(x) = \frac1x\): \(\dfrac{\frac1{a + h} - \frac1a}{h} = \dfrac{-1}{a(a + h)} \to -\dfrac1{a^2}\), for \(a \neq 0\).
Notice that we never divide by zero. For each \(h \neq 0\) the quotient is an honest number; only then do we take the limit. This is exactly how analysis answers Berkeley's objection about "ghosts of departed quantities" from Unit 1.
The best straight-line approximation
There's another way to read the definition. Near \(a\), the function is almost a straight line:
Example
Estimate \(\sqrt{4.1}\). With \(f(x) = \sqrt x\), \(f'(x) = \frac1{2\sqrt x}\), \(a = 4\), \(h = 0.1\): \(\sqrt{4.1} \approx 2 + \tfrac14(0.1) = 2.025\). The true value is \(2.02485\ldots\)
This viewpoint, "differentiable means locally linear", is the one that generalises to functions of several variables, where the derivative becomes a matrix.
Differentiable implies continuous
Theorem
If \(f\) is differentiable at \(a\), then \(f\) is continuous at \(a\).
Proof: \(f(a + h) - f(a) = \dfrac{f(a + h) - f(a)}{h}\cdot h \to f'(a)\cdot 0 = 0\). The converse is false.
The rules of differentiation
All the familiar rules follow from the definition and the limit laws:
| Rule | Formula |
|---|---|
| Sum | \((f + g)' = f' + g'\) |
| Product | \((fg)' = f'g + fg'\) |
| Quotient | \(\left(\frac fg\right)' = \frac{f'g - fg'}{g^2}\), where \(g \neq 0\) |
| Chain | \((f \circ g)'(a) = f'(g(a))\,g'(a)\) |
| Inverse | \((f^{-1})'(b) = \dfrac1{f'(a)}\), where \(b = f(a)\) and \(f'(a) \neq 0\) |
Why the product rule works
Add and subtract \(f(a + h)g(a)\):
\[ \frac{f(a + h)g(a + h) - f(a)g(a)}{h} = f(a + h)\,\frac{g(a + h) - g(a)}{h} + g(a)\,\frac{f(a + h) - f(a)}{h}. \]As \(h \to 0\), \(f(a + h) \to f(a)\) (differentiable implies continuous), so the right side tends to \(f(a)g'(a) + g(a)f'(a)\). ∎
The chain rule is subtler: the tempting proof that multiplies and divides by \(g(a + h) - g(a)\) fails when that difference is zero for small \(h\). The linear approximation viewpoint gives a clean proof: composing two "almost linear" maps gives an almost linear map whose slope is the product of the slopes.
Flat points and Rolle's theorem
Fermat's theorem
If \(f\) has a maximum or minimum at an interior point \(c\) of an interval, and \(f\) is differentiable at \(c\), then \(f'(c) = 0\).
At a maximum, the difference quotient is \(\le 0\) for \(h > 0\) (the function can only go down) and \(\ge 0\) for \(h < 0\). The limit must be both, so it's 0. Combining this with the extreme value theorem of Unit 6:
Rolle's theorem
If \(f\) is continuous on \([a, b]\), differentiable on \((a, b)\), and \(f(a) = f(b)\), then \(f'(c) = 0\) for some \(c\) in \((a, b)\).
By the EVT, \(f\) reaches a max and a min on \([a, b]\). If both are at the endpoints, \(f\) is constant and \(f' = 0\) everywhere. Otherwise one of them is inside, and Fermat's theorem applies there.
The mean value theorem
Tilt Rolle's picture and you get the single most useful theorem about derivatives.
The mean value theorem (MVT)
If \(f\) is continuous on \([a, b]\) and differentiable on \((a, b)\), then for some \(c\) in \((a, b)\),
\[ f'(c) = \frac{f(b) - f(a)}{b - a}. \]Proof
Subtract the chord: let \(g(x) = f(x) - \left[f(a) + \frac{f(b) - f(a)}{b - a}(x - a)\right]\). Then \(g(a) = g(b) = 0\), so by Rolle \(g'(c) = 0\) for some \(c\), which says \(f'(c) = \frac{f(b) - f(a)}{b - a}\). ∎
The MVT is the bridge from slopes to values. Its consequences are the facts calculus relies on every day:
- If \(f' = 0\) on an interval, then \(f\) is constant there. (Any two values differ by \(f'(c)(b - a) = 0\).) So two functions with the same derivative differ by a constant: the basis of antiderivatives.
- If \(f' > 0\) on an interval, \(f\) is strictly increasing there; if \(f' < 0\), decreasing.
- If \(|f'| \le M\), then \(|f(x) - f(y)| \le M|x - y|\). For example \(|\sin x - \sin y| \le |x - y|\), because \(|\cos| \le 1\).
Going deeper: derivatives can't jump
A derivative need not be continuous. \(f(x) = x^2\sin(1/x)\) (with \(f(0) = 0\)) is differentiable everywhere, with \(f'(0) = \lim \frac{h^2\sin(1/h)}{h} = 0\), but for \(x \neq 0\), \(f'(x) = 2x\sin(1/x) - \cos(1/x)\), which oscillates between about \(-1\) and \(1\) near 0. Still, Darboux proved in 1875 that derivatives always satisfy the intermediate value property, even when discontinuous. So a function like the jump in Unit 6 can never be anyone's derivative.
L'Hôpital's rule
A two-function version of the MVT (Cauchy's mean value theorem) gives a famous tool for limits of the form \(\frac00\):
L'Hôpital's rule
If \(f(a) = g(a) = 0\), and \(\lim_{x\to a}\frac{f'(x)}{g'(x)}\) exists, then \(\lim_{x\to a}\frac{f(x)}{g(x)}\) exists and equals it. (Versions also hold for \(\frac\infty\infty\) and for \(x \to \infty\).)
Example
\(\displaystyle\lim_{x\to0}\frac{e^x - 1 - x}{x^2} = \lim_{x\to0}\frac{e^x - 1}{2x} = \lim_{x\to0}\frac{e^x}{2} = \frac12\), using the rule twice.
Use it with care: check that the limit really has the form \(\frac00\) or \(\frac\infty\infty\) first, and remember the rule is about the quotient of derivatives, not the derivative of the quotient.
Practice set
Mixed questions covering the whole unit. Try each one before opening the answer.
1. Use the definition to find the derivative of \(x^3\) at \(a\).
Show answer
\(\frac{(a + h)^3 - a^3}{h} = \frac{3a^2h + 3ah^2 + h^3}{h} = 3a^2 + 3ah + h^2 \to 3a^2\).
2. Use the definition to find the derivative of \(\sqrt x\) at \(a > 0\).
Show answer
Multiply top and bottom by \(\sqrt{a + h} + \sqrt a\): \(\frac{\sqrt{a + h} - \sqrt a}{h} = \frac{1}{\sqrt{a + h} + \sqrt a} \to \frac1{2\sqrt a}\).
3. Is \(f(x) = x|x|\) differentiable at 0?
Show answer
Yes: \(\frac{f(h) - f(0)}{h} = \frac{h|h|}{h} = |h| \to 0\). So \(f'(0) = 0\), even though \(|x|\) itself has a corner there.
4. Use the MVT to show \(e^x \ge 1 + x\) for \(x > 0\).
Show answer
On \([0, x]\), \(e^x - e^0 = e^c\cdot x\) for some \(c \in (0, x)\). Since \(e^c > 1\), \(e^x - 1 > x\). (For \(x < 0\) a similar argument works, so it holds for all \(x\).)
5. A car covers 120 km in 1.5 hours. Explain why at some moment it was travelling at exactly 80 km/h.
Show answer
Its position is a differentiable function of time, with average rate of change \(120/1.5 = 80\) km/h. By the MVT, at some instant its speed (the derivative) equals that average.
6. Find \(\displaystyle\lim_{x\to0}\frac{1 - \cos x}{x^2}\).
Show answer
It's \(\frac00\). L'Hôpital: \(\lim\frac{\sin x}{2x} = \frac12\lim\frac{\sin x}{x} = \frac12\).
Summary and glossary
- \(f'(a) = \lim_{h\to0}\frac{f(a + h) - f(a)}{h}\): the limit of secant slopes, the slope of the tangent.
- Differentiable means locally linear: \(f(a + h) \approx f(a) + f'(a)h\) with error small compared with \(h\).
- Differentiable implies continuous, but not conversely (\(|x|\) at 0).
- At an interior max or min, \(f' = 0\) (Fermat). With the EVT this gives Rolle's theorem.
- The MVT: average slope = instantaneous slope somewhere. It shows \(f' = 0 \Rightarrow\) constant, and \(f' > 0 \Rightarrow\) increasing.
- Difference quotient
- \(\frac{f(a + h) - f(a)}{h}\), the slope of a secant.
- Derivative
- The limit of the difference quotient as \(h \to 0\).
- Linear approximation
- \(f(a) + f'(a)h\), the tangent-line estimate of \(f(a + h)\).
- Rolle's theorem
- Equal endpoint values force a flat point in between.
- Mean value theorem
- Some tangent is parallel to the chord.