The goal of this page is to show the existence, for any compact set $$K \subset \mathbb{R}^d$$, of functions $$\psi\colon \mathbb{R}^d \to \mathbb{R}$$ which are non-negative, infinitely differentiable, with compact support, and with a constant positive value in a neighborhood of the set $$K$$.  A construction of such function is presented here:

Let $$f\colon \mathbb{R} \to \mathbb{R}$$ defined piecewise by:

 $$f(t) = \begin{cases} \exp (-1/t) & \text{if } t>0 \\ 0& \text{otherwise}\end{cases}$$ We need to prove that this function is $$C^\infty$$.  The following result helps:

#### Theorem

If $$P$$ is a polynomial and $$g(t) = P(1/t) \exp(-1/t)$$ for $$t>0$$, $$g(t) = 0$$ for $$t\leq 0$$, then $$g$$ is continuous.  The derivative for $$t \neq 0$$ is of the same form with $$P(1/t)$$ replaced by $$\big( P(1/t) - P'(1/t)\big) / t^2$$, so $$g'(0)$$ exists and is equal to zero.

Consider now for any dimension $$d \in \mathbb{N}$$ the function $$\phi\colon \mathbb{R}^d \to \mathbb{R}$$ defined below. It is non-negative, infinitely differentiable, with compact support, and it satisfies $$\phi(0) > 0$$. Notice that the support of $$\phi$$ is the ball of radius 1 centered at the origin.

\begin{equation} \phi(\boldsymbol{x}) = f(1-\lvert \boldsymbol{x} \rvert^2) \text{ with } \lvert \boldsymbol{x} \rvert^2 = \sum_{k=1}^d x_k^2 \text{ for any } \boldsymbol{x} = (x_1, \dotsc, x_d) \in \mathbb{R}^d \end{equation} We can obtain a similar bump function with support in a ball centered at any location $$\boldsymbol{x}_0 \in \mathbb{R}^d$$ and with radius $$\delta>0$$, by the usual translation and change of scales of the previous function $$\phi:$$

\begin{equation} \boldsymbol{x} \mapsto \phi \bigg( \frac{\boldsymbol{x} - \boldsymbol{x}_0}{\delta} \bigg) \end{equation}

In the last step we accomplish the last desired property.  For this task, we will construct the function by convolution of a bump function with the indicator of a small ball containing the given compact set.  This convolution preserves both the best integrability and smoothness properties of the functions used to construct it, and so we obtain the desired result:

Let $$K \subset \mathbb{R}^d$$ be a compact set, and let $$\boldsymbol{x}_0 \in K$$ and $$\delta>0$$ such that $$K \subset B_\delta (\boldsymbol{x}_0)$$. Consider the functions $$u = \boldsymbol{\chi}_{B_{2\delta}(\boldsymbol{x}_0)}$$—the indicator function of the ball with radius $$2\delta$$ centered in $$\boldsymbol{x}_0$$—and the bump funtcion $$v(\boldsymbol{x}) = \phi(\boldsymbol{x}/\delta)$$, with support in the ball of radius $$\delta$$ centered at the origin. It is then

\begin{align} \big( u \ast v \big) (x) & = \int_{\mathbb{R}^d} u(x-y) v(y)\, dy \\ & = \int_{B_\delta(\boldsymbol{0})} \boldsymbol{\chi}_{B_{2\delta}(\boldsymbol{x}_0)}(x-y) \phi(y/\delta)\, dy \end{align}

Notice that, by construction, this function satisfies:

1. $$u \ast v$$ is non-negative.
2. $$u \ast v \in C_c^\infty (\mathbb{R}^d)$$.
3. $$0 \leq \big( u \ast v \big) (\boldsymbol{x}) \leq \lVert \phi \rVert_1$$ for all $$\boldsymbol{x} \in \mathbb{R}^d$$.
4. $$\big( u \ast v \big) (\boldsymbol{x}) = 0$$ if $$\lvert \boldsymbol{x}-\boldsymbol{x}_0 \rvert \geq 2\delta$$.
5. $$\big( u \ast v \big) (\boldsymbol{x}) = \lVert \phi \rVert_1$$ if $$\lvert \boldsymbol{x}-\boldsymbol{x}_0 \rvert < \delta$$ (in particular, for all $$\boldsymbol{x} \in K$$)