Continuous extension on compact set in $\mathbb{R}^n$ I'm an undergrad student reading through Deimling's Nonlinear Functional Analysis and have come across the following proposition.
Let $A\subset\mathbb{R}^n$ be compact and $f:A\to\mathbb{R}^n$ be a continuous function. Then there exists a continuous extension $\tilde{f}:\mathbb{R}^n\to\mathbb{R}^n$ such that $\tilde{f}(x)=f(x)$ for all $x\in A$.
The proof goes as follows:
Let $S=\{a_1,a_2,\ldots\}$ be a countable dense subset of $A$ and define
$$\varphi_i(x) := \max\left\{ 2-\frac{|x-a_i|}{\rho(x,A)},0 \right\}\quad\text{for $x\not\in A$}$$
where $\rho$ denotes distance. Then the function
$$ \tilde{f}(x) =\begin{cases}
f(x),&x\in A\\
\left(\sum_{i\geq1}2^{-i}\varphi_i(x)\right)^{-1}\left(\sum_{i\geq1}2^{-i}\varphi_i(x)f(a_i)\right),&x\not\in A
\end{cases} $$
satisfies the extension. QED.
My understanding: Clearly, $\tilde{f}$ is continuous on the interior of $A$ and using the Weierstrass M-test I can show that $\tilde{f}$ is continuous on $\mathbb{R}^n\backslash A$. All that remains is to show that $\tilde{f}$ is continuous on the boundary of $A$ and this is where I am having no luck.
Apologies in advance if the following is not clear, but I'm not sure how to proceed.
As I play around with the expression for $\tilde{f}$ at some $x\in\mathbb{R}^n\backslash A$, it almost seems like we have a weighted average of values of $f$ on $A$ near $x$. However, my intuition begins to break down when looking at any finite sum because it seems that the order of enumeration of each $a_i$ may have more of an effect in the sum than the closeness of $a_i$ to $x$, i.e. the closer values may appear too late in the sum and the factor $2^{-i}$ may make these values insignificant. Maybe the division by the first factor accommodates for this, but I cannot be sure exactly what's going on here. Can anyone clarify my intuition here or, better yet, give me some hints on how to show continuity on the boundary of $A$?
Thanks
 A: Here's what I've got. Take any $x_0\in A$ and any sequence $(x_i)$ which converges to $x_0$ (and assume that all $x_i$ are not in $A$). We have to show that $\tilde{f}(x_i)$ converges to $f(x_0)$. So take any $\varepsilon > 0$. There exists $\delta > 0$ such that for any $a_i\in B_\delta(x_0)$ we have $|f(a_i)-f(x_0)| < \varepsilon$. Now there is $\delta_1 > 0$ such that for any $x\in B_{\delta_1}(x_0)$ we have $\varphi_i(x) = 0$ as soon as $a_i$ is not in $a_i\in B_\delta(x_0)$ (This is because $|x - a_i|$ is greater than $\delta - \delta_1$, if I'm correct, and so when we reduce $\delta_1$, $|x - a_i|$ only grows, whereas $\rho(x,A)$ tends to zero, hence the fraction shall increase and when $\delta_1$ is appropriate, it shall be greater than 2).
Since $x_i$ converges to $x_0$, all $x_i$ must be in $x\in B_{\delta_1}(x_0)$ starting from some number $i_0$. We claim that, starting from this number, $\tilde{f}(x_i)$ are going to be sufficiently close to $f(x_0)$.
Indeed, consider (we take into account addants where we do not know for sure that $\varphi_i\neq 0$, and we know for sure that if they are not zeroes (according to our choice of the respective neighborhood), then $|f(a_i) - f(x_0)| < \varepsilon$) $$|\frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)f(a_i)}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)} - f(x_0)| = |\frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)f(a_i)}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)} - \frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)}f(x_0)| =  |\frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)f(a_i)}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)} - \frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)f(x_0)}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)}|\le \frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)|f(a_i) - f(x_0)|}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)} < \frac{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)}{\sum_{\varphi_i\neq 0}2^{-i}\varphi_i(x)}\varepsilon = \varepsilon,$$
which seems to be the thing we wanted to prove...
 
