# Can a non-trivial continuous function "undo" the discontinuities of another function?

Apologies for the unclear title, I have no idea if the property I'm looking for has a better name.

I'm wondering if there exists a pair of functions $$f, g : \mathbb{R} \rightarrow \mathbb{R}$$ such that :

1. $$g$$ is a bijection and is nowhere continuous (for an example, see this answer).
2. $$f$$ is continuous and not constant.
3. $$f \circ g$$ is continuous.
• Does 1) mean that $g$ has an inverse? Apr 24 at 7:13
• @JosBergervoet Yes indeed. Apr 24 at 7:14
• But doesn't this inverse simply "undo" what the function does? And in a unique way, I'd say (there can be only one inverse). So if that is not continuous your question is answered with no... Apr 24 at 7:15
• @JosBergervoet I'm not sure I understand your line of reasoning. Indeed $g^{-1}$ isn't continuous, so it isn't a suitable candidate for $f$. But how does it follow from this that no other function $f$ can fit the bill? Edit: sorry, I missed that part of your comment: yes, I do mean something different with "undo", I don't mean the inverse of $g$. Sorry for the misunderstanding! Apr 24 at 7:22
• I was just wondering what bill you wanted to fit, but I see now what you mean, I think! Apr 24 at 7:24

This is possible. In fact, the $$g$$ in the answer you linked to will work. Recall that $$g$$ is defined by,

$$g(x) = \begin{cases} x + 1 &, x \in \mathbb{Q}\\ x &, x \notin \mathbb{Q}\end{cases}$$

Let $$f(x) = \sin(2\pi x)$$. Then $$f$$ is periodic with period $$1$$, so $$f \circ g(x) = \sin(2\pi x)$$, which is continuous.

Here is an answer to a follow-up question the OP posted in comments: namely, whether for any such $$g$$ there always exists an $$f$$ satisfying the requirements of the question. The answer is no, as the following example demonstrates.

Let $$\{E_i\}_{i \in I}$$ be the collection of equivalence classes (of real numbers) under the equivalence relation $$x - y \in \mathbb{Q}$$. Let $$\{E_n\}_{n=1}^\infty$$ be a countably infinite collection of such equivalence classes. Let $$\{q_n\}_{n=1}^\infty$$ be an enumeration of rationals with $$q_1 = 0$$. Define $$g$$ by,

$$g(x) = \begin{cases} x + q_n &, x \in E_n\\ x &, \, \mathrm{otherwise}\end{cases}$$

Since each $$E_n$$ is dense, it is not hard to verify that $$g$$ is indeed bijective and nowhere continuous. Now assume $$f$$ is a continuous function s.t. $$f \circ g$$ is continuous. Note that, on $$E_n$$, $$f \circ g(x) = f(x + q_n)$$. By density of $$E_n$$ and continuity of the functions on both sides, we see that $$f \circ g(x) = f(x + q_n)$$ must hold for all $$x \in \mathbb{R}$$. But this means,

$$f(0) = f(0 + q_1) = f \circ g(0) = f(0 + q_n) = f(q_n)$$

for all $$n$$. Thus, $$f$$ is constant on rationals. By continuity of $$f$$ and density of rationals, we conclude that $$f$$ must be constant.

• Thanks! This is spurring a ton of questions for me (given an arbitrary $g$, will we always be able to find a corresponding $f$? what if we add constraints on $f$, for instance that it not be periodic? what if we want $g \circ f$ to be continuous instead?...). Do you know if these questions belong to a particular field, or if there are keywords which could help me find relevant papers? Apr 24 at 7:41
• @Aldoggen I believe the OP asks for $g$ to be a bijection, and what you proposes is not a bijection. In any case, to deal with your example, you only need $f$ to send $0$ and $1$ to the same value, and there are plenty of continuous functions that are not constant but send $0$ and $1$ to the same number. Apr 24 at 17:19
• @TheAmazingKitchen I edited my answer to add in an example showing that your first question has a negative answer. Apr 24 at 18:09
• @TheAmazingKitchen Periodicity is not necessary. Though admittedly this example is a bit of cheating: let $g(x)=(x+1)^3$ on algebraic numbers and $g(x)=x^3$ otherwise. Then $f(x)=\sin(2 \pi x^{1/3})$ would work, and $f$ is not periodic. Apr 24 at 18:11
• @TheAmazingKitchen I’m unsure as to whether $g \circ f$ can be continuous. Likely not, but I haven’t found a proof yet. As for finding relevant papers, I don’t think there’s any modern papers addressing this specific kind of questions. Perhaps there would be some old papers, from 19th century and early 20th century, during the early development of modern real analysis? There were some efforts to construct real variable functions with exotic properties back then. Apr 24 at 18:49