Solution (source code)

= Solution

<Urysohn's lemma> states that disjoint closed subsets $A,B$ of a normal space admit a continuous $u:X\to[0,1]$ with $u|_A=0$ and $u|_B=1$. Using the usual convention, normal spaces are also $T_1$.

The <Tietze extension theorem> states that a continuous real-valued function on a closed subset of a normal space extends continuously to the whole space. If its range lies in a closed bounded interval, the extension may be chosen in that same interval.

Prove first the interval version for $f:S\to[-1,1]$. If a continuous residual $r$ on $S$ obeys $|r|\le M$, the sets $\{r\le-M/3\}$ and $\{r\ge M/3\}$ are disjoint closed subsets of $X$. <Urysohn's lemma> gives a continuous $h:X\to[-M/3,M/3]$ taking the endpoint values on those two sets. On each of the three ranges of $r$, it follows that $|r-h|\le2M/3$ on $S$. Repeating with $M_j=(2/3)^j$ produces $h_j$ with $\|h_j\|_\infty\le M_j/3$ and a residual bounded by $M_{j+1}$. The series $\widetilde f=\sum_{j\ge0}h_j$ converges uniformly, has absolute value at most $\sum M_j/3=1$, is continuous and restricts to $f$ as the residual tends to zero. Rescaling proves every closed bounded interval version.

For unbounded $f$, first extend $f/(1+|f|)$ to $g:X\to[-1,1]$. The <closed set> $B=g^{-1}(\{-1,1\})$ is disjoint from $S$. <Urysohn's lemma> gives $\psi:X\to[0,1]$ with $\psi|_S=1$ and $\psi|_B=0$. Then $h=\psi g$ takes values strictly between minus one and one everywhere and equals $f/(1+|f|)$ on $S$. Thus $h/(1-|h|)$ is a continuous real-valued extension of $f$, proving the full theorem.

\b[Statement 1 is true:] <metric spaces> are normal, and the bounded interval form applies. \b[Statement 2 is true:] <compact Hausdorff spaces> are normal, and the unrestricted real-valued form applies. \b[Statement 3 is false.] For a counterexample, let $X=\{a,b,c\}$ have open sets $\varnothing,\{a\},\{a,b\},\{a,c\},X$. The subset $S=\{b,c\}$ is closed and discrete, so $f(b)=-1$, $f(c)=1$ is continuous on it. Every open neighborhood of $b$ or $c$ in $X$ contains $a$. A continuous extension would pull back disjoint neighborhoods of minus one and one to disjoint open sets containing $b$ and $c$, yet both would contain $a$. This is impossible.