# a construction of a continuous function from a normal space to [0,1]

Let $A$ be closed in $X$ , where $X$ is a normal space, and $A$ is also a countable intersection of open sets. Prove that there exist a continuous function such that \eqalign{ & f\left( x \right) = 0\,\,\text{ if }\,x\, \in A \cr & f\left( x \right) > 0\,\,\text{ if }\,x \notin A \cr} EDITED: I mean intersection, sorry

-
Could you please phrase it in the form of a question and not a homework assignment? Also if this is indeed a homework assignment, please add the [homework] while you're at it. – Asaf Karagila Oct 18 '11 at 23:08
Do you mean intersection instead of union? If so, look at the added bit in @Asaf 's answer here – t.b. Oct 18 '11 at 23:36

Write $A = \bigcap_{n=1}^{\infty} U_n$ with $U_n$ open. By Urysohn's lemma there is a continuous $f_n: X \to [0,1]$ such that $f_n|_{A} \equiv 0$ and $f_{n}|_{X\smallsetminus U_{n}} \equiv 1$ since $A$ and $X \smallsetminus U_n$ are closed and disjoint. Put $f = \sum_{n=1}^{\infty} 2^{-n} f_n$ and verify that it has the desired properties.
Added: Note that the hypotheses that $A$ is closed and a countable intersection of open sets are also necessary for the existence of a continuous function $f: X \to [0,1]$ such that $A = f^{-1}(\{0\})$.
Indeed, since $f$ is continuous and $\{0\}$ is closed, $A = f^{-1}(\{0\})$ is closed. Putting $V_n = f^{-1}([0,1/n))$ we have that $V_n$ is open (as $[0,1/n)$ is open in $[0,1]$) and $A = \bigcap_{n=1}^{\infty} V_n$ is exhibited as a countable intersection of open sets.