So far I assumed the derivative of a function with cases such as this one:

$$f(x) = \begin{cases}x^2\sin x^{-1} & \text{ if } x \neq 0\\ 0 & \text{ else }\end{cases}$$ would be the cases of the derivatives.

So, for $f'$ I would get:

$$f'(x) = \begin{cases} 2x \sin{\left( \frac{1}{x} \right)} -\cos{\left( \frac{1}{x} \right)} & \text{if } x \neq 0\\ 0 & \text{else} \end{cases}$$

And for $f''$

$$f''(x) = \begin{cases} \frac{(2x^2 - 1)\sin{\left( \frac{1}{x} \right)} - 2x\cos{\left( \frac{1}{x} \right)}}{x^2} & \text{if } x \neq 0\\ 0 & \text{else} \end{cases}$$

However, supposedly $f$ is only differentiable once and not twice. Therefore I must have made a mistake here, but I am at a loss as to what that would be. Is the derivative of cases not the cases of the derivatives?

  • $\begingroup$ Why are you saying it is only differentiable once? $\endgroup$
    – K Split X
    Jan 14 '17 at 2:58
  • $\begingroup$ Check what happens on the left and right side of 0 with the first and second derivative. To be fully "differentiable" at any given point, the limit of the derivative on the left and right side of that point have to be the same. Otherwise, you can't talk about the (unique) derivative at that point, since you have 2 different derivatives. $\endgroup$
    – Frank
    Jan 14 '17 at 4:11
  • $\begingroup$ Note that the same thing happens for functions of a complex variable: this time, since you can get close to a (x,y) point from any direction, you have to require that the derivative from all directions be the same if you want to talk about the derivative at that point. $\endgroup$
    – Frank
    Jan 14 '17 at 4:23
  • $\begingroup$ BTW if you search in approach0, you can find a few posts about this function, some of them might be useful for you. For example, Awkward behavior of $x^2 \sin\frac{1}{x}$ at $x=0$? or Differentiability of $f(x)$ and continuity of $f'(x)$: same thing or different?, $\endgroup$ Jan 14 '17 at 7:31

"The derivative of the cases is the cases of the derivatives", as you write, on any point internal to an interval on which a single case applies. But at any point where two intervals relative to two different cases meet the derivative might not even exist, even if it exists at any point arbitrarily near to it (and even if it approaches the same limit from the right and the left, in fact). Think about $g(x)$ defined as $1/x$ for $x\neq 0$ and as $0$ for $x=0$: is there a derivative in $0$?

To make this all more formal, check the definition of derivative as a limit, and note that in general you really need "a little space around" a point in which only a single case applies to find it.


How you concluded $f'(0)=0$ you made no attempt to explain. Remember that $$ f'(0) = \lim_{h\to0} \frac{ f(0+h) - f(0) } h. $$ You'll probably need to squeeze in order to find the limit. Next you have $$ f''(0) = \lim_{h\to0} \frac{f'(0+h) - f'(0)} h. $$ And again you'll probably have to squeeze. However, it's not hard to see without doing that, that $f'$ is not continuous at $0$ since it approaches no limit at $0$ because of the way it oscillates. Therefore it cannot be differentiable at $0.$

  • $\begingroup$ I concluded $f'(0) = 0$ because when $f(x) = c$ then $f'(x) = 0$. How is that incorrect? $\endgroup$ Jan 14 '17 at 3:15
  • $\begingroup$ To see why this argument is incorrect, consider the function $g(x)=1/x$ for $x\neq 0$, and $g(x)=0$ for $x=0$. Can you conclude that the derivative in $0$, $g'(0)$, exists and is $0$ because $g(0)$ is "constant" on the point "0"? $\endgroup$
    – Anonymous
    Jan 14 '17 at 3:28
  • $\begingroup$ no, hm. Now I see what you mean with "internal to an interval". $\endgroup$ Jan 14 '17 at 3:33
  • $\begingroup$ The statement that when $f(x)=c$ then $f'(x)=0$ has to be understood for what it says, not just obeyed unthinkingly. It means $f(x)=c$ for all values of $x$ in some interval. Not just at an isolated point. $\endgroup$ Jan 14 '17 at 19:21
  • $\begingroup$ @user3578468 : . . . . . or to put it another way, suppose $f(x) = x^3.$ Then $f(2) = 8.$ Since $8$ is a constant, one would conclude that $f'(2) =0.$ But in fact $f'(2) = 3\cdot 2^2 = 12.$ "Constant" must be taken to mean constant in some interval, not "constant" at one point. $\endgroup$ Nov 14 '17 at 1:12

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.