Let \(X\subset\mathbb R^n\) be compact and let \(f:X\to\mathbb R\) be continuous. Given \(\varepsilon>0\), show that there exists \(M\) such that for all \(x,y\in X\), \[ |f(x)-f(y)|\le M|x-y|+\varepsilon. \]
Solution
1. There is a number \(\delta>0\) such that\[ \norm{x-y}<\delta \quad\Longrightarrow\quad \abs{f(x)-f(y)}<\varepsilon \]for all \(x,y\in X\).
Because \(X\) is compact and \(f\) is continuous, \(f\) is uniformly continuous on \(X\).
2. There is a constant \(B\ge0\) such that\[ \abs{f(x)}\le B \]for every \(x\in X\).
The continuous function \(x\mapsto\abs{f(x)}\) attains a maximum on the compact set \(X\). Let \[ B\coloneqq\max_{x\in X}\abs{f(x)}. \]
3. Set\[ M\coloneqq\frac{2B}{\delta}. \]If \(\norm{x-y}\ge\delta\), then\[ \abs{f(x)-f(y)}\le M\norm{x-y}. \]
By step 2, \[ \abs{f(x)-f(y)} \le \abs{f(x)}+\abs{f(y)} \le 2B. \] Since \(\norm{x-y}\ge\delta\), \[ M\norm{x-y} = \frac{2B}{\delta}\norm{x-y} \ge2B. \]
4. For all \(x,y\in X\),\[ \boxed{\abs{f(x)-f(y)}\le M\norm{x-y}+\varepsilon}. \]
If \(\norm{x-y}<\delta\), step 1 gives \[ \abs{f(x)-f(y)}<\varepsilon\le M\norm{x-y}+\varepsilon. \] If \(\norm{x-y}\ge\delta\), step 3 gives \[ \abs{f(x)-f(y)}\le M\norm{x-y}\le M\norm{x-y}+\varepsilon. \] These two cases exhaust all pairs \(x,y\in X\).
5. Q.E.D.
Step 4 is the required estimate for the constant \(M\) defined in step 3.