TITLE: Does $f\colon \Omega \to \mathbb R$ differentiable imply $f$ locally Lipschitz?
QUESTION [9 upvotes]: Let $f\colon \Omega \subseteq \mathbb R^n \to \mathbb R$ be a differentiable function. Is it true that $f$ is locally Lipschitz, i.e. Lipschitz on every compact $K \subset \Omega$?
If $f$ were continuously differentiable, the answer would clearly be affirmative, by the mean value theorem and Weierstrass. What if we ask only for $f$ to be differentiable? I think I've found a counterexample with $n=1$:
$$
f \colon \mathbb R \ni x \mapsto \begin{cases}x^2\sin\left(\frac{1}{x^2}\right) & x\ne 0 \\ 0 & x=0 \end{cases}
$$
The function $f$ is differentiable for every $x \in \mathbb R$, but I think that
$$
f'(x) = \begin{cases} 2x\sin\left(\frac{1}{x^2}\right) - \frac{2}{x}\cos\left(\frac{1}{x^2}\right) & x\ne 0 \\ 0 & x=0 \end{cases}
$$
is not bounded in every neighbourhood of $0$.
What do you think? Is my counterexample correct? Thanks.

REPLY [7 votes]: Yes, your counterexample is correct. While the Lipschitz property does not imply differentiability, it provides a uniform bound for the derivative if the latter exists. So, a function with unbounded derivative cannot be Lipschitz, and a function whose derivative is not bounded locally cannot be locally Lipschitz.