Theorem: Let $f$ be continuous on the interval $[a, b]$ and let $c\in (a, b)$. Assume that $f$ is differentiable on $(a, c)$ and $(c, b)$. If there exists a neighbourhood $(c − \delta, c + \delta) \subset [a, b]$ such that $$f'(x)\begin{cases} \geq 0, &\text{for } x \in (c − \delta, c)\\ \leq 0, &\text{for } x \in (c, c + \delta)\end{cases},$$ then $f$ has a local maximum at $c$.
To prove the converse doesn't hold, I am told to use the function $f(x) = 2x^4 + x^4\sin(1/x)$ for $x\neq 0$ and $f(x) = 0$ for $x = 0$.
I guess I am supposed to show that $f$ has a local maximum at $0$ another way and then show there is no neighbourhood such that $f'(x)$ is as stated in the theorem. I am really struggling with finding a starting place for this as when I look at the neighbourhood around $0$, I cannot determine whether terms are positive or negative as $\sin(1/x)$ and $\cos(1/x)$ in the differentiated form could be positive or negative. Any help in where to start would be much appreciated thank you!
I'm hoping you got: \begin{align*} f'(x) &= 8x^3 + 4x^3\sin\left(\frac{1}{x}\right) - x^2\cos\left(\frac{1}{x}\right) \\ &= x^2\left(4x\left(2 + \sin\left(\frac{1}{x}\right)\right) - \cos\left(\frac{1}{x}\right)\right). \end{align*} Note that $2 + \sin\left(\frac{1}{x}\right) \in [1, 3]$, so for $x \in (0, 1/24)$, we have $$4x\left(2 + \sin\left(\frac{1}{x}\right)\right) \in \left(0, \frac{1}{2}\right).$$ Now, consider the sequences $a_n = \frac{1}{2n\pi}$ and $b_n = \frac{1}{(2n + 1)\pi}$. Both sequences converge to $0$ from above, so both sequences lie eventually in $(0, 1/24)$. Note that $\cos(1/a_n) = 1$ and $\cos(1/b_n) = -1$. So, when $a_n \in (0, 1/24)$, \begin{align*} f'(a_n) &= a_n^2\left(4a_n\left(2 + \sin\left(\frac{1}{a_n}\right)\right) - \cos\left(\frac{1}{a_n}\right)\right) \\ &< a_n^2\left(\frac{1}{2} - \cos\left(\frac{1}{a_n}\right)\right) \\ &= a_n^2\left(\frac{1}{2} - 1\right) < 0. \end{align*} When $b_n \in (0, 1/24)$, then \begin{align*} f'(b_n) &= b_n^2\left(4b_n\left(2 + \sin\left(\frac{1}{b_n}\right)\right) - \cos\left(\frac{1}{b_n}\right)\right) \\ &> b_n^2\left(0 - \cos\left(\frac{1}{b_n}\right)\right) \\ &= b_n^2\left(0 + 1\right) > 0. \end{align*} That is, $f'(x)$ changes sign infinitely often as $x \to 0^+$.