TITLE: A question about Darboux functions
QUESTION [6 upvotes]: Possible Duplicate:
A converse of sorts to the intermediate value theorem, with an additional property 

Definition of Darboux function: Let $S\subset\mathbb{R}$ be given. We say that $f:S\rightarrow\mathbb{R}$ is a Darboux function if it possesses the following property: for each $a,b\in S$, such that $a<b$, and for each $y_0\in(c,d)$ (where $c=\mathrm{min}\{f(a),f(b)\}$ and $d=\mathrm{max}\{f(a),f(b)\}$) there exists an $x_0\in S\cap (a,b)$ such that $f(x_0)=y_0$.
My problem is this: Suppose that $f:\mathbb{R}\rightarrow\mathbb{R}$ is a Darboux function. Suppose also that $f^{-1}(\{q\})$ is closed for each $q\in\mathbb{Q}$. I have to prove that $f$ is continuous on $\mathbb{R}$.
Could you help me with this problem, please?

REPLY [2 votes]: A proof by contraposition can be given in which, assuming the Darboux property and lack of continuity, it is shown that there exists $q$ such that $f^{-1}\{q\}$ is not closed.  
For simplicity, I suggest first supposing that $f(0)=0$ and that $f$ is not continuous at $0$.  (Straightforward adjustments can be made for the general case.)  By definition, this means that there exists $\varepsilon>0$ such that for all $\delta>0$, there exists $x$ in $(-\delta,\delta)$ such that $|f(x)|\geq \varepsilon$.  Let $q$ be a rational number such that $0<q<\varepsilon$.  By the Darboux property, for all $\delta>0$ there exist $y$ in $(-\delta,\delta)$ such that $f(y)=q$ or $f(y)=-q$.  You can use this fact to conclude that one of $f^{-1}\{q\}$ or $f^{-1}\{-q\}$ has $0$ as a limit point, and therefore is not closed.