$A$ closed subset of metric space. Then there exists a continuous function $f:A \to [0,1] \subset \mathbb R$ with $f^{-1}(0)=A$.

analysisgeneral-topologylimitsmetric-spaces

Suppose $A$ is a closed non-empty subset of a metrix space $(X,d)$. We define the distance from $x\in X$ to the set $A$ as:
$$ d(x,A):= \inf_{a\in A} d(x,a).$$
The problem I then solved is that it turns out that $x\mapsto d(x,A)$ is continuous. We derive some estimates using the triangle inequality and the property of the infimum being the greatest lower bound. We then show with the usual $\epsilon-\delta$ that whenever $x \to x_0$ we get $f(x)\to f(x_0)$ for any $x_0 \in X$.

Now the exercises I am working on suggest that this problem can be used to tackle the following:

There exists a continuous function $f:X \to [0,1] \subset \mathbb R$ with $f^{-1}(0)=A$.

Now I know that continuity implies sequential continuity and that closed sets contain all their limit points. This means that for $(x_n)_{n \in \mathbb N}$ a sequence in $A$ with $x_n \to x$ we know $x \in X$, and also such a function $f$ has the property that $f(x_n) \to f(x)$. I am not entirely sure how the pieces fit together.

Best Answer

Define$$f(x)=\frac{d(x,A)}{1+d(x,A)}.$$Then $f$ is continuous, $f$ is a map from $X$ into $[0,1]$ and $f^{-1}(0)=A$ (since $A$ is closed; in general, $f^{-1}(0)=\overline A$).

Related Question