Function class $C^{\infty}$ Show that exists function $ g \in \mathcal{C}^{\infty} \ [\mathbb{R},[0,1]) $ such that $g(x)=0$ for $|x|\le 1/2$ and $g(x)=1$ for $|x|>1$.
So, I have :
$f(x)=\begin{cases} \exp(-1/x) &\text{for } x > 0\\0 &\text{for } x<0 \end{cases}$
And now:
$g(x) = \frac{f(x)}{f(x) + f(1-x)}$
However, I am not convinced of this.

You should not be convinced, it isn't true.  In particular, if x= 1/2 then 1- x= 1/2 so that $f(x)= f(1-x)= e^{-1/(1/2)}= e^{-2}$ and then $g(1/2)= \frac{e^{-2}}{2e^{-2}}= \frac{1}{2}$, not 0.
