$$ \newcommand{\RR}{\mathbb{R}} \newcommand{\QQ}{\mathbb{Q}} \newcommand{\CC}{\mathbb{C}} \newcommand{\NN}{\mathbb{N}} \newcommand{\ZZ}{\mathbb{Z}} \newcommand{\FF}{\mathbb{F}} % ALTERNATE VERSIONS % \newcommand{\uppersum}[1]{{\textstyle\sum^+_{#1}}} % \newcommand{\lowersum}[1]{{\textstyle\sum^-_{#1}}} % \newcommand{\upperint}[1]{{\textstyle\smallint^+_{#1}}} % \newcommand{\lowerint}[1]{{\textstyle\smallint^-_{#1}}} % \newcommand{\rsum}[1]{{\textstyle\sum_{#1}}} \newcommand{\uppersum}[1]{U_{#1}} \newcommand{\lowersum}[1]{L_{#1}} \newcommand{\upperint}[1]{U_{#1}} \newcommand{\lowerint}[1]{L_{#1}} \newcommand{\rsum}[1]{{\textstyle\sum_{#1}}} \newcommand{\partitions}[1]{\mathcal{P}_{#1}} \newcommand{\sampleset}[1]{\mathcal{S}_{#1}} \newcommand{\erf}{\operatorname{erf}} $$

22  Definition

Highlights of this Chapter: we define the derivative and compute a few examples directly from the definition.

Finally - on to some calculus! Here we will define the derivative, and study its properties. This may sound daunting at first, remembering back to the days of calculus when it all seemed so new and advanced. But hopefully, after so much exposure to sequences and series during this course, the rigorous notion of a derivative will feel more just like a nice application of what we’ve learned, than a whole new theory.

Definition 22.1 (The Derivative) Let \(f\) be a function defined on an open interval containing \(a\). Then \(f\) is differentiable at \(a\) if the following limit of difference quotients exists. In this case, we define the limiting value to be the derivative of \(f\) at \(a\). \[f^\prime(a)=D f(a)=\lim_{t\to a}\frac{f(t)-f(a)}{t-a}\]

Exercise 22.1 (Equivalent Formulation) Prove that we may alternatively use the following limit definition to calculate the derivative: \[f^\prime(a)=\lim_{h\to 0}\frac{f(a+h)-f(a)}{h}\]

Example 22.1 The function \(f(x)=x^2\) is differentiable at \(x=2\).

This is a classic problem from calculus 1, whose argument is already pretty much rigorous! We wish to compute the limit

\[\lim_{x\to 2}\frac{x^2-4}{x-2}\]

So, we choose an arbitrary sequence \(x_n\) with \(x_n\neq 2\) but \(x_n\to 2\) and compute

\[\lim \frac{x_n^2-4}{x_n-2}=\lim \frac{(x_n+2)(x_n-2)}{x_n-2}=\lim x_n+2\]

Where the arithmetic is justified since \(x_n\neq 2\) for all \(n\) by definition, so everything is defined. But now, as \(x_n\to 2\) we can just use the limit laws to see

\[\lim x_n+2=2+2=4\]

Since \(x_n\) was arbitrary, this holds for all such sequences, so the limit exists and equals 4. Because this limit defines the derivative, we have that \(f\) is differentiable at 2 and

\[f^\prime(2)=4\]

Exercise 22.2 Compute the derivative of \(f(x)=x^3\) at an arbitrary point \(a\in\RR\), directly from the definition and show \(f^\prime(a)=3a^2\).

22.0.1 Multiple Derivatives

Once we’ve defined the derivative, as a limit, it’s easy to iterate to define multiple derivatives:

Definition 22.2 If \(f\) is differentiable on a domain \(D\subset\RR\), and the function \(f^\prime\) itself is differentiable at a point \(a\in D\), we call the resulting derivative the second derivative of \(f\): \[f^{\prime\prime}(a):=(f^\prime)^\prime(a)=\lim_{t\to a}\frac{f^\prime(t)-f^\prime(t)}{t-a}\]

Proposition 22.1 Assume that \(f\) is twice differentiable at a point \(a\) of its domain. Then \(f^{\prime\prime}(a)\) can be calculated via the following limit: \[f^{\prime\prime}(a)=\lim_{h\to 0}\frac{f(x+2h)-f(x+h)+f(x)}{h^2}\]

22.1 Using the Definition

Derivative is defined as a limit: one of our most useful tools is Theorem 17.2, which tells us we can detect differentiability by comparing the one-sided limits.

Example 22.2 The function \(f(x)=|x|\) is not differentiable at \(x=0\).

The difference quotient defining the derivative is

\[\lim_{x\to 0}\frac{|x|-0|}{x}=\frac{|x|}{x}\]

When \(x>0\) we have \(|x|=x\) and so \(\frac{|x|}{x}=1\). Thus, the rihgt hand limit for any sequence \(x_n>0\) with \(x_n\to 0\) is just the limit of the constant sequence \(1\), and \[\lim_{x\to 0^+}\frac{|x|}{x}=1\]

However, for \(x<0\) we have \(|x|=-x\), and analogous reasoning shows

\[\lim_{x\to 0^-}\frac{|x|}{x}=-1\]

Since these are unequal, the overall limit cannot exist, and thus the function \(|x|\) is not differentiable at zero.

It is sometimes useful to define one-sided derivatives, much as we defined one-sided limits (particularly, to discuss differentiability at the endpoint of an interval, for example)

Definition 22.3 (One Sided Derivatives) \[D^-f(a)=\lim_{x\to a^-}\frac{f(x)-f(a)}{x-a}\hspace{0.5cm}D^+f(a)\lim_{x\to a^+}\frac{f(x)-f(a)}{x-a}\]

Here’s the differentiable analog of the pasting lemma you recently proved on homework:

Exercise 22.3 Let \(f,g\) be two continuous and differentiable functions with \(a\in\RR\) a point such that \(f(a)=g(a)\). Prove that the piecewise function \[h(x)=\begin{cases} f(x)&x\leq a\\ g(x)&x>a \end{cases}\] is differentiable at \(a\) if and only if \(f^\prime(a)=g^\prime(a)\). (recall we saw such a function is always continuous at \(a\) in Exercise 17.5).

One sided derivatives let us more easily prove that the derivative exists in cases where it is easy to take limits from above and below, but not arbitrary limits. A great example use case is when the difference quotient is monotone: then the right and left limits exist Exercise 17.6 (they are the inf and sup for any sequence, respectively). When is the difference quotient monotone? One particularly useful case: this holds whenever the function is convex (Proposition 13.1)

Corollary 22.1 (\(\bigstar\) Derivatves and Convexity) If \(f\) is convex then at any point \(a\in\RR\) the one sided difference quotients \(D^-f(a)\) and \(D^+f(a)\) both exist.

Exercise 22.4 These one sided difference quotients need not be equal, however. Prove the convex function \(f(x)\) below is not differentiable at \(x=1\): \[f(x)=\begin{cases} x&x\leq 1\\ x^2 &x>1 \end{cases}\]

22.2 The Derivative as a Function

Definition 22.4 Let \(f\) be a function, and suppose that the derivative of \(f\) exists at each point of a set \(D\subset\RR\). Then we may define a function \(f^\prime\colon D\to \RR\) by

\[f^\prime\colon x\mapsto f^\prime(x)=\lim_{t\to x}\frac{f(t)-f(x)}{t-x}\]

If \(f^\prime\) is continuous, \(f\) is called continuously differentiable on \(D\).

For example, \(f(x)=x^3\) is continuously differentiable on \(\RR\) since by Exercise 22.2 we see its derivative is the function \(x\mapsto 3x^2\), and this is a polynomial: we proved all polynomials are continuous in Exercise 14.7.

Example 22.3 While its hard to imagine a function that is differentiable at every point but not continuously differentiable such things exist. For example \[f(x)=\begin{cases} x^2\sin\left(\frac{1}{x^2}\right)&x\neq 0\\ 0 & x=0 \end{cases} \]

Its possible to find a formula for \(f^\prime(x)\) when \(x\neq 0\), and show that \(\lim_{x\to 0}f^\prime(x)\) does not exist (similar to the previous exercise on \(\sin\frac{1}{x}\)). However one can also calculate directly the derivative at zero: and find \(f^\prime(0)=0\). This means \(\lim_{x\to 0}f^\prime(x)\neq f^\prime(\lim_{x\to 0}x)\) as one side does not exist and the other is zero: thus \(f^\prime\) is not continuous at \(0\).

Exercise 22.5 For \(f(x)\) as above in Example 22.3, calculate \(f^\prime(0)\) directly using the limit definition. (Perhaps surprisingly, all you need to know about the sine function here is that it is bounded between \(-1\) and \(1\)!)