# Continuous with compact support implies uniform continuity

This might be a duplicate but I tried googling the MSE site and could not find a satisfactory answer.

Let $(X, d)$ be a metric space and $f$ be a real valued continuous function on $X$. Suppose $f$ has a compact support. Does this imply the uniform continuity of $f$?

I tried proving this statement, but only for locally connected spaces have I succeeded in doing so. Is thus true for general metric spaces? I just couldn't provide a proof (or a counterexample) by myself. Please enlighten me.

• Isn't it a direct application of Heine theorem? (which is easier than locally connected spaces btw) – md5 Jan 6 '17 at 13:52
• @md5 : Could briefly explain how to choose $\epsilon$ for the whole space? Not just for the points in $\operatorname{supp}(f)$? – Dilemian Jan 6 '17 at 14:02
• I added it as an answer. You may need an other argument of compacity to get information at the frontier of the support. – md5 Jan 6 '17 at 14:41

## 2 Answers

Let $f:X\to\mathbf{R}$ satisfying your hypotheses. There exists $K$ compact s.t. $f_{|X \setminus K}=0$.

Let's show $f$ is uniformly continuous. Let $\epsilon>0$. By Heine theorem applied to $f_{|K}$, $f$ is uniformly continuous on $K$:

$$\exists \delta_1>0 \; \forall (x, y) \in K^2 \; d(x,y) < \delta_1 \implies |f(x)-f(y)| < \epsilon$$

If $(x, y) \in (X\setminus K)^2$, $\delta_1$ works.

Now suppose by contradiction that there exists $\epsilon>0$ s.t. for all $n \in \mathbf{N}$, there exists $x_n \in K$, $y_n \in X\setminus K$ s.t. $d(x_n, y_n) < 2^{-n}$ and $|f(x_n) - f(y_n)| > \epsilon$. $(x_n)$ lies in a compact space, so there exists $\sigma$ strictly increasing and $x \in K$ s.t. $x_{\sigma(n)} \to x$. Then $y_{\sigma(n)} \to x$, but $|f(x_{\sigma(n)}) -f(y_{\sigma(n)})| > \epsilon$, thus $f$ is not continuous in $x$, contradiction.

Hence:

$$\exists \delta_2>0 \; \forall (x, y) \in K \times (X \setminus K) \; d(x,y) < \delta_2 \implies |f(x)-f(y)| < \epsilon$$

Finally $\delta = \min(\delta_1, \delta_2)$ works.

Let $X_1=X$ \ $f^{-1}\{0\}.$

(1). For $r>0$ there exists $s>0$ such that $\forall x\in \overline {X_1}\;(|f(x)|\geq r\implies B_d(x,s)\subset \overline {X_1}).$

If not, then for $n\in \mathbb N,$ take $x_n\in \overline {X_1}$ and $y_n\in X$ \ $\overline {X_1}$ with $|f(x_n)|\geq r$ and $d(x_n,y_n)<1/n.$ By compactness of $\overline {X_1}$, take a convergent subsequence $(x_{n_i})_i$ converging to $p\in \overline {X_1}.$ Then $(f(x_{n_i}))_i$ converges to $f(p),$ so $|f(p)|\geq r.$ But $(y_{n_i})_i$ also converges to $p,$ and $f(y_{n_i})=0,$ contradicting the continuity of $f.$

(2). For $r>0,$ take $s>0$ such that $$\cup \{B_d(x,s): |f(x)|\geq r \} \subset \overline {X_1}.$$ Now $f|_{\overline {X_1}}$ is uniformly continuous because $\overline {X_1}$ is compact. So Take $s'\in (0,s)$ such that $$\forall x,y\in \overline {X_1}\;(d(x,y)<s'\implies |f(x)-f(y)|<r).$$ Now if $x\in \overline {X_1}$ and $y\in X$ \ $\overline {X_1}$ with $d(x,y)<s'<s$ then $|f(x)|<r$, so $|f(x)-f(y)|=|f(y)-0|<r.$ And of course if $x,y \in X$ \ $X_1$ then $|f(x)-f(y)|=0<r.$

• @rt6. Sorry for my first comment, which only makes sense if $X=\mathbb R$. I meant my answer to be the finishing part of yours, as it was too long for a comment. I saw your A is deleted, so I re-wrote my A. – DanielWainfleet Jan 6 '17 at 16:33