I think i have found an answer that is wrong. can you verify

calculusderivativesfunctionslimitsreal-analysis

the function in question is $f(x)=x^2$sin$(\frac{1}{x})$
RHD$=\lim\limits_{h \to 0^+}\frac{f(x+h)-f(x)}{h}$ and LHD$=\lim\limits_{h \to 0^-}\frac{f(x+h)-f(x)}{h}$ and $f'(x)=2x$sin$(\frac{1}{x})-$cos$(\frac{1}{x})$

at x=0, RHD$=\lim\limits_{h\to0^+}\frac{h^2\sin(\frac1h)-0}h=0 $ and LHD$=\lim\limits_{h\to0^-}\frac{h^2\sin(\frac1h)-0}h=0$, and $f'(0)=$undefined

here this is what is answered (in short)

we assume that ${\bf f(0)=0}$ and prove LHD=RHD=$0$ , at $x=0$ $=>$ derivative exists.
but $ f'(0)$ does not exist $=>$ RHD and $ f'(x)$ are not the same things

i think the above linked answer is wrong, because of what is answered
here (which in short is)

${\bf f(x)}$ is undefined at $\bf {x=0}$, so we define a new function, $ \overline{f}(x) =
\begin{cases} x^{2} \sin \Big( \frac{1}{x} \Big) & \text{if } x \neq 0 \\[2mm]
0 & \text{if } x = 0
\end{cases}
$

now if we differentiate $ \overline{f}(x) $ , we get $ \overline{f}'(x) =
\begin{cases} 2x \sin \Big( \frac{1}{x} \Big) -\cos \Big( \frac{1}{x} \Big) & \text{if } x \neq 0 \\[2mm]
0 & \text{if } x = 0
\end{cases}
$

from here we can obtain at x = $0$, RHD$=\lim\limits_{h\to0^+}\frac{h^2\sin(\frac1h)-0}h=0 $ is the same as $ \overline{f}'(0)=\frac{d}{dx}0=0 \implies $RHD and $ \overline{f}'(x)$ are the same things

(note:-$ \overline{f}'(0)=\frac{d}{dx}0=0 $ is wrong. the reason is explianed in one of the answers below.)

edit1:- i don't believe that the derivative $f'(x)$ needs to converge.(i may be wrong but, here's a counter example)

take the function $g(x) =
\begin{cases} x^3/3+2/3 & \text{if } x < 1 \\[2mm]
-2x+3 & \text{if } x = 1\\[2mm]
2*x-x^2/2-1/2 & \text{if } x > 1
\end{cases}$

$g'(1)=\frac{d}{dx}(-2x+3)=-2$, but $\lim\limits_{x\to 1}g'(x)=1$, in particular $g'(x) $ has a removable discontinuity (which is allowed, i guess)
(note:-$g'(1)=\frac{d}{dx}(-2x+3)=-2$ is wrong, the reason is explained in one of the answers below.)

edit2:- what i am asking for is

  1. is it valid to assume $f(0)=0$
  2. are $\lim\limits_{h \to 0}\frac{f(x_0+h)-f(x_0)}{h}$ and $f'(x_0)$ the same things(in edit1, for function g they are not, hence does derivative of g at x=1 exist. if it exists then is it 1 or -2.)

Best Answer

It's not very clear what you are asking, but here are some facts:

The function $s : \mathbb{R}\setminus\{0\} \to \mathbb{R},\ s(x) = x^2 \sin\frac1x$ is not defined at $x=0$ so it can not have a derivative there.

The extension $\bar{s} : \mathbb{R} \to \mathbb{R},\ s(0) = 0,\ s(x) = x^2 \sin\frac1x$ has a derivative everywhere.

The limits $\lim_{x\to0+}\bar{s}'(x)$ and $\lim_{x\to0-}\bar{s}'(x)$ do not exist.

Generally, a function $f : \mathbb{R} \to \mathbb{R}$ has a derivative at $0$ if and only if both $\lim_{h\to0+} h^{-1}(f(h)-f(0))$ and $\lim_{h\to0-} h^{-1}(f(h)-f(0))$ exist and are equal.

Also generally, if $\lim_{x\to0+} f'(x)$ and $\lim_{x\to0-} f'(x)$ both exist and are equal, then $f'(0)$ exists and equals the previous common limit.

Related Question