Let $g\in C^ \infty(\mathbb R^n)$ with $g\ge0$, $g=1$ in $\mathbb B_1$ and $g=0$ in $\mathbb R^n\backslash\mathbb B_2$. How can you prove that $$f:\mathbb R^n\rightarrow\mathbb R,\space\space x\mapsto (x^2_1-x^2_2)g(x)$$ is continuously differentiable?
Obviously $f$ is continuously differentiable $\forall x\in\mathbb R^n\backslash\{\partial\mathbb B_1\cup\partial\mathbb B_2\}$ so the problem is just the boundary.