# Uryshon's lemma in metric spaces

If $X$ is a locally compact space, and $O$ is open in $X$, then I know that Urysohn's lemma will give a continuous function having compact support that does not vanish at $O.$

Is this true in general for metric spaces too? Does it help if instead, $O$ is a closed set? What conditions on $O$ can help me get a continuous function with compact support?

• You need a locally compact metric space. – Henno Brandsma Dec 2 '17 at 17:48
• I don't think you've stated the result you want correctly. What do you mean by "does not vanish at $O$"? If you mean the function is nonzero at every point of $O$, then this is hopeless for $O=X$ unless $X$ itself is compact, for instance. – Eric Wofsey Dec 2 '17 at 21:16

Let $O$ be an open subset of a topological space $X$. Let $f:X\to [0,1]$ be a continuous function non-vanishing at $O$ with a compact support (that is such that there exists a compact set $K$ such that $O\subset f^{-1}(0;1]\subset K$. If the space $X$ is Hausdorff then $K$ is closed in $X$, so $\overline{O}\subset K$ is compact. On the other hand, if $X$ is a normal space, $\overline{O}$ is compact, and $X\setminus O$ is a (closed) $G_\delta$-set then by [Eng, Corollary 1.5.12] there exists a continuous function $f: X\to [0,1]$ such that $X\setminus O=f^{-1}(0)$. In particular, if $X$ is a metric space (or, more general, a perfectly normal space) then there exists a continuous function from $X$ to $[0,1]$ non-vanishing at $O$ with a compact support iff $\overline{O}$ is compact.