# Continuous functions taking uncountably many values countably often

Let $$f$$ be a continuous function defined on the closed interval $$[0,1]$$. Clearly $$f$$ is bounded and attains its bounds.

Then my question is how often can $$f$$ take a value in its range countably many times?

Formally let $$Z(f,p)=\{x\in \text{Image}(f):|f^{-1}(x)| = p\}$$. I would like to know large $$Z(f,\aleph_0)$$ can be?

I conjecture that we can find $$f$$ with $$|Z(f,\aleph_0)|=2^{\aleph_0}$$.

Note that I can find f with $$Z(f,2^{\aleph_0}) = \aleph_0$$ which I think makes the conjecture plausible:

We know that the zero set of a continuous function on $$[0,1]$$ can be any closed subset as we can take $$f$$ to be the distance to the closed set. If we let the closed set be the cantor ternary set $$C$$ on $$[0,1]$$ we can create a function on $$[0,1]$$ with uncountably infinite zero set. By taking suitable scalings of the function on intervals $$[\frac{1}{2^{2n+1}}, \frac{1}{2^{2n}}]$$ with ramps in between we can find a function $$f$$ s.t. $$Z(f)$$ is countably infinite. Hence we have $$Z(f,2^{\aleph_0}) = \aleph_0$$.

• Make a nonzero continuous bump function on an open interval (a,b) with maximal value 1, infimum value zero (near the endpoints a and b on the x-axis), and every range value occurs at most twice. Now sprinkle [0,1] with countable many pairwise disjoint open intervals. For each open interval, paste a horizontally scaled copy of the graph. Fill in the rest with zero. One has (0,1] as the set of points in the range of this bumpy function with inverse image being countably infinite. Gerhard "Likes Eating Things With Sprinkles" Paseman, 2019.11.11. – Gerhard Paseman Nov 11 at 21:57
• @GerhardPaseman: Your bumpy function is not continuous. – Nate Eldredge Nov 11 at 22:01
• Really? If so, would it help if I included zero in the range, so that each image had a zero set at the endpoints? Gerhard "Not Seeing Point Of Discontinuity" Paseman, 2019.11.11. – Gerhard Paseman Nov 11 at 22:09
• @GerhardPaseman I think the problem is that your countably many pairwise disjoint open intervals have to have an accumulation point of arbitrarily small intervals; your function can't be continuous there. – Steven Stadnicki Nov 11 at 22:12
• @GerhardPaseman: No, that doesn't help. The sizes of your intervals must be shrinking to 0, so for each $n$ we can find $x_n, y_n$ in the same interval of length less than $1/n$ with $x_n$ at the center of the bump and $y_n$ off to one side, such that $f(x_n) = 1$ and $f(y_n) = 1/2$. In particular, since $|x_n - y_n| < 1/n$, we have $|x_n - y_n| \to 0$. Passing to a subsequence, the $x_n$ converge to some $x$, and since $|x_n - y_n| \to 0$ still, we have $y_n \to x$ also. Now does $f(x)$ equal 1 or 1/2? – Nate Eldredge Nov 11 at 22:13

How about Devil's staircase (a.k.a. Cantor function) $$C(x)$$, but with every horizontal segment replaced by a rescaled zigzag $$Z(x)$$? By a zigzag I mean, for example: $$Z(x) = \tfrac{2}{\pi} \arcsin(\sin(2\pi x)) .$$ The function $$f$$ is formally defined as: $$f(x) = \begin{cases} C(x) & \text{if x has no 1 in ternary expansion,} \\ C(x) + 2^{-n} Z(3^n(x - a_{n,k})) & \text{if x \in [a_{n,k}, a_{n,k}+3^{-n}],} \end{cases}$$ where $$a_{n,k}$$, $$k = 1, 2, \ldots, 2^n$$, is the enumeration of left endpoints of maximal line segments of length exactly $$3^{-n}$$ on which $$C(x)$$ is constant.

