I came across this question as stated below:

let $g(x) = xf(x)$ where $ f(x)= \begin{cases} x \hspace{0.1cm}\sin(\frac{1} {x} ) &\text{if}\ x\neq 0\\ 0 &\text{if}\, x= 0 \end{cases} $
Show that $g(x)$ is differentiable at $x = 0 \hspace{0.2cm}$but $g'(x)$ is not continuous at $x=0$

Please note that I do NOT want answers to the question
What I want to know is whether functions can exist which are differentiable but their derivative isn't continuous at that point. And, if they do exist, why would the derivative be discontinuous but the function be differentiable?

Until now, whenever they asked to check differentiability, instead of going for the limit definition, I directly differentiate the function and then check the continuity of the new function which clearly goes wrong as in this example.

Why are there functions that behave like that?

*To know exactly what I mean to ask, re-read the lines below the bold sentence.

  • $\begingroup$ Yes, such functions exist; $g(x)$ is an example. Derivatives have no jump discontinuities, but they can have oscillatory discontinuities, as in this case. If you simply do the problem, I think all your questions will answer themselves. $\endgroup$
    – saulspatz
    Jun 8, 2021 at 14:30
  • 1
    $\begingroup$ "What I did until now, was whenever they asked to check differentiability instead of going for the limit stuff, I directly differentiate the function and then check the continuity of the new function which clearly goes wrong as in this example.": You've been wrong. Indeed this is a common mistake. $\endgroup$ Jun 8, 2021 at 14:38
  • 2
    $\begingroup$ It is more confusing because it works in one direction: if the limit of $f'$ at that point exists, then $f$ is differentiable at that point and the derivative is the limit. But the fact that $f'$ has no limit says nothing about differentiability at that point. $\endgroup$ Jun 8, 2021 at 14:43
  • 2
    $\begingroup$ "why would the derivative be discontinuous but the function be differentiable ?" Counter question: Why shouldn't it be discontinuous? Do you have any intuitive reason to believe so, other than the fact that you don't know any examples? $\endgroup$ Jun 8, 2021 at 15:02
  • $\begingroup$ How I think about it: The derivative of a function is a (usually different) function. Since functions don't have to be continuous, there is no a priori reason to expect that the derivative (which is a function) is continuous. $\endgroup$ Jun 8, 2021 at 16:35

1 Answer 1


For most functions that we can apply the usual "rules" of differentiation to (such as the product rule), the derivative will be continuous over any interval in which it exists. That is convenient, as it saves a lot of laborious delta-epsilon work.

In this particular case it is not hard to confirm that the derivative exists at all non-zero values of $x$, that the usual convenient rules of differentiation give the same formula for the derivative at all non-zero $x,$ and that there is no possible value of the derivative at $x$ that would make the derivative continuous there.

On the other hand, if we compute the derivative from first principles (delta-epsilon), we find that it exists at $x = 0$ and we can find the value of the derivative there.

For an intuitive notion of how to construct a function with such bizarre properties as this, note that the factor $\sin(1/x)$ puts an infinite number of oscillations into the function near $x = 0.$ The factor $x^2$ (in $g(x) = x f(x) = x^2 \sin(1/x)$ when $x\neq 0$) "suppresses" the effect of those oscillations on the slope of the secant lines through $(0,g(0)),$ but it still allows the derivative oscillate between values that don't converge as we approach $x = 0$ from either side.

If we consider $f(x)$ then the oscillations of $\sin(1/x)$ near $x = 0$ would prevent convergence of the slopes of the secant lines at $(0,f(0))$. On the other hand, the derivative of $x^2 f(x)$ is continuous. That is, if we only multiply $\sin(1/x)$ by $x$ when $x \neq 0,$ it does not "suppress" the oscillations enough to allow defining the derivative at $x=0$; but if we multiply by $x^3$ it "suppresses" the oscillations so thoroughly that it suppresses the discontinuity of the derivative too.

  • $\begingroup$ I sense that you were able to answer this question for yourself. This answer is posted as a community wiki with the idea that you can modify it to suit your understanding of the solution and (when you are satisfied) accept it to show that your question is answered. Also by making this a community wiki I agree not to take any credit for it (or at least, no reputation points). $\endgroup$
    – David K
    Jun 9, 2021 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.