# real analysis function takes on each value twice?

I want to find a function $f:[0,1] \to [0,1]$ such that $f$ takes on each value in $[0,1]$ exactly twice. I think this means there are an infinite number of discontinuities. Can anyone help me figure this one out?

Anyone have any pointers?

-
Such as abs(x)? –  Jackson Hart Nov 1 '12 at 23:06
That is actually a pretty cool problem. –  Michael Greinecker Nov 1 '12 at 23:17
See Jo Heath, "Every exactly 2-to-1 function on the reals has an infinite number of discontinuities", Proceedings of the AMS, 98 (1986), 369-373 ams.org/journals/proc/1986-098-02/S0002-9939-1986-0854049-8/… –  Robert Israel Nov 1 '12 at 23:23
Wouldn't a rather natural solution be to split the unit interval into a closed and a half-open interval and to construct bijections for each? –  EuYu Nov 1 '12 at 23:28
Let $[0,1]$ be partitioned into the set of reciprocals of integers $A=1,1/2,1/3,...$ and the complement $B$ of $A$. Now map $A$ by a shift of the sequence (take 1 to 1/2, take 1/2 to 1/3, etc), and map $B$ by the identity. Then this will map $[0,1]$ bijectively to $[0,1)$. –  coffeemath Nov 2 '12 at 4:07

Let $x_\alpha$ be a well-ordering of $[0,1]$.
For any ordinal $\alpha = \theta + n < \frak{c}$ where $\theta$ is a limit ordinal or $0$ and $n$ is a finite ordinal, let $F(\theta + n \cdot 2) = F(\theta + n \cdot 2 + 1) = x_\alpha$.
Now define $f(x_\alpha) = F(\alpha)$ for all $\alpha \lt \frak{c}$ and it is clear that $f$ has the required property.