Intermediate value property for f(x)= sin (1/x) when x is not zero and $a$ when x is zero If $f:[-1,1]\to \mathbb{R} $ with $f(x)= \begin{cases}\sin(1/x), & x\neq 0\\ a,& x=0\end{cases} $ , how can I prove that $f$ has intermediate value property if and only if $a$ is between $[-1,1]$?
 A: Let $a\in[-1,1]$. Then:


*

*for $-1\leq b<c<0\,$ (analogously for $0< b<c\leq 1\,$) $f$ on $[b,c]$ is continous, so it has intermediate value property

*for $-1\leq b \leq 0 < c\leq 1$ (analogously for $-1\leq b < 0 \leq c\leq 1$ ) : 


*

*if $f(b)<f(c)$ (analogously for $f(b)>f(c)$), lets take $w=\frac{1}{(2k-\frac{1}{2})\pi}$, where $k$ is positive integer such that $k>\frac{1}{2\pi c}+\frac{1}{4}$. Then we have $0<w<c$ and $f(w)=-1 \leq f(b) < f(c)$. On $[w,c]$ function $f$ is continous, so it has intermediate value property and for every $p\in [-1,f(c)]$, especially for every $p\in [f(b),f(c)]$ there exists $z\in (w,c) \subseteq (b,c)$ that $f(z)=p$. So on interval $[b,c]$ function $f$ has intermediate value property. 

*if $f(b)=f(c)$, then take $w=\frac{c}{2\pi c+1}$. We have then $0<w<c\,$ and $f(w)=f(c)=f(b)$, so on $[b,c]$ function $f$ has intermediate value property. 



We see then, that if $a\in [-1,1]$, then function $f$ has intermediate value property. 
On the other hand, if $a\not \in [-1,1]$, let's take interval $[b,0]$ ($b\in [-1,0)$)


*

*if $a>1$ (analogously for $a<-1$), let's take $p=\frac{a+1}{2}$. Of course $f(b)\leq 1 < p < f(0)$. Because $1<p$, there is no value $z \in (b,0)$ that $\sin \frac{1}{z}=p$, so function $f$ doesn't have intermediate value property on interval $[b,0]\subseteq [-1,1]$.


We see then that if $a\not \in [-1,1]$, then $f$ doesn't have intermediate value property.
