I recently saw the following puzzle somewhere:
Find a continuous, surjective function $f:\mathbb R\mapsto\mathbb R$ that takes on each of its values exactly three times.
Or, more technically stated,
Find a continuous, surjective function $f:\mathbb R\mapsto\mathbb R$, such that for all $y\in\mathbb R$, there exist exactly three real solutions $x$ to the equation $f(x)=y$.
My solution to this puzzle was the function $$f(x)=\sin^2 \frac{3\pi(x-\lfloor x\rfloor)}{2}+\lfloor x\rfloor$$ Since then, I've thought of a few variations on this puzzle, none of which I have been able to solve:
- Can a function $g:\mathbb R\mapsto \mathbb R^2$ satisfy these requirements? What about a function $h:\mathbb R^2\mapsto \mathbb R$?
- What function $f$ satisfies the original puzzle, and is also $C^\infty$?




They succeed in proving that no injective $g:\mathbb{R}\rightarrow\mathbb{R}^2$ exists, but the proof doesn't seem to extend to the present case.
– Yly Dec 29 '17 at 16:26