0

Prove that a subset $E$ of a metric space $X$ is open if and only if there exists a continuous function $f\colon X\to \mathbb{R}$ such that $E=\{x\in X\mid f(x)\gt 0\}$.

I would appreciate guidance on how to structure this proof, as well as any general insights about why this result holds.

What I've Tried: Direction 1 (If such an $f$ exists, show $E$ is open): Here, I understand that if $f$ is continuous, then $E=\{x∈X:f(x)>0\}$ should be open because it’s the preimage of $(0,\infty)$, which is open in $\mathbb{R}$. However, I’d like to confirm if this reasoning is sufficient. I am also stuck regarding direction 2.

Medo
  • 3,588
  • 14
  • 32
  • 2
    Hi! Welcome to MSE! You’ll find a mere “how do I do this” is not well received on this website. What have you tried ? Where are you stuck? – MyMathYourMath Nov 13 '24 at 18:29
  • What I've Tried: Direction 1 (If such an f exists, show E is open): Here, I understand that if f is continuous, then E={x∈X:f(x)>0} should be open because it’s the preimage of (0,∞), which is open in R. However, I’d like to confirm if this reasoning is sufficient. I am also stuck regarding direction 2. – takis skylos Nov 13 '24 at 18:32
  • 4
    Consider $x\mapsto d(x,E^c)$ – Andrew Nov 13 '24 at 19:14
  • @Medo $d(x,E^c) = d({x},E^c)$ and ${x}$ is a compact set disjoint from the closed set $E^c$. – Andrew Nov 13 '24 at 19:26
  • @Andrew. Yes. Correct. – Medo Nov 13 '24 at 19:27

1 Answers1

2

($\impliedby$) This is the easy direction: a function $f: X \to \mathbb{R}$ is continuous if the preimage of any open set in $\mathbb{R}$ is open in $X$. Since $(0, \infty)$ is open in $\mathbb{R}$, then $E$ is open in $X$.

($\implies$) Consider the function $f: X \to \mathbb{R}$ given by $f (x) = \inf_{y \in X - E} \{ d (x, y) \}$. We show that it satisfies the desired properties.

Since $E$ is open in $X$, for any $x \in E$, there is some $r > 0$ such that $B_d (x, r) \subseteq E$. Therefore, $f (x) = \inf_{y \in X - E} \{ d (x, y) \} \ge r$ so $f (x) > 0$. On the other hand, if $x \notin E$, then $d (x, x) = 0 \implies f (x) = 0$.

To show that $f$ is continuous, note that for any $x, y \in X$, it is true that $d (x, X - E) \le d (x, y) + d (y, X - E)$, which can be proven by taking the infimum over $X - E$ of the regular triangle inequality. Then, for arbitrary $\varepsilon > 0$, if we stipulate $d (x, y) < \delta \equiv \varepsilon$, then $|d (x, X - E) - d (y, X - E)| \le d (x, y) < \varepsilon$, as desired.

K. Jiang
  • 10,436