# Continuous Function non-zero only on a given open set

Given an arbitrary open set $U$ in a Hausdorff space $X$, is it possible to construct a continuous function $f:X\to \mathbb C$ such that $\{x\in X\mid f(x)\neq 0\} = U$?

My intuition, mostly due to Urysohn's lemma (even though it is stated for locally compact Hausdorff spaces), seems to think so, though I am having quite a bit of trouble writing one down. If more assumptions need to be made, which ones should they be? Does Urysohn's lemma tell us that this is true for locally compact Hausdorff spaces?

• Isn't $f:C\to X$.? Feb 21, 2017 at 4:29
• @MyGlasses Thanks. Fixed it. Feb 21, 2017 at 4:31
• It is definitely not true for general Hausdorff spaces, as any $X$ with this property is already regular (for any closed $C = X \backslash U$ and $x \notin C$, choose such an $f$; let $|f(x)| = \varepsilon$, and get open neighborhoods $f^{-1}(|z| < 1/3 \varepsilon)$ and $f^{-1}(|z| > 2/3 \varepsilon)$ of $C$ and $x$.) Compact Hausdorff is probably enough. I am not sure about locally compact Hausdorff. Feb 21, 2017 at 4:52
• By the way for metric spaces it is easy to construct $f$: let $f(x)$ be the distance from $x$ to $X \backslash U.$ Feb 21, 2017 at 4:55

No, this is not always possible. Even if $X$ happens to be normal.
Note that the set $\mathbb{C} \setminus \{ 0 \} \subseteq \mathbb{C}$ may be represented as $\bigcup_{n \in \mathbb{N}} \{ z \in \mathbb{C} : |z| \geq \frac{1}{n} \}$. So in addition to being open, $\mathbb{C} \setminus \{ 0 \}$ is an Fσ-set. One can show that if $f : X \to Y$ is continuous (arbitrary spaces $X$ and $Y$), then $f^{-1} [ B ]$ is Fσ in $X$ whenever $B$ is Fσ in $Y$. So for any space $X$ and any continuous mapping $f : X \to \mathbb{C}$ the set $f^{-1} [ \mathbb{C} \setminus \{ 0 \} ]$ is an open Fσ subset of $X$.
A space $X$ in which every open subset is Fσ is sometimes called a perfect space, and a normal perfect space is called perfectly normal. Perfectly normal spaces have the property that for any open subset $U \subseteq X$ there is a continuous $f : X \to \mathbb{R}$ such that $f^{-1}[ \mathbb{R} \setminus \{ 0 \} ] = U$. (The same obviously holds for complex-valued continuous functions.)
And there are certainly examples of Hausdorff (even normal) spaces which are not perfect. One is the ordinal space $[0 , \omega_1 ] = \omega_1+1$. Here the interval $[0,\omega_1)$ is open, but is not Fσ. (Any closed subset which does not contain $\omega_1$ is countable, and the union of countably many countable sets is countable.) So there is no continuous function $f : [0,\omega_1] \to \mathbb{C}$ such that $[0,\omega_1) = f^{-1} [ \mathbb{C} \setminus \{ 0 \} ]$.
• $[0,\omega_1]$ is even compact Hausdorff! This is a great counterexample. Feb 21, 2017 at 5:09
• Thank you for the great counterexample! You have me wondering now, as it seems like you have insinuated that perfect and normal are the key properties that I need – would much change if I required $U$ to also be precompact? Feb 21, 2017 at 5:15
• @fauxefox In my example $[0,\omega_1$ is precompact since its closure is the compact space $[0,\omega_1]$. I'd have to think more about the general situation, however. Feb 21, 2017 at 5:24