# Compactly supported continuous function is uniformly continuous

Let $f:\mathbb R \rightarrow \mathbb R$ be continuous and compactly supported. How can I prove that $f$ is uniformly continuous ? I was trying to prove it by contradiction but get stuck. My attempt was as follows:

Let $E$ be the compact support of $f$. On $E$ we know that $f$ is uniformly continuous. If we assume that $f$ is not uniformly continuous we know
$$\exists \epsilon > 0 \forall \delta > 0 \exists x,y \in \mathbb R: |x-y|<\delta \wedge |f(x)-f(y)| \geq \epsilon$$ Let $\delta_n := \frac 1n$ and fix this $\epsilon > 0$. Compute a $\delta > 0$ s.t. $\forall x,y \in E:|x-y| < \delta \rightarrow |f(x)-f(y)| <\epsilon$. Let $n \geq N$ s.t. $\frac 1N < \delta$. Then we may assume wlog that $x_n \in E$ and $y_n \in \mathbb R \setminus E$ wehere $x_n,y_n$ are the points corresponding with $\delta_n$. This gives a sequence of points where $|x_n-y_n| \rightarrow 0$ and $x_n \in E$ and $y_n \in \mathbb R \setminus E$.

I now want to use somehow the continuitiy of $f$. How can I do this ? Is this approach a good one ? Can it be more simple ?

New idea:
I know that $E$ is compact so $(y_n)_{n=0}^\infty$ has a convergent subsequence $(y_{n_j})_{j=0}^\infty$ whit limit say $y \in E$. Now
$$|x_{n_j}-y| \leq |x_{n_j}-y_{n_j}|+|y_{n_j}+y| \rightarrow 0$$ So I can take $x_{n_j}$ close to $y$ to get $|f(x_{n_j})-f(y)| = |f(y)| <\frac \epsilon 2$ by the continuity. I can also take $y_{n_j}$ close to $y$ to get $|f(y_{n_j})-f(y)| <\frac \epsilon 2$. We further have
$$|f(y_{n_j})| \leq |f(y_{n_j})-f(y)| + |f(y)|$$ s.t.
$$|f(y)| \geq |f(y_{n_j})| – |f(y_{n_j})-f(y)| \geq \frac \epsilon 2$$ because $|f(y_{n_j})| \geq \epsilon$ per construction. So we have $|f(y)| \leq \frac \epsilon 2$ and $|f(y)| > \frac \epsilon 2$ which is a contradiction.

New solution: Let $\epsilon > 0$. Let $\delta_1$ for the uniform continuity on $E$. Further
$$\forall x \in E \exists \delta_x > 0 \forall y \in \mathbb R: |x-y|< \delta_x \rightarrow |f(x)-f(y)| < \epsilon$$ Compute an open finite over of $E$
$$E \subseteq \bigcup_{i=1}^N B(x_i,\frac{\delta_{x_i}}2)$$ Write $\delta_i := \delta_{x_i}$. Let $\delta_2 := \min_{i=1,\cdots,N} \frac {\delta_i} 2$ and $\delta := \min(\delta_1,\delta_2)$.

Assume $|x-y|< \delta$. If $x,y \in E$ or $x,y \notin E$ we are done. Otherwise assume $x \in E$ and $y \notin E$. Then $x \in B(x_i,\frac{\delta_i}2)$ for some $i$. Further
$$|y-x_i| \leq |y-x|+|x-x_i|\leq \delta_2 + \frac{\delta_i}2 \leq \delta_i$$ thus $y \in B(x_i,\delta_i)$ which proves the claim.

#### Solutions Collecting From Web of "Compactly supported continuous function is uniformly continuous"

Let us first see what is continuity. Given a positive $\epsilon$, continuity of $f$ means that at each $x$, we can find a small $\delta$ such that $x’\in (x-\delta,x+\delta)$ implies $f(x’)\in (f(x)-\epsilon,f(x)+\epsilon)$. So around each $x$, we have a small open set that is mapped very close to $f(x)$. Also note that points in the same small open set are mapped to points close to each other, since they are both mapped to points close to $f(x)$. But the problem here is that this radius of the open sets $\delta$ depends on the point $x$.

Now compactness means you can find a finite collection of such small open sets that they cover the support of the function, and this is good enough for us. Because among these finitely many open sets, you can determine the smallest radius, say $r$. If the distance between $x$ and $x’$ are less than $1/10r$, then you know they must lie in the same open set, then $f(x)$ and $f(x’)$ must be close. Now this $r$ does not depend on $x$, you have uniform continuity.