# Showing that a function has the intermediate value property [duplicate]

Here's the question:

Let $f(x)=\sin \left( \frac{1}{x} \right)$ for $x\ne 0$ and let $f(0)=0$. Show that $f$ is discontinuous on $\mathbb{R}$ and still has the intermediate value property on $\mathbb{R}$.

It's easy to show that $f$ is discontinuous at $x=0$. Now, I go on to prove that $f$ has the intermediate value property. Let $a,b \in \mathbb{R}$ with $a<b$. Assume that $y$ be some real such that $f(a) < y < f(b)$. If $y=0$ we are done for $f(0)=y$. If $y\ne 0$, I was hoping to use the continuity of sine on $\mathbb{R}$ but nothing seems work out.

Hints would be appreciated. I do not need full solution.

## marked as duplicate by José Carlos Santos real-analysis 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(); } ); }); }); Oct 29 '18 at 8:23

• Note that you can assume $a<0<b$. – paf Jul 2 '18 at 16:45

If $$0 or $$a, then you just use the fact that $$f$$ is continuous in $$\mathbb{R}\setminus\{0\}$$.
If $$a\leqslant0, you use the fact that there's some natural $$n$$ such that$$\frac1{n\pi}and, since $$y\in[-1,1]$$, there's a $$c\in\left[\frac1{(n+2)\pi},\frac1{n\pi}\right]$$ such that $$f(c)=y$$.
Can you do the remaining case ($$a)?
• should not it be $n+2$ instead of $n+1$? – hopefully Oct 29 '18 at 7:31
• Why? The range of the restriction of $f$ to the interval that I mentioned is already $[-1,1]$. There is no need to consider a larger interval. – José Carlos Santos Oct 29 '18 at 8:01