function on compact set and smoothness Let $V\subset \overline{V}\subset W \subset \overline{W}\subset U$. Let $\phi\in C^\infty(\mathbb{R}^n)$ such that $\phi(x)=1$ on $\overline{V}$ and $\phi (y)=0$ for $y \notin W$. If we let
$g(x)= f(x)\phi(x)$ for $x\in U$ and $g(x)=0$ for $x\in \mathbb{R}^n-W$, then $g\in C^\infty(\mathbb{R}^n)$; where $f\in C^\infty(U)$, $U\subset \mathbb{R}^n$.
I tried to prove this using Pasting lemma, but I am not able to prove this.
 A: I am assuming $U, V,W$ all are open subsets of $\Bbb R^n$. Let $f:U\to \Bbb R$ and $\phi:\Bbb  R^n\to \Bbb R$ both be smooth. Consider the function $g:\Bbb R^n\to \Bbb R$ defined as $$g(x)=\begin{cases}f(x)\cdot \phi(x)& \text{ if }x\in U,\\0&\text{ otherwise.}\end{cases}$$ Now, $U\subseteq_\text{open}\Bbb R^n$, so $g$ is smooth on $U$ as $\phi\in C^\infty(\Bbb R^n)$ and $f\in C^\infty(U)$.
Note $\Bbb R^n\backslash \overline W\subseteq \Bbb R^n\backslash  W$, and $\overline{\Bbb R^n\backslash  W}=\Bbb R^n\backslash \text{int}(W)=\Bbb R^n\backslash W$ as closure of complement is the complement of the interior.
So, $\phi\left(\overline{\Bbb R^n\backslash  W}\right)=\phi(\Bbb R^n\backslash W)=\{0\}$. Since, $\overline{\Bbb R^n\backslash  W}\supseteq \Bbb R^n\backslash W\supseteq \Bbb R^n\backslash \overline W$ we have $\phi\left(\Bbb R^n\backslash \overline W\right)=\{0\}$.
Notice that $\Bbb R^n\backslash  U\subseteq_\text{closed} \Bbb R^n\backslash \overline W\subseteq_\text{open}\Bbb R^n$. Also, $g\equiv 0$ on $\Bbb R^n\backslash \overline W$, as $\phi\big|_{\Bbb R^n\backslash \overline W}\equiv 0$. Now, $\Bbb R^n= \left(\Bbb R^n\backslash \overline W\right)\cup U$ and $g$ is smooth on the open sets $U$, $\Bbb R^n\backslash \overline W$. So, $g$ is smooth on $\Bbb R^n$.
