# Show that the extension of $f : S → \mathbb{R}$ to the closure of its domain, $\overline{S}$, is unique

I trying to solve the following question

Assume that $f : S → \mathbb{R}$ is a uniformly continuous function deﬁned on a subset $S$ of a metric space $M$.
1. Prove that $f$ extends to a uniformly continuous function $f : \overline{S} → \mathbb{R}$.
2. Prove that $\overline{f}$ is the unique continuous extension of $f$ to a function deﬁned on $\overline{S}$.
3. Prove the same things when $\mathbb{R}$ is replaced with a complete metric space $N$.

For the first question, I show that for some sequence $x_n \in S$ that converges to $\hat{x} \in \overline{S},$ $\overline{f}(x_n)$ converges to $\overline{f}(\hat{x})$ since uniformly continuous functions take Cauchy sequences to Cauchy sequences and since $\mathbb{R}$ is complete. However, I feel like while this shows that $\overline{f}(x_n)$ converges, it does not fully establish that $\overline{f}(x_n)$ converges to $\overline{f}(\hat{x})$.
Is this proof sufficient to show that $f$ extends to a uniformly continuous function $f : \overline{S} → \mathbb{R}$?

For number 3, the same proof applies since I used the completeness of $\mathbb{R}$ as the basis for my proof.

However, I don't understand how I would show that $\overline{f}$ is the unique extension of $f$. Is it sufficient to say that since all sequences in $S$ must converge to their unique limits in $\overline{S}$, $\overline{f}$ must also be unique?

To define $\bar f(\hat x)$, pick any sequence $x_n\to \hat x$ and let $\bar f(\hat x)=\lim f(x_n)$. As you said, this limit exists because $f$ is uniformly continuous.

This $\bar f$ is well-defined, i.e., does not on the particular choice of sequence(s); this is simply because the if we combine tqo sequences $x_n\to\hat x$ and $y_n\to \hat x$, we get another convergent sequence. The function values of this converge, but as $f(x_n)$ and $f(y_n)$ are subsequences of it, we conclude that that $\lim f(x_n)=\lim f(y_n)$, as was to be shown.

Also, $\bar f|_S=f$. This is clear because we can pick the constant sequence $x_n=\hat x$ for $\hat x\in S$.

Finally, $\hat f$ is uniformly continuous. Indeed, let $\epsilon>0$ be given. As $f$ is uniformly continuous, there exists $\delta>0$ such that $d(x,y)<\delta$ implies $|f(x)-f(y)|<\frac13\epsilon$. Then for $\hat x,\hat y\in \bar S$ with $d(\hat x,\hat y)<\frac 13\delta$, and accordingly sequences $x_n\to x$, $y_n\to y$, we have $|f(\hat x)-f(x_n)|<\frac13\epsilon$ and also $d(x_n\hat x)<\frac 13\delta$, if only $n$ is big enough. Likewise, we have $|f(\hat y)-f(y_n)|<\frac13\epsilon$ and $d(\hat y,y_n)<\frac13\delta$ for all sufficiently large $n$. Then for these $n$, we have $d(x_n,y_n)le d(x_n,\hat x)+d((\hat x,\hat y)+d(\hat y,y_n)<\delta$, hence $|f(x_n)-f(y-n)|<\frac13\epsilon$, hence $|f(\hat x)-f(\hat y)|\le |f(\hat x)-f(x_n)|+|f(x_n)-f(y-n)|+|f(y_n)-f(\hat y)|<\epsilon$, as desired.

Thus we have found a uniformly continuous extension of $f$ to all of $\bar S$.

Looking at the definition, we must have $\bar f(\hat x)=\lim_{n\to\infty}f(x_n)$ whenever $x_n\to\hat x$, or else $\hat f$ cannot be a continuous extension of $f$. As such a sequence $S\ni x_n\to\hat x$ exists for all $\hat x\in \bar S$, ew do not have any choice at all, i.e., our $\bar f$ above is the unique continuous extension.

First, you need to define $\overline{f}(\hat{x})$ for $\hat{x}$ in $\overline{S}\setminus S$ in some way.

You can define it as the limit you considered for some fixed sequence that tends to $\hat{x}$.

You can then proceed to show that it is independent/the same for any such sequence. To do this, for example, consider the sequence interleaving the two sequences.

This then more-or-less shows the uniqueness as the value of $g(\hat{x})$ for $\hat{x}$ in $\overline{S}\setminus S$ for every continuous extension must be the limit of $f(x_n)$ for a sequence $x_n \to x$.

What you still need to show is that the function you get is in fact uniformly continuous.

For $x\in \overline S$, there exists a sequence $(x_n) \subset S$ converging to $x$. Define $\overline f$ to be $f$ on $S$ and $\lim f(x_n)$ when $x \notin S$, where $(x_n)$ is any sequence converging to $x$. To show that $\overline f$ is well-defined, you need to prove that if $x_n \to x$ and $y_n \to x$, then $\lim f(x_n) = \lim f(y_n)$. Since $d(x_n,y_n) \to 0$, uniform continuity tells us that $d(f(x_n),f(y_n)) \to 0$, so we are done.

Now let $\epsilon >0$. By uniform continuity of $f$, there is $\delta >0$ such that for $a,b \in S$, $d(a,b) < 2\delta \implies d(f(a),f(b))<\epsilon/2$. For $x,y \in \overline S$, suppose that $d(x,y) < \delta$. There are $(x_n),(y_n) \subset S$ converging to each, and we have $d(x_n,y_n) \to d(x,y)$. There exists $n_0$ such that $|d(x_n,y_n) - d(x,y)| < \delta$, hence $d(x_n,y_n) < 2\delta$, for all $n\ge n_0$, so $d(f(x_n),f(y_n))<\epsilon/2$, for all $n\ge n_0$. By continuity, this gives $d(f(x),f(y)) \le \epsilon/2 < \epsilon$, i.e. $d(\overline f(x), \overline f(y)) < \epsilon$.

Now if $\hat f$ is another extension, then for $x\in \overline S$, choose a sequence $(x_n) \subset S$ converging to $x$. We have $\overline f(x) =\lim f(x_n) = \lim \hat f(x_n) = \hat f(\lim x_n) = \hat f(x)$.

Assuming you have provided the continuous extension, this may be one of those cases where, for uniqueness, the general result gives a clearer idea of what's going on and in fact, is not hard to prove.

Suppose $f:S\to Y$ is continuous and that $Y$ is Hausdorff. Then, there is a most one continuous extension of $f$ to $\overline S:$

Suppose $\overline f$ and $\overline g$ are two different extensions of $f$. This means that we may choose $x\in \overline S$ such that $\overline f(x)\neq \overline g(x).$ Since $Y$ is Hausdorff, we may also choose disjoint neighborhoods, $U$ and $U',$ of $\overline f(x)$ and $\overline g(x),$ respectively. Continuity of $\overline f$ and $\overline g$ now gives us a neighborhood $V$ of $x$ such that $\overline f(V)\subseteq U$ and $\overline g(V)\subseteq U'.$ Now observe that because $x\in \overline S, V$ must contain a point $p$ from $S$. But then $\overline f(p)\in U$ and $\overline g(p)\in U',$ so $\overline f(p)\neq \overline g(p),$ which is a contradiction, since $\overline f$ and $\overline g$ agree on $S$ (they are both extensions of $f$).