Does there exists a $C^{\infty}$ function $f : \Bbb R \longrightarrow \Bbb R$ such that $f(x) = 1,$ for all $x \in \Bbb R$ with $|x| \lt 1$ and $f(x) = 0,$ for all $x \in \Bbb R$ with $|x| \gt 5\ $?
If the answer is "yes" can anybody give me some hint as to how to construct such a function? Any help in this regard will be warmly appreciated.
Thanks for your time.
With a $C^\infty$ helper function $h\colon\Bbb R\to \Bbb R$ such that $h(x)=0$ for $x\le 0$ and $h(x)>0$ for $x>0$, you can easily construct such and similar examples. For example, $$g(x):= \frac{h(x+1)}{h(5-x)+h(x+1)}$$ (note that the denominator is always $>0$!) has the property that $g(x)=0$ for $x\ge5$ and $g(x)=1$ for $x\le 1$. Then $$ f(x):=g(x)g(-x)$$ has your desired property.
Remains to find a suitable $h$. Here, $e^{-\frac1x}$ is your friend.