# Urysohn's function on a metric space

Let $(X,d)$ be a metric space and $A\subset B\subset X$. $A$ is closed, $B$ is open. If there are developed methods to find at least one (or describe the whole class) of Urysohn's functions for $A$ and $B^c$?

Edited: Martin has already presented a nice example of an Urysohn's function. Now I would like to focus on my second question about the whole class $\mathcal U(A,B^c)$ of Urysohn's functions. I had a function $u$ which is $0$ on $B^c$ and $1$ on A - and I would like to check if it is continuous (so if it is in $\mathcal U(A,B^c)$ class). If there are any sufficient conditions to prove that this function is $\mathcal{U}(A,B^c)$ which allow me pass direct verifying of continuity of $u$, or this question is meaningless and all that I can do - is to verify continuity without theory of Urysohn's functions?

• The question made me wonder whether there is a simpler proof of Tietze's extension theorem (generalizing Urysohn) for the case of metric spaces. Kaplansky states the following on page 130 of Set theory and metric spaces: "If the Tietze theorem admitted an easier proof in the metric case, it would have been worth inserting in our account. But since the metric property does not seem to help, the Tietze theorem should be done in its natural setting of maximum generality." – Jonas Meyer Jun 24 '11 at 8:52
• @Jonas: One might of course argue that - since Tietze's theorem is basically an application of Urysohn and Urysohn is much simpler for metric spaces - Tietze's extension theorem actually is easier for metric spaces. – Sam Jun 24 '11 at 14:28
• @Jonas: Let $A \subset X$ be a closed subset of a metric space and let $f: A \to [0,1]$ be a continuous function. Hausdorff has given the following formula for a Tietze extension $F$ of $f$: $$F(x) = \begin{cases} f(x) & \text{if } x \in A \\ \inf{\left\{f(a) + \frac{d(x,a)}{d(x,A)} - 1\,:\,a \in A\right\}} & \text{if } x \in X \smallsetminus A\end{cases}$$ it is not hard to verify that $F$ is indeed continuous and the case of unbounded functions is obtained by considering $\arctan{f}$ in place of $f$. (I found this in Engelking's General topology, exercise 4.1.F). – t.b. Mar 12 '12 at 13:22
• @t.b. So Kaplansky was wrong and didn't know Hausdorff's result? – Georges Elencwajg Mar 19 '12 at 21:16
• Dear @Georges I think one could argue that this conclusion is justified. The metric property definitely helps, whether the proof is much shorter is a different issue. – t.b. Mar 19 '12 at 21:32

EDIT 2: As pointed out by Theo, my original solution will work only if $d(A,B^c)>0$. (E.g. if $A$ or $B^c$ is compact.) However, the solution taken from Amman's and Escher's book (see EDIT 1 below) works for arbitrary $A$ and $B$.

Let us denote $\delta=d(A,B^c)$.

Let us define $f(x)=\frac1\delta d(x,A)$. This functions is continuous, $f(a)=0$ for $a\in A$ and $f(b)\ge 1$ for $b\in B^c$.

Similarly define $g(x)=\frac1\delta d(x,B^c)$.

Now define $f'(x)=\min\{1,f(x)\}$ and $g'(x)=\min\{1,g(x)\}$. These functions have similar properties, and additionally they have values in $[0,1]$.

There are several choices for the Urysohn function for $A$ and $B^c$:

$\frac{f'(x)+(1-g'(x))}2$, $\max\{f'(x),1-g'(x)\}$, $\min\{f'(x),1-g'(x)\}$.

I hope I have not overseen some mistake in the above reasoning.

EDIT 1: According to Proposition 4.13 in Amman, Escher: Analysis III, another such function is $\frac{d(x,A)}{d(x,A)+d(x,B^c)}$. I have to admit that this is much more elegant construction than mine. (In my notation it is $\frac{f(x)}{f(x)+g(x)}$.)

• Beware that your $\delta$ may be zero (I suppose $d(X,Y) = \inf_{x \in X, y \in Y} d(x,y)$). Take $A = \{y = 0\}$ and $B = \{y = 1/x\}^c$ in $\mathbb{R}^2$. Amman-Escher's function works, though. – t.b. Jun 24 '11 at 9:32
• @Theo: Thanks for noticing it. I've edited my answer. – Martin Sleziak Jun 24 '11 at 12:24

Consider $f: X \to [0,1]$ given by

$$f(x) = \frac {d(x,A)} {d(x,A) + d(x,B^c)} \ .$$

$f$ is well-defined because the denominator is $0$ if and only if $x \in A \cap B^c = \emptyset$.

We have $f(x) = 0 \iff x \in A$ and $f(x) = 1 \iff x \in B^c$.