Suppose I have $K \subset { \mathbb{R} }^n $ a compact subset,and a continuous function $f : K \to \mathbb{R} $. Given some $\epsilon >0$ prove there exist some $L$ such that for all $x,y \in X$ I have $$|f(x)-f(y) | \leq L |x-y | + \epsilon $$
Now I was able to find some proofs for a similar problem where $K$ is convex but couldn't find a proof that doesn't use convexity.
One thing I considered is to approximate the derivative of $f$ like this $$Df \approx \frac{f(x)-f(y)}{x-y} - \epsilon $$ and somehow prove that the approximation is bounded but couldn't come up with a proof, maybe the mean value theorem may help.
How can I show this?
Now given $\epsilon$, there is $\delta$ so that $|x-y|<\delta$ implies $|f(x)-f(y)|<\epsilon$: such $\delta$ exists since $K$ is compact so $f$ is uniformly continuous; also note $f$ is bounded, so $|f|\leq M$ for some $M$. So we can let $L=\frac{2M}{\delta}$: if $|x-y|<\delta$, then $|f(x)-f(y)|<\epsilon\leq L|x-y|+\epsilon$; if $|x-y|\geq\delta$, then $$ |f(x)-f(y)|\leq |f(x)|+|f(y)|\leq 2M=\frac{2M}{\delta}\delta=L\delta \leq L|x-y|<L|x-y|+\epsilon. $$
This estimate looks quite weak.