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$. 

I will show you how to fill in the gap $(1,2)$ and leave you to get the rest. The easiest method is to use a polynomial to fill in the gap. It will need to have a derivative of zero at $x=1$ and $x=2$, so the polynomial needs to be at least cubic, and its derivative has the form $$p'(x)=a(x-1)(x-2)=ax^2-3ax+2a,$$ where $a$ is a constant. The derivative has to be positive between $1$ and $2$, so $a$ is negative. By taking an antiderivative, we get $$p(x)=\frac{a}{3}x^3-\frac{3a}{2}x^2+2ax+c.$$ We should have $p(1)=0$ and $p(2)=1$. Therefore $$\frac{a}{3}-\frac{3a}{2}+2a+c=0,$$ $$\frac{8a}{3}-6a+4a+c=0.$$ Now solve this system of equations to find what $a$ and $c$ should be.
