TITLE: $C^1$ function on compact set is Lipschitz
QUESTION [15 upvotes]: Let $\emptyset\ne A\subset\mathbb{R}^n$ be open and
let $f \in C^1 (A, \mathbb{R})$ be a function. Let $\emptyset\ne K\subset A$ be compact and convex. I want to prove that $f$ is 
Lipschitz on $K$; that is, prove there exists a 
constant $c > 0$ such that 
$| f ( x  ) - f( y ) | \leq 
c  \, \|  x - y  \|,   \forall  x , y \in K$.
My approach:

Let $x,y\in K$ be two arbitrary points. Then, since $K$ is convex, the line segment between $x$ and $y$, i.e. $Co(x,y)$, is in $K$. Thus, by MVT, there exists a vector $b\in Co(x,y)$ such that
$$\text{(*) } |f(x)-f(y)|=|\langle x-y, (\nabla f)(b)\rangle|\le \|x-y\|\|(\nabla f)(b)\|$$
Now, since $K$ is compact, $f$ takes a maximum and a minimum values on $K$, so that $\exists b'\in K$ such that $\|(\nabla f)(b') \|\ge \|(\nabla f)(b) \|$, for all $b\in K$. Let $c\in \mathbb{R}$, $c:=(\nabla f)(b')$, then
$$|f(x)-f(y)|\le\|x-y\|\|(\nabla f)(b)\|\le\|x-y\|\|(\nabla f)(b')\|=c\|x-y\|$$
This implies that $f$ is Lipschitz on $K$ for all $x,y\in K$.

Please let me know if you think my proof is correct or not very much? I'm somewhat concerned about the part with the gradient - how exactly is the maximality of the norm of the gradient related to the EVT, that is to $f$ taking maximum and minimum values? As far as I can tell, the maximum norm of the gradient exists because that is the direction to the maximum (or minimum) point of $f$.

REPLY [14 votes]: The convexity of $K$ is not needed. Suppose the conclusion fails. Then for each $m\in \mathbb N,$ there exist $y_m,x_m \in K$ such that
$$\tag 1 |f(y_m)- f(x_m)| > m|y_m-x_m|.$$
Because $K$ is compact, we can find a subsequence $m_k$ such that the sequences $y_{m_k},x_{m_k}$ converge to points $y,x\in K$ respectively.
Suppose $y\ne x.$ Then $|y-x| > 0.$ For large $k$ we then have
$$|f(y_{m_k})- f(x_{m_k})| > m_k|y_{m_k}-x_{m_k}|> m_k(|y-x|/2)\to \infty$$
This implies $f$ is not bounded on $K.$ But $f$ is continuous on $A,$ hence is continuous on $K,$ hence $f$ is bounded on $K$ by compactness. This contradiction shows $y=x.$
Because $A$ is open we can choose $r>0$ such that $B(x,r)\subset A.$ For large $k$ we then have $y_{m_k},x_{m_k}$ in the compact convex set $\overline {B(x,r/2}) \subset A.$ By $(1),$ your highlighted mean value inequality then fails in this last set, contradiction. Therefore $(1)$ cannot hold, proving the result.