Question:
Let $f(x) =\left\{ \begin{array}{ll} x^2 + x \sin \left(\frac{1}{x}\right) & x\neq0, \\ 0& x=0. \end{array} \right. $
Discuss whether $f(x)$ is differentiable at $x=0$. If yes, find $f'(0)$.
Attempt:
To determine whether $f(x)$ is differentiable at $x=0$, we need to compute the limit of the difference quotient:
$$\lim_{x\to 0} \frac{x^2 + x\sin\left(\frac{1}{x}\right)}{x} = \lim_{x\to 0} x+ \sin\left(\frac{1}{x}\right) = 0 + \lim_{x\to 0}\sin\left(\frac{1}{x}\right) = \infty$$
Note that for $x\neq 0$, we have
$$\begin{aligned} \frac{f(x)-f(0)}{x-0} &= \frac{x^2 + x \sin \left(\frac{1}{x}\right) - 0}{x-0} \ &= x + \sin \left(\frac{1}{x}\right) \ &\leq |x| + 1. \end{aligned}$$
Based on the squeeze theorem, we conclude that $f(x)$ is not differentiable at $x=0$.
Therefore, there is no value for $f'(0)$.
Updated Attempt:
To determine whether $f(x)$ is differentiable at $x=0$, we compute the limit of the difference quotient:
$$\lim_{x\to 0} \frac{f(x)-f(0)}{x-0} = \lim_{x\to 0} \frac{x^2 + x\sin\left(\frac{1}{x}\right)}{x} = \lim_{x\to 0} x+ \sin\left(\frac{1}{x}\right).$$
Since the limit of $\sin(1/x)$ as $x$ approaches 0 does not exist, the limit of the difference quotient also does not exist, and we can conclude that $f(x)$ is not differentiable at $x=0$.
However, we can show that $f(x)$ is continuous at $x=0$ by noting that $\lim_{x\to 0} f(x) = f(0) = 0$ and $f(x)$ is well-defined at $x=0$.
Thank you for your kind comments; am I correct?
Since there exist two sequences
$a_n=\dfrac1{\frac{\pi}2+2n\pi}>0\;,\quad n\in\Bbb N\;,$
$b_n=\dfrac1{\frac{3\pi}2+2n\pi}>0\;,\quad n\in\Bbb N\;,$
such that $\;a_n\to0\;,\;b_n\to0\;$ and
$\lim\limits_{n\to\infty}\dfrac{f(a_n)-f(0)}{a_n-0}=\lim\limits_{n\to\infty}\left[a_n+\sin\left(\dfrac1{a_n}\right)\right]=1\;,$
$\lim\limits_{n\to\infty}\dfrac{f(b_n)-f(0)}{b_n-0}=\lim\limits_{n\to\infty}\left[b_n+\sin\left(\dfrac1{b_n}\right)\right]=-1\;,$
it follows that it does not exist the limit
$\lim\limits_{x\to0}\dfrac{f(x)-f(0)}{x-0}\;,$
consequently ,
the function $\,f(x)\,$ is not differentiable at $\,x=0\,.$