TITLE: Prove that $h$ is of class $C^r$
QUESTION [5 upvotes]: Let $g$ be a $C^r$function defined in a neighborhood $U$ of $\mathbf{x_0}$ in $\mathbb{R}^n$. Show that if $\phi:\mathbb{R}^n\to \mathbb{R} $ is a $C^r$ function whose support lies in $U$, then the function:$$h(\mathbf{x})=\begin{cases}\phi(\mathbf{x})g(\mathbf{x})&\mbox{for }\mathbf{x}\in U\\0\qquad &\mbox{for }\mathbf{x}\notin \mbox{Support }\phi\end{cases}$$
is well-defined and of class $C^r$ on $\mathbb{R}^n$.
My approach:
outside Support $\phi$, $h$ is clearly well-defined (if $\mathbf{x}\in U$ then $h$ seems to give two values, however $\phi$ is zero in a neighborhood of $\mathbf{x}$, hence $h=0$) and of class $C^r$ since it's identically zero (note that $\mathbb{R}^n-$ Support $\phi$ is open, since Support $\phi$ is closed). If $\mathbf{x}\in \operatorname{Int}$ (Support $\phi$), then $h$ equals the product of $\phi$ and $g$; therefore $h$ is of class $C^r$. Now what happens if $\mathbf{x}\in \operatorname{Bd}$ (Support $\phi$)?
I'm not sure about my approach, any help would be greatly appreciated.

REPLY [2 votes]: I am assuming you mean that $\text{supp}(\phi)=\overline{\{x \in \mathbb{R}^n \ : \ \phi(x)\neq 0\}}.$  The key is that smoothness is a purely local phenomenon.  
Let $x_0 \in V = \mathbb{R^n} - \text{supp}(\phi).$    Then we can find a ball $B(x_0) \subseteq V$  for which $h(x)=0$ on $B(x_0).$  Thus $h$ is $C^r$ on $B(x_0).$   
Similary, $h(x)$ is $C^r$ on any ball $B(x_0)\subseteq U.$     Since $U \cup V = \mathbb{R}^n$, we have  $h \in C^r(\mathbb{R}^n,\mathbb{R}).$