2

Consider $V\subseteq U\subseteq\mathbb{R}^n$, where $V$ and $U$ are both open sets and $\partial V\subset U$.

Is it possible to construct a $\mathcal C^\infty$ function $g:\mathbb{R}^n\rightarrow\mathbb{R}$ such that the following conditions hold?

  1. $g(x)=1$ for all $x\in V$
  2. $g(x)\neq0$ for all $x\in U$
  3. $g(x)=0$ for all $x\in \mathbb{R}^n\setminus U$

Note that this question is closely related to the one in Infinitely differentiable function with given zero set? . The difference is that $V=\emptyset$ in that question (i.e. we do not have condition 1 above).

Asaf Karagila
  • 405,794

1 Answers1

5

Let $f_0$ and $f_1$ be $C^\infty$ functions whose zero sets are $\mathbb R^n\smallsetminus U$ and $\overline V$, respectively. These exist by the answers to the linked question. By squaring them if necessary, you can additionally ensure that $f_0,f_1\ge0$. Then define $$g(x)=\frac{f_0(x)}{f_0(x)+f_1(x)}.$$

I would prefer to state the result in a more clear way as follows: if $A$ and $B$ are disjoint closed subsets of $\mathbb R^n$, there exists a $C^\infty$ function $g\colon\mathbb R^n\to[0,1]$ such that $A=g^{-1}(0)$ and $B=g^{-1}(1)$.