9  The Derivative

The previous chapter ended with a condition that we have not yet used: \[ \lim_{h \to 0}\frac{|f(a+h) - f(a) - T(h)|}{|h|} = 0, \] where \(T\) is a linear map. Here we ask what it says, why it is phrased this way and not more simply, and what follows from it. The main consequence is the Mean Value Theorem, which turns information about small displacements into information about finite ones.

9.1 What Should “Best Linear Approximation” Mean?

Fix a function \(f\) defined near a point \(a\). We want a linear map \(T\) such that \[ f(a + h) \approx f(a) + T(h) \] for small displacements \(h\). The error of this approximation is \[ E_T(h) = f(a+h) - f(a) - T(h). \]

As stated, the problem is too easy. Suppose \(f\) is merely continuous at \(a\). Then \(f(a+h) - f(a) \to 0\) as \(h \to 0\), and \(T(h) \to 0\) as well, since a linear map of the line is \(h \mapsto mh\). So \(E_T(h) \to 0\) for every linear map \(T\), including \(T = 0\). The requirement “the error is small” selects nothing, because continuity already guarantees it.

The way out is to ask for more. Every term in the approximation is small when \(h\) is small, including the linear term \(T(h) = mh\) itself. The useful question is whether the error is small compared with the displacement. Changing \(m\) changes \(E_T(h)\) by a multiple of \(h\), which has size \(|h|\), so only a comparison at scale \(|h|\) can tell the choices apart.

Definition 9.1 (Differentiability) Let \(f : I \to \mathbb{R}\), where \(I\) open, and let \(a\in I\) be interior. We say \(f\) is differentiable at \(a\) if there is a linear map \(T : \mathbb{R} \to \mathbb{R}\) such that \[ \lim_{h \to 0}\frac{|f(a+h) - f(a) - T(h)|}{|h|} = 0. \] Equivalently, \(f(a+h) = f(a) + T(h) + o(h)\) as \(h \to 0\).

Here \(o(h)\) stands for any quantity \(r(h)\) with \(r(h)/|h| \to 0\). Informally, it is “negligible next to \(h\)”. The linear term is the part of the change proportional to \(h\), and \(o(h)\) is everything else, which the definition requires to be of strictly lower order.

The definition says “there is a linear map”. We would like to speak of the derivative, so we should check that there is only one.

Proposition 9.1 (Uniqueness of the Linear Approximation) If \(T\) and \(S\) are linear maps that both satisfy Definition 9.1 at \(a\), then \(T = S\).

