# Dense pre-images implies continuous right inverse?

Suppose $$f : \mathbb R \to \mathbb R$$ is such that pre-image of every point under $$f$$ is dense in $$\mathbb R$$. This, of course, implies that $$f$$ is surjective, and hence has a right inverse $$\mathbb R \to \mathbb R$$.

My question is: does $$f$$ necessarily have a continuous right inverse?

This is a question I made up while thinking about another post. The connection is admittedly tenuous, but I find this question independently interesting anyway.

One can rephrase the above (almost equivalently) as follows:

Given a family $$\{ X_{\alpha} \}_{\alpha \in \mathbb R}$$ of dense subsets of $$\mathbb R$$, can we always find a continuous “representative map”, i.e., a function $$f : \mathbb R \to \mathbb R$$ such that $$f(\alpha) \in X_\alpha$$ for every $$\alpha \in \mathbb R$$?

I find the latter question even more natural. Stated this way, it is clear that while we have an strong restriction on any individual $$X_\alpha$$, there seems to be little to no relation between the different $$\alpha$$'s. In the absence of any such topological restrictions, I regard a positive answer to the above question extremely unlikely. However I am unable to construct a counter-example either.

Thanks!

No, in fact $f$ can't have a continuous right inverse . Suppose $f(g(x)) = x$. Then $g$ is one-to-one. Given $a < b$, if $g$ is continuous $g([a,b])$ must be an interval of positive length, and this must intersect each $f^{-1}(y)$, so $f(g([a,b])) = \mathbb R$, not $[a,b]$.