Bounded gradient implies Lipschitz on non-convex set

derivativeslipschitz-functionsmean-value-theoremreal-analysis

There are loads of questions and answers concerning the following problem, but here we have a slight variation:

Let $U$ be an open subset of $\mathbb{R}^n$ and $f: U \rightarrow \mathbb{R}$ be differentiable such that the derivative is bounded by the constant $L \geq 0$. Show that $f$ is a globally lipschitz-function.

So, usually the domain is $\mathbb{R}^n$ and then this is pretty easy to show by using the mean-value-theorem. However, now we have an arbitrary open set as the domain and as far as I know, we need convexity of the set in order to use the MVT for two arbitrary points in the set. Does this statement still hold? If yes, what would the argument be? As a side note I have found this post Sub-gradient and super-gradient are bounded implies globally Lipschitz. which goes in the direction of my question, but does not answer it.

Best Answer

Simple counterexample: $n=1$, $U=(-1,0)\cup(0,1)$, $f:U\to\Bbb R$ defined by $$f(x)=\begin{cases}1,&(x\in(-1,0)), \\-1,&(x\in(0,1)).\end{cases}$$

Now $f'=0$ on all of $U$, although $f$ is not uniformly continuous, hence not Lipschitz.

Edit: If $U$ is an open disk in the plane with one radius removed then $U$ is connected, simply connected and contractible, but you can easily concoct an $f$ giving a counterexample.