Proof that a function with a discontinuity has Darboux Property I have the following function:
$$f:\Bbb R\to \Bbb R\text{ defined by } f(x)=\left\{\begin{matrix}0 & \text{ if } x\leq0,
\\ \cos(x)\sin\left(\frac1{x}\right) &\text{ if } x>0.
\end{matrix}\right. $$
I have to prove that this function has the Darboux Property.
It is quite obvious that the function is discontinuous at $0$; in fact, the right-side limit doesn't even exist.
Intuitively I can also see that for any interval of the form $I=(0, \epsilon)$, with $\epsilon$ positive, $f(I)=[-1, 1]$ but I'm not sure if my intuition is correct, nor could I manage to find any way to prove this.
Another thing that I noticed is that $f\left(\frac1{2k\pi}\right)=0$ for any $k\in \Bbb N$(and even $\Bbb Z$ I guess). That didn't lead to anything.
Any ideas/hints/solutions would be appreciated!
 A: Take $a,b\in\Bbb R$ with $a<b$. You want to prove that if $y$ lies between $f(a)$ and $f(b)$, then there is a $c\in[a,b]$ such that $f(c)=y$. If $a>0$, this is clear, since $f$ is continuous on $(0,\infty)$. And the statement is trivial if $b<0$. So, suppose that $a\leqslant0<b$. Then $f(a)=0$ and $f(b)\in[-1,1]$. Take $n\in\Bbb N$ so large that:

*

*$\displaystyle\frac1{2n\pi+\pi/2},\frac1{2n\pi-\pi/2}<b$;

*$y$ lies between $\displaystyle\cos\left(\frac1{2n\pi+\pi/2}\right)$ and $\displaystyle-\cos\left(\frac1{2n\pi-\pi/2}\right)$.

Then, by the intermediate values theorem, there is some$$c\in\left[\frac1{2n\pi+\pi/2},\frac1{2n\pi-\pi/2}\right]$$such that $f(c)=y$ and $c\in[a,b]$.
A: Consider $g(x)=x^2\cos(x)\cos(\frac1{x}), x \ge 0$ and $0$ elswhere and note that $g$ is differentiable at zero and $g'-f=h$ which is continuous on the line so has an antiderivative $h$; this means that $f=(g-h)'$ and then it has Darboux property by the usual theorem that derivatives have such even if they are discontinuous (this is an easy application of MVT)
