# Continuous function and normal topological space [duplicate]

Let $X$ be a normal topological space. If $A \subset X$ is closed and $G_{\delta}$, then there exists a continuous function $f:X \to [0,1]$ such that $f(x) =0$ if $x \in A$ and $f(x) \neq 0$ if $x \notin A$.

I tried to use Urysohn's lemma and Tietze extension theorem, but I had no success.

## marked as duplicate by Martin R, user91500, user370967, Glorfindel, Jonas DahlbækJun 29 '17 at 12:24

• Let $A = \bigcap\limits_{n = 0}^\infty U_n$ with open $U_n$. Without loss of generality, $U_{n+1}\subset U_n$ (though you don't need that). Apply Tietze to $A$ and $X\setminus U_n$. Scale and sum. – Daniel Fischer Aug 23 '13 at 14:59
Let $A = \bigcap_{n=1}^\infty V_n$ where each $V_n$ is open. By Urysohn's lemma, we can find $f_n : X \to [0, 1]$ where $f(A) = \{0\}$ and $f(X - V_n) = \{1\}$. Define: $$f(x) = \sum_{n=1}^\infty \frac{f_n(x)}{2^n}$$
By the Weierstrass M-test, $f$ is continuous. It is the desired function.