By Proposition 8.1, \(T(h) = mh\) and \(S(h) = m'h\). Then \((T - S)(h) = (m - m')h\), and \[ |m - m'|\,|h| = |E_S(h) - E_T(h)| \le |E_S(h)| + |E_T(h)|. \] Dividing by \(|h|\), the right side tends to \(0\) while the left side is the constant \(|m - m'|\). So \(m = m'\). \(\square\)

Two different linear maps differ by a multiple of \(h\), and a multiple of \(h\) cannot hide inside an \(o(h)\) error. That is why first order is a natural place to stop: the linear term is determined exactly.

9.1.1 The Difference Quotient

In one dimension, the definition can be rewritten without reference to linear maps.

Proposition 9.2 (Difference Quotient) Let \(L \in \mathbb{R}\). Then \(T(h) = Lh\) satisfies Definition 9.1 at \(a\) if and only if \[ \lim_{h \to 0}\frac{f(a+h) - f(a)}{h} = L. \]

Algebra gives \[ \frac{f(a+h) - f(a) - Lh}{h} = \frac{f(a+h) - f(a)}{h} - L. \] The absolute value of the left side is \(|E_T(h)|/|h|\). It tends to \(0\) if and only if the difference quotient tends to \(L\). \(\square\)

So \(f\) is differentiable at \(a\) exactly when the difference quotient has a limit, and that limit is the derivative \(f'(a)\). The linear map \(h \mapsto f'(a)h\) is the differential \(df_a\). We write \[ f(a+h) = f(a) + f'(a)\,h + o(h). \]

The two descriptions of this fact do different jobs. The quotient is how one computes, since it reduces differentiation to a limit we already handle. The approximation is how one thinks, and it is the one that survives in higher dimensions. For a function of two variables \(h\) is a vector, and one cannot divide by a vector, so there is no difference quotient. But “\(f(a+h) - f(a)\) is a linear function of \(h\) up to \(o(\|h\|)\)” makes sense verbatim. This is why we built linear maps and norms first.

9.1.2 Examples

Example 1. Let \(f(x) = x^2\). What is \(f'(a)\)?

Scratch work. We look for \(m\) with \(E(h) = (a+h)^2 - a^2 - mh\) small compared with \(h\). Expanding, \(E(h) = (2a - m)h + h^2\), so \(|E(h)|/|h| = |2a - m + h|\). This tends to \(0\) exactly when \(m = 2a\).

So \(f\) is differentiable at every \(a\), with \(f'(a) = 2a\), and the error is \(E(h) = h^2 = o(h)\). As a check, at \(a = 1\) and \(h = 0.1\): the true change is \(1.1^2 - 1 = 0.21\), the linear prediction is \(2h = 0.2\), and the error is \(0.01 = h^2\).

Plot of the normalized error |E(h)|/|h| against h for f(x) = x^2 at a = 1, for the slopes m = 1, 2 and 3. For m = 2 the curve is the V-shaped graph of |h| and reaches zero at h = 0. For m = 1 and m = 3 the curves are V-shapes bottoming out at height 1 above the axis.

The figure is the whole definition in one picture. Of all slopes \(m\), only one makes the normalized error vanish at \(h = 0\).

Secant to tangent

Example 2. \(f(x) = |x|\) is not differentiable at \(0\).

Suppose \(T(h) = mh\) worked. For \(h > 0\) the normalized error is \(|h - mh|/h = |1 - m|\), which forces \(m = 1\). For \(h < 0\) it is \(|{-h} - mh|/|h| = |{-1} - m|\), which forces \(m = -1\). No single \(m\) satisfies both. Geometrically, the graph has a corner, and a corner does not become a line however far we zoom in.

Example 3. Let \(f(x) = x^2\sin(1/x)\) for \(x \ne 0\) and \(f(0) = 0\). Then \(f\) is differentiable at \(0\) with \(f'(0) = 0\).

Indeed \(\dfrac{|f(h) - f(0) - 0\cdot h|}{|h|} = |h|\,|\sin(1/h)| \le |h| \to 0\). The function oscillates infinitely often near \(0\), and the definition does not mind: it asks only that the oscillation be negligible compared with \(h\), and an amplitude of \(h^2\) is. (In the next chapter we will compute \(f'(x)\) for \(x \ne 0\) and see that it oscillates wildly near \(0\). Differentiability at a point says nothing about the neighboring points.)

9.2 Differentiability and Continuity

A linear map is continuous, so a function that is close to one should be continuous. The definition gives a little more than that.

Theorem 9.1 (Differentiability Implies Continuity) If \(f\) is differentiable at \(a\), then \(f\) is continuous at \(a\). In fact there are \(\delta, C > 0\) with \(|f(a+h) - f(a)| \le C|h|\) for \(|h| < \delta\).

Apply the definition with \(\varepsilon = 1\): there is a \(\delta > 0\) such that \(|E(h)| \le |h|\) whenever \(|h| < \delta\). Then \[ |f(a+h) - f(a)| = |f'(a)h + E(h)| \le (|f'(a)| + 1)\,|h|. \] Take \(C = |f'(a)| + 1\). The right side tends to \(0\) as \(h \to 0\), so \(f\) is continuous at \(a\). \(\square\)

The second statement says that a differentiable function is Lipschitz at the point \(a\): the bound is only claimed for displacements from \(a\), and only locally. This is weaker than being Lipschitz on a set (Definition 7.4).

The converse of the theorem fails, and Example 2 is the standard counterexample: \(|x|\) is continuous at \(0\), even Lipschitz, but not differentiable there. The relations between the notions are subtler than a single chain of implications.

Property Example
Lipschitz, not differentiable \(\lvert x\rvert\) at \(0\)
differentiable, but oscillating \(x^2\sin(1/x)\) at \(0\)
differentiable everywhere, not Lipschitz \(x^2\) on \(\mathbb{R}\)

For the last row, see Example 11 of the previous chapter. We will see in the Mean Value section that a bound on the derivative is what produces a Lipschitz constant.

9.3 The Tangent Line

Writing \(x = a + h\), the approximation becomes \[ f(x) \approx f(a) + f'(a)\,(x - a). \] The right side is the equation of the tangent line to the graph of \(f\) at \((a, f(a))\), the line through that point with slope \(f'(a)\). By Proposition 9.1, it is the only line through the point that approximates \(f\) to first order.

Zooming in at a point where f is differentiable

One subtlety, which we flagged in the previous chapter after Theorem 8.2: the tangent line is not a linear map, since it does not pass through the origin. What is linear is the map \(h \mapsto f'(a)h\) from displacement to predicted change. The tangent line is the graph of this map, moved so that its origin sits at \((a, f(a))\). The derivative is the slope of the line, and it is also the single coefficient of a linear map. The second description is the one that generalizes.

The tangent line as a translated linear map

In the language of Section 8.3, the differential \(df_a\) is a linear functional: it takes a displacement and returns a number. In one dimension \(df_a\) is determined by \(df_a(1) = f'(a)\), so the functional and its coefficient carry the same information. In several variables they will not coincide so neatly: \(df_a\) will be a row of numbers, one for each direction, and the derivative will be the whole row.

The derivative as a linear map

9.4 The Mean Value Theorem

The definition of the derivative is local. It tells us that for small enough \(h\) the prediction \(f(a) + f'(a)h\) is good, and it does not say how small is small enough. The Mean Value Theorem is the first result that reaches across a finite interval.

Consider \([a,b]\) and the displacement \(h = b - a\). The differential at \(a\) predicts \(f(b) \approx f(a) + f'(a)(b - a)\), and the differential at \(b\) makes a different prediction. For a linear function all of these agree and are exact. For a nonlinear function they differ, and we can ask whether, among the family of differentials \(\{df_c : c \in (a,b)\}\), there is one whose prediction is exactly right: \[ f(b) - f(a) = df_c(b - a) = f'(c)(b - a). \]

The family of differentials over an interval

We start with the case where the secant is horizontal.

Theorem 9.2 (Rolle’s Theorem) Let \(f : [a,b] \to \mathbb{R}\) be continuous on \([a,b]\) and differentiable on \((a,b)\). If \(f(a) = f(b)\), then there is a \(c \in (a,b)\) with \(f'(c) = 0\).

The idea: a continuous function on \([a,b]\) attains its extremes, and if the endpoint values agree, one extreme must be attained inside. There the function cannot be going up or down, so the slope is zero.

By Theorem 7.5, \(f\) attains a maximum \(M\) and a minimum \(m\) on \([a,b]\). If \(M = m\), then \(f\) is constant and every \(c \in (a,b)\) works. Otherwise at least one of \(M, m\) differs from the common value \(f(a) = f(b)\), so it is attained at some \(c \in (a, b)\), not at an endpoint. Say it is the maximum. Then \(f(c + h) \le f(c)\) for all small \(|h|\). For small \(h > 0\) the quotient \(\frac{f(c+h) - f(c)}{h}\) is \(\le 0\), so its limit satisfies \(f'(c) \le 0\). For small \(h < 0\) the numerator is \(\le 0\) and the denominator is negative, so the quotient is \(\ge 0\) and \(f'(c) \ge 0\). Hence \(f'(c) = 0\). If it is the minimum, the signs reverse, or apply the argument to \(-f\). \(\square\)

The general case follows by tilting the picture: subtract the straight line through the endpoints, which makes both endpoint values \(0\) and reduces the problem to Rolle’s.

Theorem 9.3 (Mean Value Theorem) Let \(f : [a,b] \to \mathbb{R}\) be continuous on \([a,b]\) and differentiable on \((a,b)\). Then there is a \(c \in (a,b)\) with \[ f(b) - f(a) = f'(c)\,(b - a). \]

Let \(s = \dfrac{f(b) - f(a)}{b - a}\) and define \[ \psi(x) = f(x) - f(a) - s\,(x - a). \] Then \(\psi\) is continuous on \([a,b]\) and differentiable on \((a,b)\) with \(\psi'(x) = f'(x) - s\). (The linear part has zero approximation error, so its derivative is its slope \(s\).) Moreover \(\psi(a) = 0\) and \(\psi(b) = f(b) - f(a) - s(b-a) = 0\). By Theorem 9.2 there is a \(c \in (a,b)\) with \(\psi'(c) = 0\), that is, \(f'(c) = s\). \(\square\)

In the language of differentials, the theorem says that some \(df_c\) gets the total change exactly right: \(f(b) - f(a) = df_c(b-a)\). It does not say where \(c\) is, or that \(c\) is unique. It says only that such a point exists, much as the Intermediate Value Theorem says a root exists without locating it.

Example 4. For \(f(x) = x^2 - 4x + 1\) on \([1,4]\), the secant slope is \(\frac{f(4) - f(1)}{3} = \frac{1 - (-2)}{3} = 1\). Since \(f'(x) = 2x - 4\), the point guaranteed by the theorem solves \(2c - 4 = 1\), so \(c = \tfrac52 \in (1, 4)\).

9.4.1 What the Theorem Does Not Say

Each hypothesis is needed. Rolle’s theorem fails for \(|x|\) on \([-1,1]\): the endpoint values agree and no point has a horizontal tangent, because the derivative fails to exist at the one place it could vanish. Continuity at the endpoints cannot be dropped either. Let \(f(x) = 0\) on \([0,1)\) and \(f(1) = 1\). Then \(f'(x) = 0\) at every point of \((0,1)\), yet \(f(1) - f(0) = 1\).

9.4.2 Consequences

A function whose derivative vanishes is constant, and a bound on the derivative is a bound on the Lipschitz constant. The second is the bridge promised at the end of the previous chapter.

Corollary 9.1 (Zero Derivative Means Constant) If \(f\) is continuous on \([a,b]\), differentiable on \((a,b)\), and \(f'(x) = 0\) for all \(x \in (a,b)\), then \(f\) is constant on \([a,b]\).

For \(x \in (a,b]\), Theorem 9.3 on \([a,x]\) gives \(f(x) - f(a) = f'(c)(x - a) = 0\). \(\square\)

Corollary 9.2 (Bounded Derivative Means Lipschitz) If \(f\) is continuous on \([a,b]\), differentiable on \((a,b)\), and \(|f'(x)| \le M\) on \((a,b)\), then \(f\) is Lipschitz on \([a,b]\) with constant \(M\): \[ |f(x) - f(y)| \le M|x - y| \qquad \text{for all } x, y \in [a,b]. \]

For \(x < y\), apply Theorem 9.3 on \([x,y]\): \(|f(y) - f(x)| = |f'(c)|\,(y - x) \le M|y - x|\). \(\square\)

This explains the examples of the previous chapter. For \(x^2\) on \([-R,R]\) the derivative \(2x\) is bounded by \(2R\), which is the Lipschitz constant we found by hand. On \(\mathbb{R}\) the derivative is unbounded and no Lipschitz constant exists. And \(\sqrt{x}\) has derivative \(\frac{1}{2\sqrt x}\), unbounded near \(0\), so there is no Lipschitz constant on \([0,1]\) either.

9.5 Where This Leads

We now have the definition, a way to compute with it (the difference quotient), and a first theorem with consequences (the Mean Value Theorem). What we lack is speed: computing a derivative from the definition requires a limit every time. The next chapter fixes this. Linear approximations of sums and products are built from linear approximations of the pieces, and the linear approximation of a composition is the composition of the linear approximations (Theorem 8.3). On the line that composition is a product of numbers, which is the chain rule.

TipKey Ideas
  • “The error is small” is not a useful requirement: for any \(f\) continuous at \(a\), every linear map has error tending to \(0\). The right requirement is that the error be small compared with the displacement.
  • \(f\) is differentiable at \(a\) if \(f(a+h) = f(a) + T(h) + o(h)\) for a linear \(T\). The map \(T\) is unique, and \(T(h) = f'(a)h\).
  • In one dimension this is equivalent to the existence of the limit of the difference quotient. The approximation form is the one that survives for several variables.
  • Differentiability at \(a\) implies continuity at \(a\) (indeed a local Lipschitz bound at \(a\)). The converse fails: \(|x|\) at \(0\).
  • The tangent line is not a linear map, but its slope is the coefficient of one.
  • Rolle’s theorem and the Mean Value Theorem pass from small to finite displacements. A zero derivative means constant, and a bounded derivative means Lipschitz.

True or false: if \(f\) is continuous at \(a\), then \(f(a+h) - f(a) - T(h) \to 0\) for every linear map \(T\), but at most one linear map \(T\) satisfies the definition of differentiability.

Quick Check: By the Mean Value Theorem, \(f(x) = x^2 - 4x + 1\) on \([1,4]\) has a point \(c\) with \(f'(c) = \;\)? (the secant slope)

  1. Let \(f(x) = x^3\) and \(a = 2\).

    1. Compute \(f'(2)\) from the difference quotient, and write the error \(E(h) = f(2+h) - f(2) - 12h\) explicitly.

    2. Write the equation of the tangent line at \((2, 8)\), use it to estimate \(f(2.1)\), and compare with the true value.

    3. Show that \(T(h) = 11h\) does not satisfy the definition at \(a = 2\).

  2. Let \(g(x) = \sqrt{x}\).

    1. Show that \(g'(a) = \dfrac{1}{2\sqrt a}\) for \(a > 0\). (Hint: multiply by the conjugate.)

    2. Show that \(g\) is not differentiable at \(0\). Where in the definition does it fail?

    3. Use Corollary 9.2 and part (a) to show that \(\sqrt x\) is Lipschitz on \([1,\infty)\) with constant \(\tfrac12\). Compare with Problem 7(c) of the previous chapter.

  3. Differentiability at a point.

    1. Show that \(f(x) = x|x|\) is differentiable at \(0\) with \(f'(0) = 0\).

    2. Suppose \(f\) is differentiable at \(a\) and \(f'(a) > 0\). Show there is a \(\delta > 0\) such that \(f(a+h) > f(a)\) for \(0 < h < \delta\) and \(f(a+h) < f(a)\) for \(-\delta < h < 0\).

    3. Does (b) show that \(f\) is increasing on \((a - \delta, a + \delta)\)? Explain.

  4. Extrema and the Mean Value Theorem.

    1. Fermat’s theorem. Let \(f\) have a local maximum at an interior point \(c\) and be differentiable at \(c\). Show that \(f'(c) = 0\). (Compare the one-sided difference quotients, as in the proof of Theorem 9.2.) Show by example that the converse is false.

    2. Find the point \(c\) guaranteed by Theorem 9.3 for \(f(x) = x^3\) on \([0, 2]\).

    3. Show that if \(f' = g'\) on \((a,b)\) and \(f, g\) are continuous on \([a,b]\), then \(f - g\) is constant.

    4. Show that if \(f'(x) > 0\) for all \(x \in (a,b)\), then \(f\) is strictly increasing on \([a,b]\).

    5. Explain why Rolle’s theorem does not apply to \(f(x) = |x|\) on \([-1,1]\), and why this does not contradict the theorem.

    1. \(\dfrac{(2+h)^3 - 8}{h} = \dfrac{12h + 6h^2 + h^3}{h} = 12 + 6h + h^2 \to 12\). The error is \(E(h) = 6h^2 + h^3\), and \(E(h)/h = 6h + h^2 \to 0\).

    2. The tangent line is \(y - 8 = 12(x - 2)\), i.e. \(y = 12x - 16\). At \(x = 2.1\) it gives \(9.2\). The true value is \(2.1^3 = 9.261\), so the error is \(0.061 = 6(0.1)^2 + (0.1)^3\), matching part (a).

    3. With \(T(h) = 11h\) the error is \(E(h) = h + 6h^2 + h^3\), so \(|E(h)|/|h| = |1 + 6h + h^2| \to 1 \ne 0\).

    1. \(\dfrac{\sqrt{a+h} - \sqrt a}{h} = \dfrac{1}{\sqrt{a+h} + \sqrt a} \to \dfrac{1}{2\sqrt a}\).

    2. For \(h > 0\), \(\dfrac{\sqrt h - 0}{h} = \dfrac{1}{\sqrt h} \to \infty\), so the difference quotient has no limit. (For \(h < 0\) the function is not defined, so \(0\) is not an interior point of the domain either.) The error cannot be \(o(h)\) for any \(m\), because \(\sqrt h\) is much larger than \(h\) for small \(h\).

    3. For \(x \ge 1\), \(0 < g'(x) = \frac{1}{2\sqrt x} \le \frac12\). By Corollary 9.2 on \([x,y] \subset [1,\infty)\), \(|\sqrt x - \sqrt y| \le \frac12|x - y|\).

    1. \(\dfrac{|h|h| - 0 - 0\cdot h|}{|h|} = |h| \to 0\).

    2. The difference quotient \(\frac{f(a+h) - f(a)}{h}\) tends to \(f'(a) > 0\), so there is a \(\delta > 0\) for which it is positive whenever \(0 < |h| < \delta\). For \(h > 0\) this says \(f(a+h) > f(a)\). For \(h < 0\) the denominator is negative, so the numerator must be negative: \(f(a+h) < f(a)\).

    3. No. Part (b) compares \(f\) only with the single value \(f(a)\). The function \(f(x) = x + 2x^2\sin(1/x)\) with \(f(0) = 0\) has \(f'(0) = 1 > 0\) but is not increasing on any neighborhood of \(0\), since its derivative takes negative values arbitrarily close to \(0\). (Verifying this needs the product and chain rules of the next chapter.)

    1. For small \(h > 0\), \(f(c+h) \le f(c)\) gives a quotient \(\le 0\), so \(f'(c) \le 0\). For small \(h < 0\) the numerator is \(\le 0\) and the denominator negative, so the quotient is \(\ge 0\) and \(f'(c) \ge 0\). Hence \(f'(c) = 0\). The converse fails: \(f(x) = x^3\) has \(f'(0) = 0\) but no extremum at \(0\).

    2. The secant slope is \(\frac{8 - 0}{2} = 4\), and \(f'(c) = 3c^2 = 4\) gives \(c = \frac{2}{\sqrt 3} \approx 1.155 \in (0,2)\).

    3. \((f - g)' = f' - g' = 0\) on \((a,b)\), so Corollary 9.1 applies to \(f - g\).

    4. For \(a \le x < y \le b\), Theorem 9.3 gives \(f(y) - f(x) = f'(c)(y - x) > 0\).

    5. The function \(|x|\) is continuous on \([-1,1]\) with \(f(-1) = f(1)\), but it is not differentiable at \(0\), so the hypothesis “differentiable on \((-1,1)\)” fails. The conclusion fails too: \(f'(x) = \pm 1\) wherever it exists. This is consistent with the theorem, which says nothing when a hypothesis is violated.