10  Derivative Rules

The previous chapter defined the derivative and computed a few of them from the definition. Each one needed its own limit, and the algebra grows quickly: try \((x^2+1)^3\) with a difference quotient. This chapter shows that nothing has to be recomputed. The derivative of a combination of functions is determined by the values and derivatives of the pieces.

The reason this is possible is that the error term in a linear approximation is robust. Add two errors that are negligible next to \(h\) and the sum is still negligible. Multiply by a constant and it is still negligible. Multiply two of them and the result is smaller still. Every rule below is this observation applied to a different combination, so we begin by stating it.

10.1 Arithmetic of \(o(h)\)

We say \(r(h) = o(h)\) if \(r(h)/|h| \to 0\) as \(h \to 0\). In particular \(r(h) \to 0\).

Lemma 10.1 (Arithmetic of \(o(h)\)) Let \(r(h) = o(h)\) and \(s(h) = o(h)\).

  1. \(r + s\) and \(cr\) are \(o(h)\) for every constant \(c\).
  2. If \(q\) is bounded near \(0\), then \(q\,r\) is \(o(h)\). In particular \(h\,r(h) = o(h)\).
  3. \(r\,s\) is \(o(h)\).
  4. \(h^2 = o(h)\).
  1. is the sum and constant-multiple laws for limits applied to \(r/|h|\) and \(s/|h|\). For (2), \(|q\,r|/|h| \le M\,|r|/|h| \to 0\) if \(|q| \le M\). For (3), \(|rs|/|h| = \dfrac{|r|}{|h|}\,|s| \to 0 \cdot 0\), since \(s \to 0\). For (4), \(h^2/|h| = |h| \to 0\). \(\square\)

Informally: \(o(h)\) absorbs sums, constants and bounded factors, and a product of two of them is negligible. Everything that is not \(o(h)\) in a first-order expansion is a multiple of \(h\), which the previous chapter showed is determined uniquely (Proposition 9.1). So to differentiate a combination of functions we expand each piece to first order, multiply or add, and read off the coefficient of \(h\).

10.2 Sums and Constant Multiples

