# How to get tietze extension theorm (for metric spaces) with arbitrary co-domain of real valued function

I know the tietze extension theorem on with bounded range namely " If $F$ is a closed subset of a metric space $X$ such that $f:F \to [a,b]$ is a real valued continuous function , then there is a continuous function $f:X \to [a,b]$ such that $f(F)=g(F)$ , now I was thinking if I didn't know whether I can extend the function if the original function did not necessarily have a bounded range that is say I only know $f :F \to \mathbb R$ , then can I get a continuous extension function $g: X \to \mathbb R$ ? I was first thinking to reduce $f$ to a bounded function by $\arctan f :F \to (-\pi /2 , \pi /2)$ but I can't work with open intervals , so I have to write $\arctan f :F \to [-\pi/2 , \pi /2]$ , then I can extend it to some $g':X \to \mathbb [-\pi /2 , \pi /2]$ , but I cannot then just take $\tan g'$ to get my required $g$ as I don't know whether $g'$ will take one of the values $-\pi / 2$ or $\pi / 2$ or not , because if it takes one of these values then $\tan g'$ becomes undefined . One method I saw but did not understand is that they start with any $f :F \to \mathbb R$ , then they construct $\dfrac{f}{1+|f|}:F \to [0,1]$ , then they apply tietze extension to get $h :X \to [0,1]$ .

Now since $\dfrac{f}{1+|f|}=\dfrac{|f|}{1+|f|}=h_{|F}$ cannot be $1$ on $F$ , and $h$ is continuous , so $F , h^{-1}(\{1\})$ are disjoint closed sets in $X$ , so we get a continuous function $\phi :X \to [0,1]$ such that $\phi=1$ on $F$ and $\phi=0$ on $h^{-1}(\{1\})$ , then they say $\dfrac{\phi. h}{1- \phi . h} :X \to \mathbb R$ is the required extension function of $f$ . Now I don't understand this ( I don't even understand how is $\phi . h$ never $1$ !!) . So please help , in either understanding this construction or give some alternative one for tietze extension theorem with any co-domain . Thanks in Advance

The main problem I see is why $\frac{f}{1+|f|}\ge0$, unless one accepts $f\ge0$, that is, $|f|=f$. If that is the case, then everything goes fine.
First suppose $\phi\cdot h=1$. Since both factors are $\ge0$ and $\le 1$, the product is $1$ only if both are $1$, but by construction $h=1$ implies $\varphi=0$. This settled, on $F$ we have $$\frac{\phi\cdot h}{1-\phi\cdot h}=\frac{h}{1-h}=\frac{\frac{f}{1+f}}{1-\frac{f}{1+f}}=f.$$
It remains the restriction $f\ge0$, but for arbitrary $f$ we can write the usual decomposition $f=f^+-f^-$ into positive and negative parts, namely $$f^+=\tfrac{1}{2}(f+|f|)\ge0,\quad f^-=\tfrac{1}{2}(|f|-f)\ge0.$$ By the previous case, both $f^+$ and $f^-$ have extensions, say $h_1$ and $h_2$, and then $h_1-h_2$ extends $f$.