A strange characterization of continuity The problem I'm going to post, may appear a bit routine at first sight but it is not so!  Suppose that a,b are two real numbers and $f:(a,b)\rightarrow \mathbb{R}$ satisfies: $f((c,d))$ is a bounded open interval for EVERY subinterval $(c,d)$ of $(a,b)$. Can we conclude that $f$ is continuous on $(a,b)$ then? A little thought will reveal that the problem is equivalent to asking whether we can conclude that $f$ is monotone on $(a,b)$, under the same hypotheses. But I am finding it as much impossible to prove that $f$ is continuous, as to find a discontinuous counterexample, satisfying the hypotheses!! 

This answer is based on the answer Brian M. Scott gave at the link Siminore mentioned. Take the interval $(0,1)$. Let $\equiv$ be the equivalence relation on $\mathbb{R}$ given by $x\equiv y$ if and only if $x-y\in\mathbb{Q}$. Each equivalence class is countable and $|(0,1)|=|\mathbb{R}|=|\mathbb{R}^\mathbb{N}|$, so there is a bijection $f:\big\{[x]:x\in\mathbb{R}\big\}\to(0,1)$. Let $\pi:x\mapsto[x]$ be the canonical projection. Then for every open interval $(a,b)$, we have $f\circ\pi\big((a,b)\big)=(0,1)$, which also shows that $f\circ\pi$ is not continuous.
