5.3 Differentiation laws

When studying computational calculus, you will likely have learned useful rules for differentiating sums, products, quotients and compositions of functions. One example is the product rule (fg)=fg+fg(fg)^{\prime}=f^{\prime}g+fg^{\prime} and another is the chain rule (gf)=(gf)f(g\circ f)^{\prime}=(g^{\prime}\circ f)f^{\prime}. However, can you explain where these rules come from and why they hold? In this section, we revisit these computational tools and show that they all inexorably follow from the notion of a derivative introduced in Definition 5.2.


Theorem 5.24.

Let II\subseteq\mathbb{R} be an open interval, ff, g:Ig\colon I\to\mathbb{R} be differentiable at aIa\in I.

  1. 1

    Linearity. The function λf\lambda f for λ\lambda\in\mathbb{R} and f+g:If+g\colon I\to\mathbb{R} are differentiable at aa, with

    (λf)(a)=λf(a)and(f+g)(a)=f(a)+g(a).(\lambda f)^{\prime}(a)=\lambda f^{\prime}(a)\qquad\text{and}\qquad(f+g)^{% \prime}(a)=f^{\prime}(a)+g^{\prime}(a).
  2. 2

    Leibniz/product rule. The function fg:If\cdot g\colon I\to\mathbb{R} is differentiable at aa and

    (fg)(a)=f(a)g(a)+f(a)g(a).(f\cdot g)^{\prime}(a)=f^{\prime}(a)g(a)+f(a)g^{\prime}(a).
  3. 3

    Quotient rule. Provided g(x)0g(x)\neq 0 for all xIx\in I, the function (f/g):I(f/g)\colon I\to\mathbb{R} is differentiable at aa and

    (f/g)(a)=f(a)g(a)f(a)g(a)g(a)2.\big{(}f/g\big{)}^{\prime}(a)=\frac{f^{\prime}(a)g(a)-f(a)g^{\prime}(a)}{g(a)^% {2}}.
Proof.

We only prove part (b); the remaining parts are left as exercises (see Exercise 5.25 and Worksheet 9).

By Lemma 5.21, there exist functions FF, G:IG\colon I\to\mathbb{R} that are continuous at aa with F(a)=f(a)F(a)=f^{\prime}(a) and G(a)=g(a)G(a)=g^{\prime}(a) and satisfy

(5.10) (5.10) f(x)=F(x)(xa)+f(a)andg(x)=G(x)(xa)+g(a)for all xI.f(x)=F(x)(x-a)+f(a)\qquad\text{and}\qquad g(x)=G(x)(x-a)+g(a)\qquad\text{for % all $x\in I$.}

By substituting the formulæ  from (5.10) into f(x)g(x)f(x)g(x) and expanding out the resulting product,

f(x)g(x)=H(x)(xa)+f(a)g(a)f(x)g(x)=H(x)(x-a)+f(a)g(a)

where

(5.11) (5.11) H(x):=F(x)g(a)+f(a)G(x)+F(x)G(x)(xa)for all xI.H(x):=F(x)g(a)+f(a)G(x)+F(x)G(x)(x-a)\quad\text{for all $x\in I$.}

By the continuity laws from Corollary 4.51, the function H:IH\colon I\to\mathbb{R} is continuous at aa. It therefore follows that

(fg)(a)=limxaf(x)g(x)f(a)g(a)xa=limxaH(x)=H(a).(fg)^{\prime}(a)=\lim_{x\to a}\frac{f(x)g(x)-f(a)g(a)}{x-a}=\lim_{x\to a}H(x)=% H(a).

However, using the definition of HH from (5.11) and the fact that F(a)=f(a)F(a)=f^{\prime}(a) and G(a)=g(a)G(a)=g^{\prime}(a), we see that H(a)=f(a)g(a)+f(a)g(a)H(a)=f^{\prime}(a)g(a)+f(a)g^{\prime}(a). Combining these observations concludes the proof. ∎

Exercise 5.25.

Prove Theorem 5.24 1) by arguing from the definition of the derivative.

Example 5.26 (Polynomials).

Let p:p\colon\mathbb{R}\to\mathbb{R} be a polynomial function, so that there exists some dd\in\mathbb{N} and coefficients c0c_{0}, c1c_{1}, \dots, cdc_{d}\in\mathbb{R} such that

p(x):=cdxd+cd1xd1++c1x+c0for all x.p(x):=c_{d}x^{d}+c_{d-1}x^{d-1}+\cdots+c_{1}x+c_{0}\qquad\text{for all $x\in% \mathbb{R}$.}

By Example 5.11 and the linearity of the derivative, it follows that pp is differentiable and

p(x):=cddxd1+cd1(d2)xd2++c1for all x.p^{\prime}(x):=c_{d}dx^{d-1}+c_{d-1}(d-2)x^{d-2}+\cdots+c_{1}\qquad\text{for % all $x\in\mathbb{R}$.}
Example 5.27 (More trigonometric functions).

The function tan:(π/2,π/2)\tan\colon(-\pi/2,\pi/2)\to\mathbb{R} is differentiable with tan(x)=1/cos2(x)\tan^{\prime}(x)=1/\cos^{2}(x) for all x(π/2,π/2)x\in(-\pi/2,\pi/2). To see this, we apply the quotient rule to the definition of tan:=sin/cos\tan:=\sin/\cos. Since both sin\sin and cos\cos are differentiable and cos\cos is non-vanishing on (π/2,π/2)(-\pi/2,\pi/2), this tells us that tan\tan is differentiable and

