# For every real function $f$, is there an everywhere continuous real function $g$ above $f$?

This is a follow-up to my previous question, here: For every real function $f$, is there a strictly increasing real function $g$ above $f$?. Suppose $$f$$ is a function from reals to reals. It can be any kind of function, not necessarily continuous. Does there exist a real function $$g$$ such that $$g$$ is everywhere continuous and everywhere greater than or equal to $$f$$?

The problem here is that an arbitrary function $$f$$ can be incredibly complicated and pathological. There is no real way of getting control over such an arbitrary function, hence there is little hope of bounding such a function (even on some bounded interval). As an example, consider the function $$f$$, defined by the formula $$f(x) = \begin{cases} (-1)^q q & \text{if x = p/q is rational, in lowest terms, and} \\ 0 & \text{if x is irrational.} \end{cases}$$ This function is unbounded (both above and below) on any interval. As such, this function cannot be bounded by a continuous function, since every continuous function is bounded on any closed interval.

For the question as stated, there is a very simple counterexample: $$f(x)= \begin{cases} 1/x & \text{if }x\neq0\\ 0 & \text{if }x=0 \end{cases}$$ This function is unbounded on the interval $$[0,1]$$. Any continuous function on a closed interval achieves a maximum and a minimum, so it cannot dominate $$f(x)$$.

(One says that $$g$$ dominates $$f$$ on a set $$S$$, if $$f(x)\leq g(x)$$ for all $$x\in S$$.)

If you weaken the domination requirement, then examples become harder to construct. This function $$f$$ is not dominated by a continuous function on any open interval: $$f(x) = \begin{cases} q & \text{if }x = p/q \text{ is rational in lowest terms}\\ 0 & \text{if }x \text{ is irrational} \end{cases}$$ However, the identically-zero function dominates this with countably many exceptions.

Suppose we ask, is there a function $$f$$ such that no everywhere continuous dominates $$f$$, even allowing countably many exceptions? The answer is yes. We can construct it using the well-ordering theorem. Let $$\{r_\alpha : \alpha<\gamma\}$$ be a well-ordering of the interval $$[0,1]$$; here, $$\gamma$$ is the first ordinal with cardinality $$2^{\aleph_0}$$. Now, every ordinal is of the form $$\lambda+n$$ where $$\lambda$$ is a limit ordinal or 0, and $$n$$ is a natural number (aka finite ordinal). Define $$f(r_{\lambda+n})=n$$ and define $$f$$ arbitrarily outside the interval $$[0,1]$$.

Suppose $$g$$ is an everywhere continuous function (or just continuous on the interval $$[0,1]$$). Let $$E$$ be a countable set. We demand that $$f(x)\leq g(x)$$ only for $$x\not\in E$$. Since $$E$$ is countable, there is a limit ordinal $$\lambda<\gamma$$ such that all elements of $$E\cap[a,b]$$ have indices less than $$\lambda$$ in the enumeration. Say $$M$$ is the maximum of $$g(x)$$ on $$[0,1]$$, and let $$n$$ be greater than $$M$$. Then $$f(r_{\lambda+n})>g(r_{\lambda+n})$$, and $$r_{\lambda+n}$$ is not in $$E$$.

With a minor modification, $$f$$ is not dominated on any interval, even allowing countably many exceptions. For the initial enumeration $$\{r_\alpha : \alpha<\gamma\}$$, demand also that $$|r_\lambda-r_{\lambda+n}|<1/n$$; this is easily done using transfinite induction. For any interval $$(a,b)\subset[0,1]$$, we must have a limit ordinal $$\lambda$$ such that $$r_\lambda\in(a,b)$$ because $$(a,b)$$ has cardinality $$2^{\aleph_0}$$ and $$\gamma$$ is the first ordinal with cardinality $$2^{\aleph_0}$$. Also we can demand that $$\lambda$$ is larger than the indices of all the elements of $$E$$, as before. For $$n$$ large enough, $$r_{\lambda+n}$$ is also in $$(a,b)$$, not in $$E$$, and $$f(r_{\lambda+n})>g(r_{\lambda+n})$$ as before.

aschepler suggests in a comment a more concrete construction which accomplishes the same thing. On the interval $$[0,1]$$, let $$f(x)=n$$ if the longest string of consecutive zeros in the binary expansion of $$x$$ is $$n$$. If there is no maximum, then $$f(x)=0$$. Given any interval $$(a,b)$$, we pick a prefix so that all $$x$$'s with that prefix lie in $$(a,b)$$. (This is always possible because the finite-length binary expansion represent the dyadic rationals, which are dense in $$[0,1]$$.) There are clearly an uncountable number of $$x$$'s with that prefix for which $$f(x)=n$$, so at least one is not in $$E$$.

• Or a more explicit $f$ which cannot be dominated almost everywhere by any continuous function: $f(x)$ is the length of the largest substring of all zeros found after the radix point in the binary expansion of $x$, if there is a maximum length of such substrings. If there is no maximum length (including the case $x=a 2^n$ for integers $a$ and $n$, so the expansion has an infinite string of zeros), then $f(x)=0$. Commented Jul 12, 2023 at 21:00
• Nice! But is there an easy way to see that the inverse image of $n$ has positive measure within any interval? Commented Jul 13, 2023 at 15:16
• I might have been wrong about "almost everywhere", but it at least does the thing where any continuous function will fail to dominate $f$ on an uncountable set. Commented Jul 13, 2023 at 18:34
• OK. I'll add it to my answer. Commented Jul 13, 2023 at 20:11