For every $$y_0$$ which is not a dyadic rational there is exactly one $$x$$ with no $$1$$ in ternary expansion such that $$f(x) = C(x) = y_0$$, and for each $$n = 1, 2, \ldots$$ the line $$y = y_0$$ intersects exactly one zigzag of $$f$$ of horizontal length $$3^{-n}$$.

EDIT: To clarify the definition of $$f$$, write $$x = \sum_{n = 1}^\infty \frac{x_n}{3^n}$$ for the ternary expansion of $$x$$, and let $$K \in \{1, 2, \ldots, \infty\}$$ be the position of first digit $$1$$. The Cantor function $$C(x)$$ is equal to $$C(x) = \sum_{n = 1}^K \frac{\lceil x_n/2 \rceil}{2^n} .$$ The function $$f$$ is defined by $$f(x) = \begin{cases} C(x) & \text{if K = \infty,} \\ C(x) + 2^{-K} Z\biggl(\sum_{n = 1}^\infty \dfrac{x_{K+n}}{3^n}\biggr) & \text{otherwise.} \end{cases}$$

Here is the plot of $$f$$:

To see that $$f$$ is continuous, it is enough to observe that $$f - C$$ is an infinite series of continuous "zigzag" functions with disjoint supports and decreasing supremum norms. The series thus converges uniformly, and consequently $$f - C$$ is continuous.

Regarding the level sets: Suppose that $$y$$ is not a dyadic rational, with binary digits $$y_n$$: $$y = \sum_{n = 1}^\infty \frac{y_n}{2^n} .$$ Then $$C(x) = y$$ has exactly one solution (namely: an $$x$$ with $$x_n = 2 y_n$$), and this will also be a solution of $$f(x) = y$$. All other solutions $$x$$ necessarily have $$K < \infty$$. For such an $$x$$, we have $$|f(x) - C(x)| \le 2^{-K}$$, that is, $$|y - C(x)| \le 2^{-K}$$. Since $$y$$ is not a dyadic rational, it follows that $$x_n = 2 y_n$$ for $$n = 1, 2, \ldots, K - 1$$, and of course $$x_K = 1$$. Therefore, $$2^{-K} Z\biggl(\sum_{n = 1}^\infty \frac{x_{K+n}}{3^n}\biggr) = f(x) - C(x) = y - C(x) = \frac{y_K - 1}{2^K} + \sum_{n = K + 1}^\infty \frac{y_n}{2^n} .$$ The above equation clearly has exactly two solutions ($$Z$$ is essentially two-to-one). It follows that $$f(x) = y$$ has one solution with $$K = \infty$$ and two solutions corresponding to every finite $$K$$.

By the way, level sets corresponding to dyadic rationals are countable, too, by a very similar argument.

• This would seem to suffer the same continuity-based issues as the proposed solution in the comments... – Steven Stadnicki Nov 11 at 22:22
• @StevenStadnicki: I do not think so, the $n$-th level bumps are only $2^{-n}$ high. – Mateusz Kwaśnicki Nov 11 at 22:25
• In place of $f(x) = C(x) = x$, did you mean $f(x) = C(x) = y_0$? If so, how will you make $f(x) = C(x)$ happen? – Iosif Pinelis Nov 11 at 22:44
• @IosifPinelis: Yes, I did, thanks. Regarding the second question: $f(x) = C(x)$ outside of flat intervals of $C(x)$. If $y_0$ is not a dyadic rational, there is exactly one $x$ which $C(x) = y_0$, and this $x$ is not in any of the flat intervals. I'll try to clarify the answer momentarily. – Mateusz Kwaśnicki Nov 11 at 22:51
• Thank you for answering this question. Can you also detail the statement "intersects exactly one zigzag of $f$ of horizontal length $3^{-n}$"? – Iosif Pinelis Nov 11 at 22:57

