# If and only if proof dealing with a function that is uniformly continuous.

Let $-\infty\leq a<b\leq \infty$. Prove that a function $f$ is uniformly continuous on the interval $(a,b)$ if and only if it has a uniformly continuous extension to all of $\mathbb{R}$.

Definition: A function $f: D \longrightarrow \mathbb{R}$ is uniformly continuous on $D$ if for every $\epsilon > 0$ there exists some $\delta > 0$ such that $|f(x) - f(y)| < \epsilon$ whenever $|x-y|<\delta$.

My attempt:

($\longrightarrow$) Suppose $f$ has a uniformly continuous extension to all of $\mathbb{R}$. In other words, there exists a uniformly continuous function $g:\mathbb{R}\longrightarrow \mathbb{R}$ such that $g(x) = f(x)$ for all $x\in(a,b)$. But since $g$ is uniformly continuous on all of $\mathbb{R}$, then of course it is uniformly continuous on $(a,b)$, which means $f$ is uniformly continuous on $(a,b)$.

Does that work? and how would you show the other direction?

-

($\Leftarrow$) Clearly if $f$ has a uniformly continuous extension to all of $\mathbb{R}$, then it is uniformly continuous on the restriction to $(a,b)$.
($\Rightarrow$) Let $f$ be uniformly continuous on $I=(a,b)$. If $f$ has a uniformly continuous extension to $\overline{I}=[a,b]$, then we can further extend $f$ by defining $f(x) =f(a)$ for $x < a$ and $f(x) = f(b)$ for $x>b$. It is clear that this function is uniformly continuous on $\mathbb{R}$.
To show that $f$ has a uniformly continuous extension to the closure of $I$, choose a sequence $x_i \in I$ such that $x_i \to a$. Let $\epsilon>0$, and pick $\delta>0$ such that if $|x-y|< \delta$, then $|f(x)-f(y)| < \epsilon$. The sequence $x_i$ is Cauchy, hence there exists $N$ such that if $n,m > N$, we have $|x_n-x_m| < \delta$. Then we have $|f(x_n)-f(x_m)| < \epsilon$. Hence $f(x_i)$ is Cauchy and converges to some number $\phi$. To show that the limit does not depend on the sequence, suppose we have another sequence $x_i' \to a$. Since $x_i-x_i' \to 0$, uniform continuity shows that $f(x_i)-f(x_i') \to 0$, and hence $f(x_i') \to \phi$ also. So we can unambiguously define $f(a) = \phi$.
In a similar manner, we can extend $f$ to $b$.