$f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ twice

Does there exist a continuous function $f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ exactly two times?


Solution 1:

Suppose $f(a)=f(b)=0$. Then on each of $(-\infty,a)$, $(a,b)$, $(b,\infty)$ the function $f$ is either positive or negative by the intermediate value theorem. By continuity $f$ has either a max on $[a,b]$ which is strictly positive or a min which is strictly negative. WLOG say it has a max which is positive. The left and right intervals must have opposite signs or $f$ can't be surjective. So say WLOG the left side is positive. Then some (very small) positive value is achieved three times, once on the left interval and twice in the middle interval.

Solution 2:

Suppose for sake of contradiction that such function exists. Let $a,b$ be two real numbers such that $f(a)=f(b)$ and $a<b$. Then either $f(x)>f(a)$ for all $x\in (a,b)$ or $f(x)<f(a)$ for all $x\in (a,b)$. If were not such the case then we have $c,d\in (a,b)$ such that $f(c)\le f(a)\le f(d)$, taking the value of $f(a)$ a third time. We may assume that $f(x)<f(a)$ for all $x\in (a,b)$. Now we choose some $x_0\in (a,b)$ (whatever works), thus $f$ takes all the values between $f(a)=f(b)$ and $f(x_0)$ twice in $[a,x_0]$ and $[x_0,b]$.

For $x<a$ or $x>b$ we cannot have $f(x)<f(a)$ because this would imply that $f$ takes these values yet a third time (if were the case of some $x$ such that $f(x)<f(a)$ and assume by concreteness $x<a$, so all the values between $y=\max\{f(x),f(x_0)\}$ and $f(a)=f(b)$ are taking by $f$ three times, since $f(x)\le y<f(a)$, $f(x_0)\le y < f(a)$ and $f(x_0)\le y < f(b)$ in $[x,a]$,$[a,x_0]$ and $[x_0,b]$). Hence for $x<a$ and $x>b$ we must have $f(x)> f(a)$.

Thus for what we have seen $f$ is bounded below by the minimum on $[a,b]$ and then $f$ does not take each $x\in\mathbb{R}$, in particular does not take any value less than the minimum value of $f$ in $[a,b]$, a contradiction.

Solution 3:

$\mathbb{R}$ cannot have any nontrivial connected covering space, including a $k$-sheeted covering map from itself for any finite $k > 1$, because it is simply connected.