Cut-off function construction Let $f:I=[0,1]\cup[2,3]\to \mathbb{R}$, defined by 
$$f(x)= \begin{cases} 0 & \text{if } x\in [0,1] \\ 1 & \text{if } x\in [2,3] \end{cases} $$
How do I construct a $C^1$ function $\tilde{f}: \mathbb{R}\to \mathbb{R}$ such that $\tilde{f}(x)=f(x)$ for all $x\in I$. 

Hint
Try to use $$x\longmapsto e^{-\frac{1}{x^2}}\quad \text{and}\quad x\longmapsto e^{-x^2}$$
that you can compose with translation and homethetie. 