Just to complement the answers that were already given, one can also have $$|Z(f,2^{\aleph_0})|= 2^{\aleph_0}$$: just take for $$f$$ a typical sample of Brownian motion. More precisely, almost every realisation of Brownian motion has the property that a set of $$c$$s of positive Lebesgue measure has a preimage of positive Hausdorff dimension. This can be shown by combining the fact that the zero level set of BM has positive Hausdorff dimension with Fubini and the strong Markov property.

• Thank you. If I can ask a further question which is whether you can obtain any given Hausdorff dimension for the preimage this way, perhaps even for any typical BM sample? – Ivan Meir Nov 12 at 15:57
• I would guess that you can get Hausdorff dimension close to 1 if you take an fBM with Hurst parameter close to 0, but that would maybe be a bit trickier to show. – Martin Hairer Nov 12 at 16:04
• I think it is perhaps easier to construct examples by self-similar constructions of the graph of $f$. As a rule of thumb, if the graph of $f$ is self-similar and of dimension $d \in (1, 2)$, then most sections will have dimension $d - 1$. For Weierstrass functions, results of this kind can be found here; for functions with self-similar graphs the proof should be much simpler, and the result stronger, but I do not have a reference. – Mateusz Kwaśnicki Nov 12 at 19:56
• The situation for most continuous functions from $[0,1]$ to $\mathbb R$ in the sense of Baire category is quite different, since in that sense, given any Hausdorff gauge function $h,$ for most continuous functions $f$ we have for each $x$ that $f^{-1}(x)$ has zero Hausdorff $h$-measure (also, all but two of the inverse images have cardinality $2^{\aleph_0}).$ In fact, the same holds if we replace intersections with horizontal lines by intersections with monotone functions, Lipschitz functions, preassigned modulus of continuity functions, functions in a $\sigma$-compact subset of $C[0,1].$ – Dave L Renfro Nov 14 at 11:38
• Some references for what I just stated: Bruckner/Haussermann (1985) AND Humke/Laczkovich (1985) AND Szpitun (1987) AND Hejný (1993). – Dave L Renfro Nov 14 at 11:42

A locally recurrent function takes every value in its range an infinite number of times. There exist nonconstant continuous locally recurrent functions on $$[0,1]$$. See https://msp.org/pjm/1967/21-3/pjm-v21-n3-p04-s.pdf.

• A locally recurrent function might take every value in its range an uncountable number of times (e.g., if you compose an arbitrary locally recurrent function with the projection of some space-filling curve). So this doesn't necessarily meet the requirements of the question. – Elliot Glazer Nov 12 at 4:29
• @ElliotGlazer : Actually, every level set of a continuous locally recurrent function is perfect and hence, by Cantor's theorem, has the cardinality of the continuum (if this level set is nonempty). – Iosif Pinelis Nov 12 at 5:47
• This is still interesting though as I think it shows an $f$ with $|Z(f,2^{\aleph_0})|=2^{\aleph_0}$ which I had thought would actually be harder to demonstrate and completes all the 3 possibilities $|Z(f,2^{\aleph_0})|=2^{\aleph_0}$, $|Z(f,\aleph_0)|=2^{\aleph_0}$ and $|Z(f,2^{\aleph_0})|=\aleph_0$ – Ivan Meir Nov 12 at 12:57
• @IvanMeir: Other examples include the Weierstrass function that you have mentioned, a typical path of the Brownian motion mentioned (if I remember correctly) by Yuval Peres, or the ordinate of any space-filling curve $[0,1] \mapsto [0,1]^2$. – Mateusz Kwaśnicki Nov 12 at 13:04
• @Mateusz Kwaśnicki: Regarding the Weierstrass function and some other nowhere differentiable functions, a lot of details about some little known literature is given in my answers to Smallest positive zero of Weierstrass nowhere differentiable function and Level sets of a Weierstrass nowhere-differentiable function. – Dave L Renfro Nov 14 at 11:57