If $f$ is locally Lipschitz on $X$ and $X$ is compact, then $f$ is Lipschitz on $X$.
Solution 1:
First note that locally Lipschitz implies continuous. This said, the argument suggested can be completed as follows. For every $x\in X$ there is an open ball $B_x$ centered at $x$ of radius $\varepsilon_x$ and a constant $M_x$ such that $d(f(x),f(y))\le M_xd(x,y)$ for $x,y\in B_x$. Now consider the open convering consisting of the open balls $B'_x$ of center $x$ and radius $\varepsilon_x/2$, and by compactness extract a finite subcovering $B'_{x_1},\dots,B'_{x_r}$. In this situation: $$ \delta=\min\big\{\frac{\varepsilon_{x_i}}{2}: i=1,\dots,r\big\}>0\quad\text{and}\quad K=\max\{d(f(x),f(y)): x,y\in X\} $$ exists by compactness and continuity. Then pick a positive constant $$ L\ge \frac{K}{\delta}, M_{x_1},\dots,M_{x_r}. $$ We see that $f$ is $L$-Lipschitz. Indeed,
(1) if $d(x,y)<\delta$, as $x\in B'_{x_i}$ for some $i$ we have $$ d(y,x_i)\le d(y,x)+d(x,x_i)<\delta+\frac{\varepsilon_{x_i}}{2}\le\varepsilon_{x_i}, $$ hence $x,y$ are both in $B_i$ and $$ d(f(x),f(y))<M_id(x,y)\le L\,d(x,y), $$
(2) if $d(x,y)\ge\delta$ we have $$ d(f(x),f(y))\le K=\frac{K}{\delta}\delta\le L\,d(x,y). $$ We are done.