Cut off function in N-dimension Let $\Omega_0, \Omega_1 $ be two open subsets of $R^N, (N\ge 2)$ such that $\overline{\Omega_1} \subset \Omega_0,$ ($\overline{\Omega_1}$ denotes the closure of $\Omega_1).$ I want to know if there exist $\Omega_1\subset\Omega_2\subset \Omega_0$ and a function   $f\in W^{2,\infty} (\Omega_0)$ such that :
$f=1$ in $\Omega_1, f\ge 0$ in $\Omega_2$ and $f=0$ in $\Omega_0-\Omega_2$.

Yes, and $f$ can be taken to be of class $C^\infty$. Let $\delta>0$ be such that for all $x\in\bar\Omega_1$  $B_{2\delta}(x)\subset\Omega_0$, where $B_r(x)$ is the open ball centered at $x$ of radius $r$. Let
$$
\phi(x)=\begin{cases}c_ne^{-\tfrac{1}{1-|x|^2}}&\text{if }|x|<1,\\0 &\text{if }|x|\ge1,\end{cases}
$$
where $c_n>0$ is chosen so that $\int_{\mathbb{R}^n}\phi(x)\,dx=1$ and
$$
\Omega_2=\bigcup_{x\in\Omega_1}B_\delta(x).
$$
Then $\Omega_2$ is open and
$$
\bar\Omega_1\subset\Omega_2\subset\bar\Omega_2\subset\Omega_0.
$$
Finally, let $f$ be the convolution of $\dfrac1{\delta^n}\,\phi\Bigl(\dfrac x\delta\Bigr)$ with the characteristic function of $\Omega_2$.
