Questions about derivative and differentiation

For a real-valued function $f$ defined on $\mathbb{R}$ or its subset,

  1. is it possible that it is differentiable at one point and not in one of its neighbourhoods except the point itself?
  2. is it possible that it is differentiable over an interval, but its derivative over the interval is not continuous?

    I found on this link that for $f(x) = x^2 \sin(1/x)$, when $x$ is not 0, the derivative is $2x \sin(1/x) - \cos(1/x)$ which does not have a limit as x approaches 0, but the derivative of $f$ does exist at 0: $$\lim_{h \rightarrow 0} ( h^2 \sin(1/h) - 0)/(h-0) = 0.$$

    I was wondering how $f$ is differentiable at 0? Doesn't it require $f$ to be defined on 0?

Thanks and regards!


Here is the answer to the third question

Let us take a look at the function $f(x) = x^2 \sin(\frac{1}{x})$.

The first question is "Is the function even in $C^{(0)}$"?

The answer is not yet since the function is ill-defined at the origin. However if we define $f(0) = 0$, then yes the function is in $C^0$. This can be seen from the fact that $\sin(\frac{1}{x})$ is bounded and hence the function is bounded above by $x^2$ and below by $-x^2$. So as we go towards $0$, the function is bounded by functions which themselves tend to $0$. And the limit is $0$ and thereby the function is continuous.

Now, the next question "Is the function differentiable everywhere?"

It is obvious that the function is differentiable everywhere except at $0$. At $0$, we need to pay little attention. If we were to blindly differentiate $f(x)$ using the conventional formulas, we get $g(x) = f'(x) = 2x \sin(\frac{1}{x}) + x^2 \times \frac{-1}{x^2} \cos(\frac{1}{x})$.

Now $g(x)$ is ill-defined for $x=0$. Further $\displaystyle \lim_{x \rightarrow 0} g(x)$ doesn't exist. This is what we get if we use the formula. So can we say that $f(x)$ is not differentiable at the origin. Well no! All we can say is $g(x)$ is discontinuous at $x=0$.

So what about the derivative at $x=0$? Well as I always prefer to do, get back to the definition of $f'(0)$.

$f'(0) = \displaystyle \lim_{\epsilon \rightarrow 0} \frac{f(\epsilon) - f(0)}{\epsilon} = \displaystyle \lim_{\epsilon \rightarrow 0} \frac{\epsilon^2 \sin(\frac{1}{\epsilon})}{\epsilon} = \displaystyle \lim_{\epsilon \rightarrow 0} \epsilon \sin(\frac{1}{\epsilon}) = 0$.

(Since $|\sin(\frac{1}{\epsilon})| \leq 1$ so it is bounded).

So we find that the function $f(x)$ has a derivative at the origin whereas the function $g(x) = f'(x)$, $\forall x \neq 0$ is not continuous or even well-defined at the origin.

So we have this function whose derivative exists everywhere but then $f(x) \notin C^{(1)}$ since the derivative is not continuous at the origin.

Look up Volterra's function as an answer to your second question.


  1. Let $f(x)=x^2$ if $x$ is rational, $f(x)=0$ if $x$ is irrational. If $x\neq 0$, then $f$ is not continuous at $x$, and hence not differentiable at $x$. If $h\neq0$ is rational, then $\frac{f(h)}{h}=h$, while if $h$ is irrational, then $\frac{f(h)}{h}=0$. Therefore $f'(0)=\lim_{h\to0}\frac{f(h)}{h}=0$, and in particular it exists. If you wanted the example to be continuous, take a continuous function that is nowhere differentiable and multiply by $x$ to get a continuous function differentiable only at $0$.