Existence of maxima (local) and minima (local)of $$f(x)=\begin{cases}x\sin\frac 1x: x\ne 0\\ 0: x=0
\end {cases}$$
is to be shown in arbitrary neighborhood of $0$.
Clearly, $f$ is differentiable on $\mathbb R\setminus \{0\}$ and not differentiable at $0$.
We take any $\epsilon \gt 0$ and consider the interval $(-\epsilon, \epsilon)$. $f$ is an even function so let's consider only the half neighborhood $(0,\epsilon)$.
If $f$ attains maxima/minima at an interior point $c$ of the open interval $(0,\epsilon)$, then by Fermat's theorem, we must have $f'(c)=0\implies \sin (\frac 1c)-\frac 1c\co…