Example
Let $$ f(x)=\begin{cases} x\sin(1/x), & \text{if } x > 0\\ 0, & \text{if } x \neq 0 \end{cases} $$ Then, show that \(f\) is not differentiable at \(x=0\) and differentiable else where.

Proof

Recall that we showed that \(f\) is continuous at \(x = 0\) here. Now observe that when \(a = 0\)

$$ \begin{align*} \frac{f(a+h) - f(a)}{h} = \frac{f(h) - f(0)}{h} = \frac{h\sin(\frac{1}{h}) - 0}{h} = \sin(\frac{1}{h}) \end{align*} $$

Hence by defintion

$$ \begin{align*} f'(0) = \lim\limits_{h \to 0} \frac{f(0+h) - f(0)}{h} = \lim\limits_{h \to 0} \sin(\frac{1}{h}) \end{align*} $$

Recall that we showed before that this limit doesn’t exist by the Sequential Criterion of Limits.

Else where besides \(a = 0\), notice that

$$ \begin{align*} f'(a) = \lim_{h \to 0} \frac{(a+h)\sin\!\left(\frac{1}{a+h}\right) - a\sin\!\left(\frac{1}{a}\right)}{h}. \end{align*} $$

Since \(a \neq 0\), the quantity \(a+h \neq 0\) even when \(h\) is small. Then each component \(\sin\!\left(\frac{1}{a+h}\right)\) and \(\sin\!\left(\frac{1}{a}\right)\) is well defined. Therefore, the limit exists, and \(f\) is differentiable at every \(a \neq 0.\) \(\ \blacksquare\)


References