# showing existence of some continuous function

Let $X$ be a compact metric space, $\mathcal{B}(X)$ be the borel-sigma algebra.

Assume $\mu(G)>0$ for all nonempty open sets $G\subseteq X$.

Show that for each open set $G$, exists a closed subset $F\subset G$ of positive measure and a continuous function $f$ defined as $f(x)=1$ for $x\in F$, $f(x)>0$ for $x\in G$ and $f(x)=0$ for $x\in X\setminus G$.

Is there any reason why a function like $g(x)=\frac{d(x,X\setminus G)}{d(x,X\setminus G)+d(x,G)}$

wouldn't work? The only problem i got with it...that $g(x)=1$ for all $x\in G$. But it seems to work. I'm not sure what to show here. I feel somehow it's not the function im supposed to coock up :P

-
If $G$ is not clopen and therefore has a non-empty boundary, $g(x)$ is undefined for every point in the boundary of $G$, because both terms in the denominator are $0$. – Brian M. Scott Nov 30 '12 at 13:12
What, if anything, does the measure have to do with the question? – Chris Eagle Nov 30 '12 at 13:14
That refers to Urysohn's functions, check e.g. here – S.D. Nov 30 '12 at 13:16
i edited the question, $F\subset G$ must be closed and of positive measure. Its all ive been given :P – DinkyDoe Nov 30 '12 at 13:16
oh, S.D that looks interesting. I take a look :) – DinkyDoe Nov 30 '12 at 13:21

## 2 Answers

If $G$ is empty, this is clearly impossible.

So suppose $G$ is nonempty. Let $x \in G$. Since $G$ is open, there exists $r$ such that the open ball of radius $r$ around $x$ is contained in $G$. Let $F$ be the closed ball of radius $r/2$ around $x$. It's certainly closed, and it has positive measure since it contains a nonempty open set.

Now let $f(x)=\frac{d(x,X\setminus G)}{d(x,X\setminus G)+d(x,F)}$.

-
sorry, i edited the question. you asked what has the measure to do with it. Well this...$F$ must be of positive measure. Otherwise u can take $F$ empty. – DinkyDoe Nov 30 '12 at 13:19
ah so, that's close to what i had in mind. Very nice :) – DinkyDoe Nov 30 '12 at 13:25
Another question...what does the -1 mean in the question. Do people dislike the question? :P – DinkyDoe Nov 30 '12 at 13:26
That should be a comment on the question, if anything. It has nothing to do with my answer. – Chris Eagle Nov 30 '12 at 13:26

Every metric space is normal, so you know from the Tietze extension theorem that for any closed $F\subseteq G$ there is a continuous $f:X\to[0,1]$ such that $f(x)=1$ for $x\in F$ and $f(x)=0$ for $x\in X\setminus G$. To get $F$ to have positive measure, just pick a point $x\in G$, use the regularity of metric spaces to get an open nbhd $U$ of $x$ such that $\operatorname{cl}U\subseteq G$, and let $F=\operatorname{cl}U$.

It only remains to be shown that $f$ can be chosen in such a way that $f(x)=0$ iff $x\in X\setminus G$. (In technical terms, we need to show that $X\setminus G$ is a zero-set, also called a functionally closed set, or, equivalently, that $G$ is a cozero-set, also called a functionally open set.) You can show that $X\setminus G$ is a zero-set using the function $g(x)=d(x,X\setminus G)$. Now combine $f$ and $g$ suitably to get the desired function.

-