Give an example of a function \(f:\RR\to \RR\) that is everywhere differentiable but \(f'\) is not continuous at 0.
Solution
The standard example: \[ f(x) \da \begin{cases} x^2\sin\qty{1\over x} & x\neq 0 \\ 0 & x=0. \end{cases} .\]
Away from zero, \(f\) is differentiable: on \(\RR \setminus \{0\}\) it is the product of the differentiable functions \(x \mapsto x^2\) and \(x \mapsto \sin(1/x)\) (the latter differentiable by the chain rule, since \(1/x\) and \(\sin\) are differentiable), so the product rule applies. It turns out that \[ f'(x) = \begin{cases} 2x\sin\qty{1\over x} + x^2 \cos\qty{1\over x}\qty{-1\over x^2} = 2x\sin\qty{1\over x} - \cos\qty{1\over x} & x\neq 0 \\ 0 & x=0. \end{cases} .\] Here we check differentiability and compute the derivative at \(x=0\) directly: \[ {f(x) - f(0) \over x-0} = {x^2\sin\qty{1\over x} - 0 \over x-0} = x\sin\qty{1\over x} \convergesto{x\to 0} 0 ,\] using that \(-x \leq \abs{x\sin \qty{1\over x}}\leq x\).
But now notice that the \(\cos\qty{1\over x}\) term in \(f'\) isn’t enveloped by an \(x^c\) term, so \(\lim_{x\to 0} f'(x)\) does not exist for oscillatory reasons:
In particular, \(\lim_{x\to 0}f'(x) \neq f'(0) = 0\).