This issue has perplexed me for some time now and I cannot seem to find the error in the way-

Suppose we have the following function:

$$f(x)= \ln(x^2+1)\sin\frac1x$$

and we want to find $f'(x)$ for $x_-=0$

By the alternate definition, we get

$$\begin{align} f'(x=0):= \lim\limits_{x\to0}\frac{f(x)-f(0)}{x-0} &= \lim\limits_{x\to0}\frac{\ln(x^2+1)\sin\frac1x-\ln(0+1)\sin\frac10}{x-0} \\[4pt] &=\lim\limits_{x\to0}\frac{\ln(x^2+1)\sin\frac1x}{x} \\[4pt] &=\lim\limits_{x\to0}\frac{\ln(x^2+1)}{x}\cdot\lim\limits_{x\to0}\sin\frac1x \\[4pt] &\overset{(\frac00 l'hopital)}=\lim\limits_{x\to0}\frac{2x}{x^2+1}\cdot\lim\limits_{x\to0}\sin\frac1x \\[4pt] &=0\cdot\lim\limits_{x\to0}\sin\frac1x \\[4pt] &=0 \end{align}$$

On the other hand, by using derivative rules we get


and for $x=0$:

$$\begin{align} f'(0)&=\frac01-\lim\limits_{x\to0}\frac{\ln(x^2+1)}{x^2}\cdot\lim\limits_{x\to0}\cos\frac1x \\[4pt] &\overset{(\frac00 l'hopital)}=-\lim\limits_{x\to0}\frac{2x}{2x(x^2+1)}\cdot\lim\limits_{x\to0}\cos\frac1x \\[4pt] &=-1\cdot\lim\limits_{x\to0}\cos\frac1x \\[4pt] &= \text{undefined} \end{align}$$

When inputting the data to desmos.com I found that indeed the latter function is the result:

actual functions

What's going on here? How come the two definitions give different results?

  • 2
    $\begingroup$ In the second computation you are computing the limit of the derivative, not the derivative itself. Derivatives don't need to be continuous. So, the limit of the derivatives could not exist while the derivative at the point exists. $\endgroup$ – conditionalMethod Nov 30 '19 at 1:13
  • $\begingroup$ As the formula is written, $f(0)$ is undefined. Writing “$\sin\frac{1}{0}$” as you do doesn't make sense. Are you assuming that $f$ has been extended to make it continuous by setting $f(0)=0$? Otherwise it's meaningless to even start asking about the derivative. $\endgroup$ – Hans Lundmark Nov 30 '19 at 9:46

The product rule for limits $$\lim_{x\to a}f(x)g(x) = \lim_{x\to a} f(x)\cdot \lim_{x\to a} g(x)$$ only holds if both limits exist. But $\lim_{x\to 0}\sin\frac{1}{x}$ does not exist, so the deduction to $f'(0)=0$ doesn't go through. To establish that the derivative indeed does not exist in the limit $x\to 0^+$, consider the sequence $x_n:=1/(n\pi)$. Then $\cos(1/x_n)=\cos(n\pi+\pi/2)=(-1)^n$ and $\sin(1/x_n) = \sin(n\pi+\pi/2)=0$, so \begin{align} f'(x_n) &= \frac{2x_n \sin(1/x_n)}{1+x_n^2} -\ln(x_n^2+1)\cos(1/x_n) \\ &=-\ln\left(1+\frac{1}{n^2\pi^2}\right)(-1)^n. \end{align} Then $x_{2n}\to -1$ and $x_{2n+1}\to 1$ as $n\to \infty$, so $\lim_{n\to\infty} f(x_n)$ does not exist. This is precisely the oscillatory behavior observed in Desmos. (For another viewpoint, try plotting $f(1/x)$ for large values of $x$.)

| cite | improve this answer | |
  • $\begingroup$ But $\lim\limits_{x\to0} sin\frac1x$ is bound between $-1$ and $1$. And the result of a bounded function(even with an undefined value) times a function whose value approaches $0$ at a point is 0 itself, which means $f'(0)=0$ $\endgroup$ – O. Aroesti Nov 30 '19 at 2:18
  • $\begingroup$ @O.Aroesti I think the point you're making is that, while the limit product rule isn't justified as such here, the squeeze theorem does justify $\lim_{x\to 0}\frac{f(x)}{x}=0$. So the problem has to be earlier than I was diagnosing. $\endgroup$ – Semiclassical Nov 30 '19 at 21:04
  • $\begingroup$ My thought right now is that it's an order-of-limits issue: $$\lim_{x\to 0}f'(x)=\lim_{x\to 0}\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ doesn't exist whereas $$\lim_{h\to 0}\lim_{x\to 0}\frac{f(x+h)-f(x)}{h}=\lim_{h\to 0}\frac{f(h)}{h}=0$$ does. $\endgroup$ – Semiclassical Nov 30 '19 at 21:11

I would use the squeeze theorem

$0\le |f(x)| < x^2$

which puts $0\le |\frac {f(0+h) - f(0)}{h}| \le |\frac {h^2}{h}|$

| cite | improve this answer | |

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.