# There is any smooth function on real line which is zero just in [0,1] [duplicate]

There is any function of class $$C^{\infty}$$ with the following property:

$$f:\mathbb{R}\to \mathbb{R}$$ $$f(x)=0\ \ \ \ \ \text{iff} \ \ \ \ \ \ 0\leq x\leq 1?$$

I am wondering because of the smoothness there is any, or maybe, not a very complicated function of this type?

## marked as duplicate by grand_chat, metamorphy, mrtaurho, José Carlos Santos calculus StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jun 27 at 23:11

• Hint: can you find a function $f:(0,+\infty)\to \mathbb{R}$ such that $f$ and all of its derivatives tend to $0$ as $x\to 0^+$? – Lorenzo Quarisa Jun 27 at 19:19
• For $x>1$ set $f(x) = e^{-\frac{1}{x-1}}$ and for $x<0$ set $f(x) = e^{\frac{1}{x}}$. – Jakobian Jun 27 at 19:28