Theorem 10.1 (Linearity of the Derivative) If \(f\) and \(g\) are differentiable at \(a\) and \(\alpha, \beta \in \mathbb{R}\), then \(\alpha f + \beta g\) is differentiable at \(a\) and \[ (\alpha f + \beta g)'(a) = \alpha\,f'(a) + \beta\,g'(a). \]

Write \(f(a+h) = f(a) + f'(a)h + r_f(h)\) and \(g(a+h) = g(a) + g'(a)h + r_g(h)\) with \(r_f, r_g = o(h)\). Then \[ (\alpha f + \beta g)(a+h) = (\alpha f + \beta g)(a) + \big(\alpha f'(a) + \beta g'(a)\big)h + \big(\alpha\,r_f(h) + \beta\,r_g(h)\big), \] and the last bracket is \(o(h)\) by Lemma 10.1. By Proposition 9.1 the coefficient of \(h\) is the derivative. \(\square\)

The sum rule is \(\alpha = \beta = 1\), the difference rule is \(\alpha = 1, \beta = -1\), and the constant-multiple rule is \(\beta = 0\). We also record two derivatives that need no computation: a constant function has \(f(a+h) - f(a) = 0\), so its derivative is \(0\), and \(f(x) = x\) has \(f(a+h) = a + 1\cdot h\), so its derivative is \(1\). In both cases the error is exactly zero.

Sum rule

10.3 The Product Rule

A product is not linear in the pair \((f,g)\), so we should not expect \((fg)' = f'g'\). A test with \(f = g = x\) settles it: \((x\cdot x)' = 2x\), while \(f'g' = 1\).

The right guess comes from a picture. Let \(f\) and \(g\) be the side lengths of a rectangle. When both sides change by \(\Delta f\) and \(\Delta g\), the area changes by three pieces: \[ (f + \Delta f)(g + \Delta g) - fg = g\,\Delta f + f\,\Delta g + \Delta f\,\Delta g. \]

A blue rectangle with sides f(a) and g(a). A green strip of width Delta f is attached on its right side, an orange strip of height Delta g on top, and a small red square of size Delta f by Delta g in the corner.

The first two pieces are proportional to \(h\) when \(\Delta f \approx f'(a)h\) and \(\Delta g \approx g'(a)h\). The corner piece is a product of two quantities that are each proportional to \(h\), so it is proportional to \(h^2\) and invisible at first order.

Theorem 10.2 (Product Rule) If \(f\) and \(g\) are differentiable at \(a\), then \(fg\) is differentiable at \(a\) and \[ (fg)'(a) = f'(a)\,g(a) + f(a)\,g'(a). \]

Write \(f(a+h) = f(a) + f'(a)h + r_f(h)\) and \(g(a+h) = g(a) + g'(a)h + r_g(h)\). Multiplying out, \[ (fg)(a+h) = f(a)g(a) + \big[f'(a)g(a) + f(a)g'(a)\big]h + R(h), \] where \[ R(h) = f'(a)g'(a)\,h^2 + f(a)\,r_g(h) + g(a)\,r_f(h) + f'(a)\,h\,r_g(h) + g'(a)\,h\,r_f(h) + r_f(h)\,r_g(h). \] By Lemma 10.1, the first term is \(o(h)\) by (4), the next two by (1), the next two by (2), and the last by (3). So \(R(h) = o(h)\) and the coefficient of \(h\) is \((fg)'(a)\). \(\square\)

Product rule

Example 1. Let \(f(x) = x^2 + 1\) and \(g(x) = x^3\) at \(a = 1\). Here \(f(1) = 2\), \(f'(1) = 2\), \(g(1) = 1\), \(g'(1) = 3\), so \[ (fg)'(1) = 2\cdot 1 + 2 \cdot 3 = 8. \] As a check, \((fg)(x) = x^5 + x^3\), so \((fg)(1+h) = 2 + 8h + 13h^2 + 11h^3 + 5h^4 + h^5\). The coefficient of \(h\) is \(8\) and the rest is \(o(h)\).

The product rule gives the derivative of every power.

Corollary 10.1 (Power Rule) For every integer \(n \ge 1\), \((x^n)' = n x^{n-1}\).

For \(n = 1\) this is the derivative of \(x\). If it holds for \(n\), then \(x^{n+1} = x \cdot x^n\) and Theorem 10.2 gives \((x^{n+1})' = 1\cdot x^n + x\cdot n x^{n-1} = (n+1)x^n\). \(\square\)

With Theorem 10.1, every polynomial can now be differentiated term by term.

10.4 The Chain Rule

Suppose \(y\) depends on \(x\) and \(z\) depends on \(y\). If \(y\) changes \(3\) units for each unit of \(x\), and \(z\) changes \(2\) units for each unit of \(y\), then \(z\) changes \(6\) units for each unit of \(x\). In terms of linear maps on the line, this is Theorem 8.3: the composition of \(x \mapsto 3x\) and \(y \mapsto 2y\) is \(x \mapsto 6x\).

The chain rule says that the same holds to first order for functions that are not linear, provided each rate is measured at the right point: the rate of the outer function is taken at \(g(a)\), the rate of the inner one at \(a\).

Theorem 10.3 (Chain Rule) Let \(g\) be differentiable at \(a\) and \(f\) differentiable at \(g(a)\). Then \(f \circ g\) is differentiable at \(a\) and \[ (f \circ g)'(a) = f'(g(a))\,g'(a). \]

What goes wrong with the obvious proof. The natural attempt is to write \[ \frac{f(g(x)) - f(g(a))}{x - a} = \frac{f(g(x)) - f(g(a))}{g(x) - g(a)}\cdot\frac{g(x) - g(a)}{x - a}, \] and let \(x \to a\) in each factor. The trouble is that \(g(x) - g(a)\) can vanish at points \(x \ne a\) arbitrarily close to \(a\) (Problem 4(c) gives an example), and then the first factor is \(0/0\). The approximation form of the definition avoids the division.

Let \(b = g(a)\) and \(k(h) = g(a+h) - g(a) = g'(a)h + r_g(h)\). Write \[ f(b + k) = f(b) + f'(b)\,k + r_f(k), \] where \(r_f(k)/|k| \to 0\) as \(k \to 0\). To avoid dividing by \(k = 0\), define \(\varepsilon(k) = r_f(k)/|k|\) for \(k \ne 0\) and \(\varepsilon(0) = 0\). Then \(\varepsilon(k) \to 0\) as \(k \to 0\), and \(r_f(k) = |k|\,\varepsilon(k)\) for all \(k\).

Substituting \(k = k(h)\), \[ f(g(a+h)) = f(g(a)) + f'(b)\,g'(a)\,h + f'(b)\,r_g(h) + |k(h)|\,\varepsilon(k(h)). \] The term \(f'(b)\,r_g(h)\) is \(o(h)\). For the last term, the proof of Theorem 9.1 gives \(|k(h)| \le C|h|\) for small \(h\), with \(C = |g'(a)| + 1\), and \(k(h) \to 0\). Hence \[ \frac{|k(h)|\,|\varepsilon(k(h))|}{|h|} \le C\,|\varepsilon(k(h))| \to 0. \] So the coefficient of \(h\) is \(f'(g(a))\,g'(a)\). \(\square\)

The chain rule

Example 2. Let \(f(y) = y^3\) and \(g(x) = x^2 + 1\), so \((f\circ g)(x) = (x^2+1)^3\). At \(a = 1\): \(g(1) = 2\), \(g'(1) = 2\), \(f'(2) = 3\cdot 2^2 = 12\), and \[ (f\circ g)'(1) = 12 \cdot 2 = 24. \] As a check, \((x^2+1)^3 = x^6 + 3x^4 + 3x^2 + 1\) has derivative \(6x^5 + 12x^3 + 6x\), which equals \(24\) at \(x = 1\).

10.5 Reciprocals and Quotients

Proposition 10.1 (Derivative of the Reciprocal) For \(a \ne 0\), the function \(\phi(x) = 1/x\) has \(\phi'(a) = -1/a^2\).

For \(a \neq 0\) and small \(h\), \[ \frac{\frac{1}{a+h} - \frac1a}{h} = \frac{a - (a+h)}{h\,a(a+h)} = \frac{-1}{a(a+h)} \to -\frac{1}{a^2}. \qquad \square \]

Theorem 10.4 (Quotient Rule) If \(f\) and \(g\) are differentiable at \(a\) and \(g(a) \ne 0\), then \(f/g\) is differentiable at \(a\) and \[ \left(\frac{f}{g}\right)'(a) = \frac{f'(a)\,g(a) - f(a)\,g'(a)}{g(a)^2}. \]

Since \(g\) is continuous at \(a\) (Theorem 9.1) and \(g(a) \ne 0\), we have \(g \ne 0\) near \(a\), so \(1/g = \phi \circ g\) is defined near \(a\). By Theorem 10.3 and Proposition 10.1, \((1/g)'(a) = -g'(a)/g(a)^2\). Now apply Theorem 10.2 to \(f \cdot (1/g)\): \[ \left(\frac fg\right)'(a) = \frac{f'(a)}{g(a)} - \frac{f(a)\,g'(a)}{g(a)^2} = \frac{f'(a)\,g(a) - f(a)\,g'(a)}{g(a)^2}. \qquad \square \]

Quotient rule

Example 3. Let \(F(x) = \dfrac{x^2}{x+1}\) at \(a = 1\). With \(f = x^2\) and \(g = x + 1\): \(f(1) = 1\), \(f'(1) = 2\), \(g(1) = 2\), \(g'(1) = 1\), so \[ F'(1) = \frac{2\cdot 2 - 1\cdot 1}{4} = \frac34. \] As a check, \(F(1.01) = 1.0201/2.01 \approx 0.50751\) and \(F(1) = 0.5\), so the difference quotient with \(h = 0.01\) is about \(0.751\).

The reciprocal rule extends the power rule to negative integers: for \(n \ge 1\), \(x^{-n} = \phi(x^n)\), so by the chain rule \((x^{-n})' = -\dfrac{1}{x^{2n}}\cdot n x^{n-1} = -n\,x^{-n-1}\).

10.6 The Rules as Statements About Linear Maps

We worked with the number \(f'(a)\) throughout. In the notation of the previous chapter, where \(df_a(h) = f'(a)h\), the rules read \[ d(\alpha f + \beta g)_a = \alpha\,df_a + \beta\,dg_a, \qquad d(fg)_a = g(a)\,df_a + f(a)\,dg_a, \qquad d(f \circ g)_a = df_{g(a)} \circ dg_a. \] In one variable this is only a change of notation. It matters in several variables, for two reasons.

The chain rule is composition. The last formula says that the best linear approximation of a composition is the composition of the best linear approximations, which is the statement Theorem 8.3 set up. On the line, composing multiplications by numbers is multiplying the numbers, and the order is irrelevant. For maps of the plane the derivative at a point is a \(2\times 2\) matrix, composition is matrix multiplication, and by Example 3 of the vector-space chapter the order matters. The proof of Theorem 10.3 carries over with norms in place of absolute values, once we know that a linear map satisfies \(\|T(h)\| \le C\|h\|\) (Proposition 8.2 is the case of a functional).

The product rule linearizes a bilinear map. The map \((x, y) \mapsto xy\) is linear in each variable separately but not in both at once. Its best linear approximation at \((p, q)\) is \((u, v) \mapsto q\,u + p\,v\), and the discarded term is \(uv\), which is second order. Applying the chain rule to \(t \mapsto (f(t), g(t)) \mapsto f(t)g(t)\) gives the product rule. This is the same computation as the rectangle picture.

10.7 Where This Leads

With linearity, the product, quotient and chain rules and the power rule, we can differentiate every rational function and every algebraic combination of them. What we cannot yet differentiate are functions defined by other means: the exponential, the logarithm, and the trigonometric functions. The next chapter defines them and computes their derivatives. The rules of this chapter then apply to every combination of them without further work.

TipKey Ideas
  • The error term in a linear approximation is robust: \(o(h)\) is preserved by sums, constant multiples, bounded factors, and products with other \(o(h)\) terms.
  • Every rule is proved by expanding each function to first order, combining the expansions, and reading off the coefficient of \(h\). That coefficient is the derivative, by uniqueness.
  • Differentiation is linear. The product rule is not \(f'g'\): the cross term is second order, and what survives is \(f'g + fg'\).
  • The chain rule says rates multiply, with the outer rate taken at \(g(a)\). The obvious proof fails when \(g(x) = g(a)\) near \(a\), and the approximation form avoids the problem.
  • The quotient rule follows from the product rule and the chain rule applied to \(1/x\).
  • In several variables the rules keep the same form, but the derivative is a matrix, composition is matrix multiplication, and order matters.

True or false: the derivative of a product \(fg\) is \(f'g'\).

The chain rule states that \(\frac{d}{dx}\big[f(g(x))\big]\) equals:

Quick Check: If \(h(x) = x^2(x+3)\), then \(h'(1) = \;\)?

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

    1. Compute \((fg)'(1)\) with the product rule, and verify directly that \((fg)(1+h) - (fg)(1) - (fg)'(1)\,h\) is \(o(h)\).

    2. Compute \((f \circ g)'(1)\) with the chain rule, and check it against \((f\circ g)(x) = x^6 + 1\).

  2. Power rule.

    1. Prove \((x^n)' = n x^{n-1}\) for \(n \ge 1\) by induction, as in Corollary 10.1.

    2. Prove that \((x^{-n})' = -n x^{-n-1}\) for \(n \ge 1\) and \(x \ne 0\).

  3. Differentiate each function where it is defined.

    1. \(\dfrac{x^2 + 1}{x - 2}\)

    2. \((3x^2 - x)^4\)

    3. \(\dfrac{1}{(1 + x^2)^2}\)

    4. \(\sqrt{1 + x^2}\) (use \((\sqrt{y})' = \frac{1}{2\sqrt y}\) from Problem 2 of the previous chapter)

  4. Extensions and pitfalls.

    1. Show that if \(f, g, k\) are differentiable at \(a\), then \((fgk)'(a) = f'gk + fg'k + fgk'\), all evaluated at \(a\).

    2. Show that if \(f(a) = g(a) = 0\) and both are differentiable at \(a\), then \((fg)'(a) = 0\). Check with \(f = g = x\) at \(a = 0\).

    3. Let \(g(x) = x^2\sin(1/x)\) for \(x \ne 0\) and \(g(0) = 0\). Show that there are points \(x_n \ne 0\) with \(x_n \to 0\) and \(g(x_n) = g(0)\). Explain why this breaks the “multiply and divide by \(g(x) - g(a)\)” proof of the chain rule.

    1. \(f(1) = 2\), \(f'(1) = 2\), \(g(1) = 1\), \(g'(1) = 3\), so \((fg)'(1) = f'(1)g(1) + f(1)g'(1) = 2 + 6 = 8\). Since \((fg)(x) = x^5 + x^3\), \[ (fg)(1+h) = 2 + 8h + 13h^2 + 11h^3 + 5h^4 + h^5, \] so the error is \(13h^2 + 11h^3 + 5h^4 + h^5\), and dividing by \(|h|\) gives something that tends to \(0\).

    2. \((f\circ g)'(1) = f'(g(1))\,g'(1) = f'(1)\cdot 3 = 6\). Directly, \((f \circ g)(x) = x^6 + 1\) has derivative \(6x^5\), which is \(6\) at \(x = 1\).

    1. For \(n = 1\), \((x)' = 1\). If \((x^n)' = nx^{n-1}\), then \((x^{n+1})' = (x\cdot x^n)' = x^n + x\cdot nx^{n-1} = (n+1)x^n\).

    2. With \(\phi(y) = 1/y\), \(x^{-n} = \phi(x^n)\). By the chain rule, \((x^{-n})' = \phi'(x^n)\cdot n x^{n-1} = -x^{-2n}\cdot nx^{n-1} = -n x^{-n-1}\).

    1. \(\dfrac{2x(x-2) - (x^2+1)\cdot 1}{(x-2)^2} = \dfrac{x^2 - 4x - 1}{(x-2)^2}\) for \(x \ne 2\).

    2. \(4(3x^2 - x)^3(6x - 1)\).

    3. Let \(u = (1+x^2)^2\). By the chain rule \(u' = 2(1+x^2)\cdot 2x = 4x(1+x^2)\). By the reciprocal rule \((1/u)' = -u'/u^2 = -\dfrac{4x(1+x^2)}{(1+x^2)^4} = -\dfrac{4x}{(1+x^2)^3}\).

    4. The outer function is \(\sqrt y\) at \(y = 1 + x^2 > 0\), so the derivative is \(\dfrac{1}{2\sqrt{1+x^2}}\cdot 2x = \dfrac{x}{\sqrt{1+x^2}}\).

    1. Apply the product rule to \((fg)\cdot k\): \((fgk)' = (fg)'k + fg\,k' = f'gk + fg'k + fgk'\).

    2. \((fg)'(a) = f'(a)g(a) + f(a)g'(a) = 0 + 0 = 0\). For \(f = g = x\) at \(0\): \((x^2)' = 2x\), which is \(0\) at \(x = 0\).

    3. Take \(x_n = \dfrac{1}{n\pi}\). Then \(\sin(1/x_n) = \sin(n\pi) = 0\), so \(g(x_n) = 0 = g(0)\), and \(x_n \to 0\) with \(x_n \ne 0\). At \(x = x_n\) the factor \(g(x) - g(a)\) is \(0\), so the proof divides by zero at points arbitrarily close to \(a = 0\), and the quotient \(\frac{f(g(x)) - f(g(a))}{g(x) - g(a)}\) is not defined there.