[Math] Continuous extension of uniformly continuous functions

real-analysisuniform-continuity

This topic has been asked a lot and it is an exercise in the Principle of Mathematical Analysis by Rudin (Chapter 4 Problem 13):

Let $E$ be a dense subset of a metric space $X$, and the function $f:E\to\Bbb{R}$ is uniformly continuous. Prove that $f$ has a continuous extension from $E$ to $X$.

A quick search on Google returns usually a basic approach by using Cauchy sequence:

  1. Let $x\in X$. Then there exists a sequence $(x_n)$ in $E$ such that $x_n\to x$ by density of $E$. One can show that $\{f(x_n)\}$ is Cauchy and thus the limit $$\lim f(x_n)$$ exists since $\Bbb{R}$ is complete.

  2. Define $g(x):=\lim_{n\to\infty} f(x_n)$. One can show that $g:X\to \Bbb{R}$ is a well-defined function since if $(x_n)$ and $(y_n)$ are two Cauchy sequences in $E$ converging to $x$, then
    $$
    \lim_{n\to\infty} f(x_n)=\lim_{n\to\infty} f(y_n).
    $$

  3. Taking the constant sequence in $E$, we see that $g|_E=f$. We get $g$ as a desired (unique) extension of $f$.

Here is my question: why is $g:X\to\Bbb{R}$ continuous?


Since we are working in a metric space, it suffices to show that for any sequence $(x_n)$ in $X$ with $x_n\to x$,
$$
\lim_n g(x_n)=g(x)\tag{*}
$$
If $(x_n)$ is in $E$, then this is true by definition of $g$ and the observation that $g|_E=f$. (Lots of the proofs I saw online stop here.) But if $(x_n)$ is in $X$, why is (*) still true?

Best Answer

One can actually show that $g$ is uniformly continuous on $X$. Let $x,y\in X$, and $(x_n)$, $(y_n)$ in $E$ with $x_n\to x$, $y_n\to y$. Then the estimates $$ |g(x)-g(y)|\leq |g(x)-f(x_n)|+|f(x_n)-f(y_n)|+|g(y)-f(y_n)|\\ |x_n-y_n|\leq|x_n-x|+|y_n-y|+|x-y| $$ combined with the assumption that $f$ is uniformly continuous on $E$ yields the uniform continuity of $g$ on $X$.