Trying to prove Tietze extension theorem I am trying to prove Tietze extension theorem for metric spaces that is " If $X$ is a metric space , $F$ is a closed set in $X$ and $f:F \to [0,1]$ is a continuous function , then there is a continuous function $g:X \to \mathbb R$ such that $g(x)=f(x) , \forall x \in F$ " . I have seen the proof that uses uniformly convergent sequence of functions $\{g_n\}$ and define the extension as the limit functions , but I quite don't like this proof . I saw the proof which defines the extension as $g(x)=f(x) , \forall x\in F$ and $g(x)=\inf\{f(a)+\dfrac{d(x,a)}{dist (x,F)} -1:a \in  F\} , \forall x \in X \setminus F$ , but I ma unable to prove that this $g$ is continuous on $X$ . Please help in this proof . Also is there any other proof of the extension theorem ? Thanks in advance 
 A: Here is a proof for the continuity of $g$.
Note: I have slightly changed you notations/assumptions: I am writing $A$ instead of $F$, and I only assume that $f$ is bounded instead of $f : A \to [0,1]$.
$\newcommand{\R}{\mathbb{R}} \newcommand{\dist}{\mathrm{dist}}$
For brevity, let us define
$$
\gamma_{a}:X\to\R,x\mapsto f\left(a\right)+\frac{d\left(x,a\right)}{\dist\left(x,A\right)}-1\qquad\text{for }a\in A.
$$
Let $x_{0}\in X$. We want to prove that $g$ is continuous at $x_{0}$.
For this, we distinguish two cases:
Case 1: $x_{0}\in X\setminus A$. Since $A$ is closed, there
is $r>0$ such that $B_{2r}\left(x_{0}\right)\subset X\setminus A$.
For $x\in B_{r}\left(x_{0}\right)$, we then have $\dist\left(x,A\right),\dist\left(x_{0},A\right)\geq r$,
and in particular $x\in X\setminus A$. We now see for arbitrary $a\in A$
that
\begin{align*}
& \left|\gamma_{a}\left(x\right)-\gamma_{a}\left(x_{0}\right)\right| \\
& =\left|\frac{d\left(x,a\right)}{\dist\left(x,A\right)}-\frac{d\left(x_{0},a\right)}{\dist\left(x_{0},A\right)}\right|\\
 & =\left|\frac{d\left(x,a\right)\dist\left(x_{0},A\right)-d\left(x_{0},a\right)\dist\left(x,A\right)}{\dist\left(x,A\right)\dist\left(x_{0},A\right)}\right|\\
 & \leq r^{-2}\cdot\Bigl(\dist\left(x_{0},A\right)\cdot\left|d\left(x,a\right)-d\left(x_{0},a\right)\right|+d\left(x_{0},a\right)\cdot\left|\dist\left(x_{0},A\right)-\dist\left(x,A\right)\right|\Bigr)\\
 & \leq\frac{\dist\left(x_{0},A\right)+d\left(x_{0},a\right)}{r^{2}}\cdot d\left(x_{0},x\right)=:C_{x_{0}}\cdot d\left(x_{0},x\right).