tan(x)=sin(x)cos(x)sin(x)cos(x)cos2(x)=cos(x)cos(x)+sin(x)sin(x)cos2(x)=1cos2(x)\tan^{\prime}(x)=\frac{\sin^{\prime}(x)\cos(x)-\sin(x)\cos^{\prime}(x)}{\cos^{% 2}(x)}=\frac{\cos(x)\cos(x)+\sin(x)\sin(x)}{\cos^{2}(x)}=\frac{1}{\cos^{2}(x)}

for all x(π/2,π/2)x\in(-\pi/2,\pi/2), where we have used Example 5.13 and the identity sin2(x)+cos2(x)=1\sin^{2}(x)+\cos^{2}(x)=1.

Theorem 5.28 (Chain Rule).

Let II, JJ\subseteq\mathbb{R} be open intervals, f:IJf\colon I\to J be differentiable at aIa\in I and g:Jg\colon J\to\mathbb{R} be differentiable at f(a)Jf(a)\in J. Then gfg\circ f is differentiable at aa and

(gf)(a)=g(f(a))f(a).(g\circ f)^{\prime}(a)=g^{\prime}(f(a))f^{\prime}(a).
Proof.

By Lemma 5.21, there exists a function F:IF\colon I\to\mathbb{R} which is continuous at aa with F(a)=f(a)F(a)=f^{\prime}(a) and a function G:JG\colon J\to\mathbb{R} which is continuous at f(a)f(a) with G(f(a))=g(f(a))G(f(a))=g^{\prime}(f(a)) which satisfy

(5.12) (5.12) f(x)=F(x)(xa)+f(a)andg(y)=G(y)(yf(a))+g(f(a))for all xIyJ.f(x)=F(x)(x-a)+f(a)\quad\text{and}\qquad g(y)=G(y)(y-f(a))+g(f(a))\qquad\text{% for all $x\in I$, $y\in J$.}

By applying the formulæ  (5.12) to (gf)(x)=g(f(x))(g\circ f)(x)=g(f(x)) with y=f(x)y=f(x), we have

(gf)(x)\displaystyle(g\circ f)(x) =G(y)(yf(a)+g(f(a))\displaystyle=G(y)(y-f(a)+g(f(a))
=G(f(x))(f(x)f(a))+g(f(a))\displaystyle=G(f(x))(f(x)-f(a))+g(f(a))
=H(x)(xa)+(gf)(a),\displaystyle=H(x)(x-a)+(g\circ f)(a),

where

(5.13) (5.13) H(x):=G(f(x))F(x)for all xI.H(x):=G(f(x))F(x)\qquad\text{for all $x\in I$.}

By the continuity laws, H:IH\colon I\to\mathbb{R} is continuous at aa. It therefore follows that

(gf)(a)=limxa(gf)(x)(gf)(a)xa=limxaH(x)=H(a)(g\circ f)^{\prime}(a)=\lim_{x\to a}\frac{(g\circ f)(x)-(g\circ f)(a)}{x-a}=% \lim_{x\to a}H(x)=H(a)

However, using the definition of HH from (5.13) and the fact that F(a)=f(a)F(a)=f^{\prime}(a) and G(f(a))=g(f(a))G(f(a))=g^{\prime}(f(a)), we see that H(a)=f(a)g(f(a))H(a)=f^{\prime}(a)g^{\prime}(f(a)). Combining these observations concludes the proof. ∎

Figure 5.8: The function f:f\colon\mathbb{R}\to\mathbb{R} defined in (5.14) is differentiable, but ff^{\prime} is not continuous at 0. You can zoom in using an interactive version of this graph at https://www.desmos.com/calculator/or4d5tqvtz.

We can use the chain rule and the other laws for differentiation to analyse the following example, which exhibits some interesting behaviour.


Example 5.29.

Consider function f:f\colon\mathbb{R}\to\mathbb{R} given by

(5.14) (5.14) f(x):={x2sin(1/x)if x0,0if x=0;f(x):=\begin{cases}x^{2}\sin(1/x)&\text{if $x\neq 0$,}\\ 0&\text{if $x=0$;}\end{cases}

see Figure 5.8. Then ff is differentiable but its derivative ff^{\prime} is not continuous.

Proof.

By the rules for differentiation, the function ff is differentiable11 1 Strictly speaking, we only defined differentiability for functions defined on an open interval II and {0}\mathbb{R}\setminus\{0\} is not an interval. Here, when we say ff is differentiable on {0}=(,0)(0,)\mathbb{R}\setminus\{0\}=(-\infty,0)\cup(0,\infty), we mean that it is differentiable on both of the constituent open intervals (,0)(-\infty,0) and (0,)(0,\infty). Similar remarks apply to other domains which can be written as a union of open intervals. on {0}\mathbb{R}\setminus\{0\} with

(5.15) (5.15) f(x)=2xsin(1/x)cos(1/x)for all x{0}.f^{\prime}(x)=2x\sin(1/x)-\cos(1/x)\qquad\text{for all $x\in\mathbb{R}% \setminus\{0\}$.}

It remains to check whether it is differentiable at 0. The difference quotient is given by

f(0+h)f(0)h=h2sin(1/h)0h=hsin(1/h)for h{0}.\frac{f(0+h)-f(0)}{h}=\frac{h^{2}\sin(1/h)-0}{h}=h\sin(1/h)\qquad\text{for $h% \in\mathbb{R}\setminus\{0\}$.}

Since |sin(1/h)|1|\sin(1/h)|\leq 1, it follows from the squeeze theorem that ff is indeed differentiable at 0 with

f(0)=limh0f(0+h)f(0)h=0.f^{\prime}(0)=\lim_{h\to 0}\frac{f(0+h)-f(0)}{h}=0.

Finally, in light of (5.15), the function ff^{\prime} is not continuous at 0. Indeed, similar to Example 4.36, the rapid oscillation of cos(1/x)\cos(1/x) means that limx0f(x)\lim_{x\to 0}f^{\prime}(x) does not exist. ∎