# Existence of continuous function in metric space

Given a metric space $(X,d)$ with closed set $C$ ($C\neq \emptyset$) and a point $m\in X-C$. Prove that there exists a continuous function $f: X\rightarrow [0,1]$ such that:

(a) $f(m) = 0$ and $f(C)=1$.

(b) If $X$ is countable, the function $f$ can be chosen such that its image is the set $\left\{0,1\right\}$, $f(m) = 0$ and $f(C)=1$.

I have thought of this problem for a while, but haven't been able to make any progress. Can someone please give some help, with details if possible, on either part?

For the first question, take the function

$$f(x) = \left\lbrace \begin{array} .1-\frac{d(x,C)}{d(m,C)} & \text{if} & d(x,C)\leq d(m,C) \\ 0 & \text{if} & d(x,C)> d(m,C) \end{array} \right.$$

With $$d(x,C) = \inf_{y\in C} d(x,y)$$

For the second question, the function is a little more complex.

As $X$ is countable, there is only a countable number of value of $\lambda\in ]0,1[$ such that

$$\left\lbrace x \in X : d(x,m) = \lambda d(m,C) \right\rbrace \neq \emptyset$$

Let's take $\lambda_0$ such that this set is empty, and define :

$$\left\lbrace \begin{array} .f(x) = 0 & \text{if} & d(m,x) < \lambda_0 d(m,C) \\ f(x) = 1 & \text{if} & d(m,x) > \lambda_0 d(m,C) \end{array}\right.$$

And we can show that this function is continuous

• Thanks for your prompted help. Based on your definition of $d(x,C)$, $f(x)$ should be obviously continuous since the ratio on the RHS is just a well-defined number. However, I'm not sure how f(x) can be guaranteed to be $>=0$, since $x$ can be some points out of $C$ just like the given point $m$? – user177196 Mar 5 '15 at 5:31
• The notation is a little heavy ;) $$d^{-1}( [0,\lambda_0 d(m,C) [ ) = \left\lbrace x \in X : d(x) \in [0,\lambda_0 d(m,C) [ \right\rbrace$$ or in other words, $$d^{-1}( [0,\lambda_0 d(m,C) [ ) = \left\lbrace x \in X : 0\leq d(x,m) < \lambda_0 d(m,C) \right\rbrace$$ – Tryss Mar 5 '15 at 23:22
• Did you mean there exists countable $\lambda_0$ in $[0,1]$ in the first post? – user177196 Mar 5 '15 at 23:24
• – Tryss Mar 5 '15 at 23:27