Function which takes every value uncountably often

Let $\phi:\mathbb R\to\mathbb R^2$ a surjective function - for instance a suitable (continuous) relative of a Peano curve. If we define $$\pi_x:\mathbb R^2\to \mathbb R\\(x,y)\mapsto x$$ then $\pi_x\circ\phi$ is what you want.

On Peano and Hilbert curves: Peano curve and Hilbert curve are examples of surjective and continuous maps $\gamma:[0,1]\to [0,1]\times [0,1]$. They are constructed through a step-by-step approximation which the animation on Wikipedia explains better than I could ever do.

An important fact to notice for the purpose of this problem is that, if we take for instance $\gamma$ to be the Hilbert curve, $\gamma(0)=(0,0)$ and $\gamma(1)=(0,1)$. Which means: the curve starts in a corner of the square, fills the entire $[0,1]\times[0,1]$ and it ends in another corner of the square. All of this as $0\le t\le 1$. So we can actually have a second Hilbert curve start at $(0,1)$ at $t=1$, fill up the entire square $[0,1]\times[1,2]$ and arrive in $(0,2)$ at $t=2$ and so on. At each step continuity is preserved. If we repeat this construction countably many times (perhaps, with some rotation or symmetry) we can cover the whole plane with the image of a continuous function whose domain is $\mathbb R$.

If we do not require continuity: Given any infinite set $X$, the existence of a bijective function $f:X\to X\times X$ is a set-theoretical fact which relies on the Axiom of Choice.

The point of my argument: Provided a surjective function $\phi:\mathbb R\to\mathbb R^2$, for each $y$ there are uncountably ($2^{\aleph_0}$, to be precise) many $z\in\mathbb R$ such that $\pi_x\circ \phi(z)=y$. Indeed, they are all the elements of $\phi^{-1}\left(\{x\}\times \mathbb R\right)$. But $\phi$ is surjective, hence $$\left\vert\phi^{-1}\left(\{x\}\times \mathbb R\right)\right\vert\ge\left\vert\{x\}\times\mathbb R\right\vert=|\mathbb R|$$


This works, but may not have the flavour of analysis. We want to associate each real number $y$ in the domain of $f$ with an uncountable number of real numbers, the $x$ values for which $f(x)=y$. Something else that associates each $y \in \mathbb{R}$ with a copy of $\mathbb{R}$ is ... $\mathbb{R}^2$!

Let $h : \mathbb{R} \rightarrow \mathbb{R}^2$ be a bijection, e.g. this one. Let $g : \mathbb{R}^2 \rightarrow \mathbb{R}, (x,y) \mapsto y$. Then $f(x) = g(h(x))$ satisfies your requirements: $h$ takes each $x \in \mathbb{R}$, maps it to an intermediate point $(x', y') \in \mathbb{R}^2$, then $g$ discards $x'$ and leaves $y'$. Each possible $(x',y')$ occurs for some $x$, so each $y' \in \mathbb{R}$ pops out an uncountable number of $x$ values.


If $\mu$ is a singular continuous measure (e.g. take the haar measure on the cantor set in the unit interval) then $f(z)=\int \frac{d\mu (\lambda )}{\lambda -z}$ is analytic in the upper half plane and its limit as $z = x+i\epsilon$ goes to x defines a measurable function on $\mathbb{R}$. This function can take every real value y uncountably often in any finite sub-interval of $\mathbb{R}$. Look up papers by D.B. Pearson on value distribution for details.