# Finding a $\text C^\infty$ function which is zero just on a given closed set [duplicate]

If $\text E$ is an arbitrary closed set in $\mathbf R^n$, show that there is an $\text f\in \text C^\infty(\mathbf R^n)$ such that $\text f(x)=0~$for every $x \in \text E$ and $\text f(x)>0$ for every other $x\in \mathbf R^n$.

My approach is as follows :

Since $\text E$ is given to be closed hence $\text E^c=\text V$ will be an open set in $\mathbf R^n$ and hence $\text V$ can be written as countable union of open sets $\{\text V_i\}_{i=1}^{\infty}$ and hence one can have a partition of unity $\{\psi_i\}_{i=1}^{\infty}\subset \text C^\infty (\text V)$ such that $\text {supp}(\psi_i)\subset \text V_i$. Then if i take $f=\Sigma_{i=1}^{\infty} \psi_i$ then my this $\text f$ is in $\text C^\infty (\text V)$ and $f(x)>0$ in $\text E^c$ and $f(x)=0$ in $\text E$. Now i am just left with to show that $f\in \text C^\infty (\mathbf R^n)$ or how can i generalize my $f$ to get the desired result.

Any type of help will be appreciated. Thanks in advance.

• This is called a bump function, the proof of existence is important, and the general idea is described in the wikipedia article en.wikipedia.org/wiki/Bump_function – Teddy Baker Aug 30 '17 at 17:04
• This is a theorem of Whitney: mathoverflow.net/questions/179445/… – Lord Shark the Unknown Aug 30 '17 at 17:04
• @TeddyBaker It seems the function $f$ in OP's post is different from bump functions. While bump functions have compact support, the set of zeros of $f$ have to be exactly $E$. It is not clear for me how the Wikipedia's idea (on the construction of a smooth function which is $1$ inside a compact and is zero outside another compact) can be applied for this case (construction of a smooth function which is zero inside a closed and positive outside the same closed). – Pedro Aug 30 '17 at 17:56
• Good point, it is kind of the opposite of a bump function. I think you could do the same thing as to construct the bump function, just convolve the desired domain characteristic function (in this case not compact) with a bump function, should still work. – Teddy Baker Aug 30 '17 at 17:58
• related – Pedro Aug 30 '17 at 18:06

Following the lead from Teddy Baker, the function you look for is 1 - φ where φ is the bump function defined as below: (However, do pay attention to the "Edit 1" below, as $K$ needs not to be a compact set.)

If K is an arbitrary compact set in n dimensions and U is an open set containing K, there exists a bump function φ which is 1 on K and 0 outside of U. Since U can be taken to be a very small neighborhood of K, this amounts to being able to construct a function that is 1 on K and falls off rapidly to 0 outside of K, while still being smooth.

The construction of the bump function is described here:

The construction proceeds as follows. One considers a compact neighborhood V of K contained in U, so K ⊂ Vo ⊂ V ⊂ U. The characteristic function ${\chi} _{V}$ of V will be equal to 1 on V and 0 outside of V, so in particular, it will be 1 on K and 0 outside of U. This function is not smooth however. The key idea is to smooth $\chi _{V}$ a bit, by taking the convolution of $\chi _{V}$ with a mollifier. The latter is just a bump function with a very small support and whose integral is 1. Such a mollifier can be obtained, for example, by taking the bump function $\phi$ from the previous section and performing appropriate scalings.

The key idea for the construction is the use of convolution, and the fact that the convolution of a discontinuous function and a smooth function is a smooth function.

For example in 1D, let $E = [-1,1]$, simply choose sets $V$ and $U$ such that:

$E = [-1,1] \subset V = [-2,2] \subset U = (-3,3)$

Now let $\chi_V$ be the characteristic function of V. That is: $$\chi_V(x) = \begin{cases} 1 \quad \text{if x \in V} \\ 0 \quad \text{otherwise.} \end{cases}$$

Convolve $\chi_V$ with a mollifier f (a summetric bump function: https://en.wikipedia.org/wiki/Mollifier) with a small enough support. In this case any mollifier f with support size less than or equal to 1 will work (since the distance between a boundary of V to that of E and U is 1). One example of such a mollifier is: $$f(x) = \begin{cases} \frac{1}{C} e^{-\frac{1}{1-x^2}} \quad \text{if -1 \leq x \leq 1}\\ 0 \quad \text{otherwise,} \end{cases}$$ where $C$ is a (normalization) constant such that the integral over $[-1,1]$ equals 1.

Since $$(\chi_V \star f)(x) = \begin{cases} 1 \quad &\text{if x \in E}\\ \text{a value between 0 and 1} \quad &\text{if x is in V but not in E or U,} \\ 0 \quad&\text{if x is in U but not in V,} \end{cases}$$

the following function $g$ is the answer to your question (satisfying the condition that it equals 0 inside E and being non-zero outside E):

$$g = 1-\phi = 1 - \chi_V \star f.$$

Edit 1 (Adding an example with unbounded sets as a response to comment from user Pedro): Interestingly, the mentioned convolution technique can be straightforwardly extended to unbounded sets (however with certain conditions on $E$--to be mentioned more later). As an example, one can slightly hijack the example above to have a new example with unbounded sets. For example, consider the following sets:

$E = (-\infty,1] \subset V = (-\infty,2] \subset U = (-\infty,3)$

Now, the answer to the original question (find a smooth function that equals 0 inside $E$ and non-zeros outside $E$) is the same as before: $g = 1 - \chi_V \star f$.

Conditions on $E$ so that the argument still works: I think the condition $E$ is closed is enough (will keep thinking a bit more).

• But $E$ is not bounded in the original question. – Pedro Sep 7 '17 at 3:41
• @Pedro: it is a good point, I added a few lines regarding the case where $E$ is unbounded. – MMM Sep 8 '17 at 7:08
• In $\mathbb{R}$ you can write $U = \bigcup_{i}^\infty (a_i,a_{i+1})$ and set $\varphi = \sum_i \phi_{a_i,a_{i+1}}$ where $\phi_{a_i,a_{i+1}}$ is $C^\infty$ and non-zero exactly on $(a_i,a_{i+1})$. In $\mathbb{R}^2$ it is a little different and you should look at Robert's answer – reuns Sep 8 '17 at 7:38