## Section2.15(Optional) — Is $\lim_{x\to c}f'(x)$ Equal to $f'(c)\text{?}$

Consider the function

\begin{equation*} f(x) = \begin{cases} \frac{\sin x^2}{x} \amp\text{if }x\ne 0 \\ 0 \amp\text{if }x=0 \end{cases} \end{equation*}

For any $x\ne 0$ we can easily use our differentiation rules to find

\begin{equation*} f'(x) = \frac{2x^2\cos x^2 -\sin x^2}{x^2} \end{equation*}

But for $x=0$ none of our usual differentation rules apply. So how do we find $f'(0)\text{?}$ One obviously legitimate strategy is to directly apply the Definition 2.2.1 of the derivative. As an alternative, we will now consider the question “Can one find $f'(0)$ by taking the limit of $f'(x)$ as $x$ tends to zero?”. There is bad news and there is good news.

• The bad news is that, even for functions $f(x)$ that are differentiable for all $x\text{,}$ $f'(x)$ need not be continuous. That is, it is not always true that $\lim_{x\rightarrow 0}f'(x) = f'(0)\text{.}$ We will see a function for which $\lim_{x\rightarrow 0}f'(x) \ne f'(0)$ in Example 2.15.1, below.
• The good news is that Theorem 2.15.2, below provides conditions which are sufficient to guarantee that $f(x)$ is differentiable at $x=0$ and that $\lim_{x\rightarrow 0}f'(x) = f'(0)\text{.}$

Consider the function

\begin{equation*} f(x) = \begin{cases} x^2\sin\frac{1}{x} \amp\text{if }x\ne 0 \\ 0 \amp\text{if }x=0 \end{cases} \end{equation*}

For $x\ne 0$ we have, by the product and chain rules,

\begin{align*} f'(x) \amp= 2x\, \sin\frac{1}{x} + x^2 \left(\cos\frac{1}{x}\right) \left(-\frac{1}{x^2}\right) \\ \amp= 2x\, \sin\frac{1}{x} - \cos\frac{1}{x} \end{align*}

As $\left|\sin\frac{1}{x}\right|\le 1\text{,}$ we have

\begin{equation*} \lim_{x\rightarrow 0}2x\, \sin\frac{1}{x}=0 \end{equation*}

On the other hand, as $x$ tends to zero, $\frac{1}{x}$ goes to $\pm\infty\text{.}$ So

\begin{equation*} \lim_{x\rightarrow 0}\cos\frac{1}{x} = DNE \implies \lim_{x\rightarrow 0}f'(x) = DNE \end{equation*}

We will now see that, despite this, $f'(0)$ is perfectly well defined. By definition

\begin{align*} f'(0) \amp= \lim_{h\to 0}\frac{f(h)-f(0)}{h} \\ \amp = \lim_{h\to 0}\frac{h^2\sin\frac{1}{h}-0}{h} \\ \amp = \lim_{h\to 0} h\sin\frac{1}{h} \\ \amp = 0\qquad\text{since }\left|\sin\frac{1}{h}\right|\le 1 \end{align*}

So $f'(0)$ exists, but is not equal to $\lim_{x\rightarrow 0}f'(x)\text{,}$ which does not exist.

Now for the good news.

By hypothesis, there is a number $L$ such that

\begin{equation*} \lim_{x\rightarrow c}f'(x) = L \end{equation*}

By definition

\begin{equation*} f'(c) = \lim_{h\to 0}\frac{f(c+h)-f(c)}{h} \end{equation*}

By the Mean Value Theorem (Theorem 2.13.5 ) there is, for each $h\text{,}$ an (unknown) number $x_h$ between $c$ and $c+h$ such that $f'(x_h)=\frac{f(c+h)-f(c)}{h}\text{.}$ So

\begin{equation*} f'(c) = \lim_{h\to 0} f'(x_h) \end{equation*}

As $h$ tends to zero, $c+h$ tends to $c\text{,}$ and so $x_h$ is forced to tend to $c\text{,}$ and $f'(x_h)$ is forced to tend to $L$ so that

\begin{equation*} f'(c) = \lim_{h\to 0} f'(x_h) = L \end{equation*}

In the next example we evaluate $f'(0)$ by applying Theorem 2.15.2.

Let

\begin{equation*} f(x) = \begin{cases} \frac{\sin x^2}{x} \amp\text{if }x\ne 0 \\ 0 \amp\text{if }x=0 \end{cases} \end{equation*}

We have already observed above that, for $x\ne 0\text{,}$

\begin{equation*} f'(x) = \frac{2x^2\cos x^2 -\sin x^2}{x^2} = 2\cos x^2 - \frac{\sin x^2}{x^2} \end{equation*}

We use Theorem 2.15.2 with $c=0$ to show that $f(x)$ is differentiable at $x=0$ and to evaluate $f'(0)\text{.}$ That theorem has two hypotheses that we have not yet verified, namely the continuity of $f(x)$ at $x=0\text{,}$ and the existence of the limit $\lim_{x\rightarrow 0}f'(x)\text{.}$ We verify them now.

• We already know, by Lemma 2.8.1, that $\lim_{h\rightarrow 0}\frac{\sin h}{h}=1\text{.}$ So
\begin{align*} \lim_{x\rightarrow 0}\frac{\sin x^2}{x^2} \amp=\lim_{h\rightarrow 0^+}\frac{\sin h}{h}\qquad\text{with }h=x^2\\ \amp=1 \end{align*}
and
\begin{align*} \lim_{x\rightarrow 0} f(x) \amp=\lim_{x\rightarrow 0}\frac{\sin x^2}{x} =\lim_{x\rightarrow 0}x\,\frac{\sin x^2}{x^2} =\lim_{x\rightarrow 0}x\ \lim_{x\rightarrow 0}\frac{\sin x^2}{x^2} =0\times 1 =0 \end{align*}
and $f(x)$ is continuous at $x=0\text{.}$
• The limit of the derivative is
\begin{align*} \lim_{x\rightarrow 0}f'(x) \amp= \lim_{x\rightarrow 0}\left[2\cos x^2 - \frac{\sin x^2}{x^2}\right] =2\times 1 -1 = 1 \end{align*}

So, by Theorem 2.15.2, $f(x)$ is differentiable at $x=0$ and $f'(0)=1\text{.}$