\end{align*}
This implies
\begin{align*}
g\left(x\right) & =\inf_{a\in A}\gamma_{a}\left(x\right)\leq C_{x_{0}}\cdot d\left(x_{0},x\right)+\inf_{a\in A}\gamma_{a}\left(x_{0}\right)=C_{x_{0}}\cdot d\left(x_{0},x\right)+g\left(x_{0}\right),\\
g\left(x_{0}\right) & =\inf_{a\in A}\gamma_{a}\left(x_{0}\right)\leq C_{x_{0}}\cdot d\left(x_{0},x\right)+\inf_{a\in A}\gamma_{a}\left(x\right)=C_{x_{0}}\cdot d\left(x_{0},x\right)+g\left(x\right),
\end{align*}
and thus $\left|g\left(x\right)-g\left(x_{0}\right)\right|\leq C_{x_{0}}\cdot d\left(x_{0},x\right)\to0$
as $x\to x_{0}$. This proves that $g$ is continuous at $x_{0}$
for $x_{0}\in X\setminus A$.
Case 2: $x_{0}\in A$. Let $\varepsilon\in\left(0,1\right)$.
By assumption, $f$ is bounded, say $\left|f\right|\leq C$ for some
$C\geq1$. Since $f$ is continuous, there is $\delta>0$ such that
$\left|f\left(a\right)-f\left(x_{0}\right)\right|\leq\frac{\varepsilon}{2}$
for all $a\in A$ satisfying $d\left(a,x_{0}\right)\leq\delta$. Now,
let $\theta:=\frac{\delta}{6C}\leq\frac{\delta}{3}$, and let $x\in B_{\theta}\left(x_{0}\right)$
be arbitrary. Then there are two cases:
Case a: $x\in A$. In this case, we simply have $\left|g\left(x\right)-g\left(x_{0}\right)\right|=\left|f\left(x\right)-f\left(x_{0}\right)\right|\leq\frac{\varepsilon}{2}\leq\varepsilon$.
Case b: $x\in X\setminus A$. Choose $a\in A$ such that
$d\left(x,a\right)\leq\left(1+\frac{\varepsilon}{2}\right)\cdot\dist\left(x,A\right)$,
and note that
$$
d\left(a,x_{0}\right)\leq d\left(a,x\right)+d\left(x,x_{0}\right)\leq2\cdot\dist\left(x,A\right)+d\left(x,x_{0}\right)\leq3\cdot d\left(x,x_{0}\right)\leq\delta.
$$
Therefore, $\left|f\left(a\right)-f\left(x_{0}\right)\right|\leq\frac{\varepsilon}{2}$,
and thus
$$
g\left(x\right)\leq\gamma_{a}\left(x\right)=f\left(a\right)+\frac{d\left(x,a\right)}{\dist\left(x,A\right)}-1\leq f\left(x_{0}\right)+\frac{\varepsilon}{2}+\left(1+\frac{\varepsilon}{2}\right)-1=f\left(x_{0}\right)+\varepsilon=g\left(x_{0}\right)+\varepsilon.
$$
Conversely, for $b\in A$ there are two cases:
Case i: If $d\left(b,x_{0}\right)\leq\delta$, then 
$$
\gamma_{b}\left(x\right)=f\left(b\right)+\frac{d\left(x,b\right)}{\dist\left(x,A\right)}-1\geq f\left(b\right)\geq f\left(x_{0}\right)-\varepsilon.
$$
Case ii: If $d\left(b,x_{0}\right)>\delta$, then $d\left(x,b\right)=d\left(b,x\right)\geq d\left(b,x_{0}\right)-d\left(x_{0},x\right)\geq\frac{2}{3}\delta$
and hence
\begin{align*}
\gamma_{b}\left(x\right) & =f\left(b\right)+\frac{d\left(x,b\right)}{\dist\left(x,A\right)}-1\\
 & \geq f\left(b\right)+\frac{d\left(x,b\right)}{d\left(x,x_{0}\right)}-1\\
 & =f\left(b\right)+\frac{d\left(x,b\right)-d\left(x,x_{0}\right)}{d\left(x,x_{0}\right)}\\
 & \geq-C+\frac{\delta/3}{d\left(x,x_{0}\right)}\\
 & \geq-C+\frac{\delta/3}{\theta}=C\geq f\left(x_{0}\right)\geq f\left(x_{0}\right)-\varepsilon.
\end{align*}
Overall, we have shown for all $b\in A$ that $\gamma_{b}\left(x\right)\geq f\left(x_{0}\right)-\varepsilon=g\left(x_{0}\right)-\varepsilon$,
and hence 
$$
g\left(x\right)=\inf_{b\in A}\gamma_{b}\left(x\right)\geq g\left(x_{0}\right)-\varepsilon.
$$
In summary, we have shown $\left|g\left(x\right)-g\left(x_{0}\right)\right|\leq\varepsilon$
for all $x\in B_{\theta}\left(x_{0}\right)$. Thus, $g$ is continuous
at $x_{0}$ for every $x_{0}\in A$.
