# Continuous mapping from a nowhere dense set to dense set

Let $$X$$ be a complete metric space, $$B$$ be a (closed) nowhere dense set in $$X$$, $$f:B\rightarrow X$$ be a continuous mapping. Is it possible that $$f(B)$$ is dense in $$X$$?

I think that is possible. But I can't give a counter-example. Any help will be appreciated.

• It is possible. Can you think of an example if $X=\mathbb R?$ Jul 1, 2022 at 15:05
• @D.Brogan Are you sure? I have a proof to the contrary Jul 1, 2022 at 15:33
• (so if you do have a counterexample, I'd like to know because it would show my proof to be false) Jul 1, 2022 at 15:43
• I believe my example has a counterexample @FShrike Jul 1, 2022 at 17:32
• This is a cool question. Could you provide some context @Ken.Wong? I'm curious where it came from. Jul 1, 2022 at 17:34

$$\textbf{Theorem}$$: Every compact metric space is a continuous image of the Cantor set $$\mathcal{C}$$. (See here)

Let us consider the set $$[0, 1]$$ as euclidean subspace of $$(\Bbb{R}, d_{\text{std}})$$.

Then there there exists a continuous onto function $$f:\mathcal{C} \to [0, 1]$$.

Now $$\mathcal{C}\subset [0,1]$$ is closed nowhere dense but $$f(\mathcal{C})=[0, 1]$$ which is a trivial dense subset of $$[0,1]$$.

Note: $$f$$ is here the restriction of the cantor function on the cantor set $$\mathcal{C}$$.

• I am just wondering, what if the nowhere dense set is an infinite-dimensional subspace in Hilbert space, does the conclusion hold? Since the set is not compact anymore. Jul 2, 2022 at 1:58
• @Ken.Wong Of course, as long as your Hilbert space is separable. Jul 2, 2022 at 4:33
• @Ken.Wong Consider the Hilbert space $X = \ell_2(\mathbb{N})$, with the nowhere-dense subspace $B$ defined by $x_1 = 0$. The image of $B$ under the left-shift operator $(x_n) \mapsto (x_{n+1})$ is all of $X$, obviously dense. The left-shift is continuous and linear on all of $X$. Jul 2, 2022 at 16:56

Since $$B$$ is nowhere dense, it inherits the discrete topology from $$X$$, which means that any function from $$B$$ will be continuous. Thus any surjection from $$\mathbb{Z}$$ onto $$\mathbb{Q}$$ serves as an example.

But we can do better than this. It is actually possible for $$f$$ to be continuous on all of $$X$$, with $$f(B)$$ still dense! Let $$X$$ be the positive reals, with $$f(x)=x\sin(x)$$. Define $$B = \bigcup_{n \in \mathbb{N}} \{2\pi n^3 + \sin^{-1}(\frac{k}{n^4}): k \in \mathbb{N}, k < n^2\}.$$ One can see that $$B$$ is nowhere dense: every interval of length $$2\pi$$ contains only finitely many points of $$B$$. To show $$f(B)$$ is dense, we need to construct a $$b \in B$$ with $$|b\sin(b) - x| < \epsilon$$ for any arbitrary $$x, \epsilon > 0$$. For large $$n$$, we have that $$\frac{1}{n^2} < \frac{\epsilon}{2}$$. For larger $$n$$, there is some integer $$k$$ for which $$|\frac{2\pi k}{n} - x| < \frac{\epsilon}{2}$$. For still larger $$n$$, we also can guarantee that $$k < n^2$$. Therefore $$B$$ contains the point $$b = 2\pi n^3 + \sin^{-1}(\frac{k}{n^4})$$. Now, $$f(b) = b \sin(b) = b \cdot \frac{k}{n^4} = \frac{2\pi k}{n} + \frac{k}{n^4}\sin^{-1}(\frac{k}{n^4})$$. Thus,

$$|b - x| = \bigg| \frac{2\pi k}{n} + \frac{k}{n^4}\sin^{-1}(\frac{k}{n^4}) - x \bigg| \leq \bigg| \frac{2\pi k}{n} - x\bigg| + \bigg|\frac{k}{n^4}\sin^{-1}(\frac{k}{n^4}) \bigg|.$$

The first term is less than $$\frac{\epsilon}{2}$$ by choice of $$k$$. The second term is also less than $$\frac{\epsilon}{2}$$, because $$\sin^{-1}(\frac{k}{n^4})$$ is bounded by 1, and $$\frac{k}{n^4} < \frac{n^2}{n^4} = \frac{1}{n^2} < \frac{\epsilon}{2}$$. Therefore $$|b - x| < \epsilon$$.

There are probably better examples than this. This related post offers a hypothesis which, if true, would give a far more elegant example.

• Thank you for pointing out my error. I was conceptualising $B$ still with the topology on $X$, not as a subspace. My very first thought was using the isomorphisms of $\Bbb Z\cong\Bbb Q$ but I discounted it because I viewed the integers as "not open" - but of course they are, in the subspace Jul 1, 2022 at 17:44

Any space-filling curve gives you an example of a continuous surjective map $$B=[0,1]\subset X=[0,1]^2\to X.$$ Actually, this situation is quite generic. As long as your metric space $$X$$ is, say, compact, and contains a nowhere dense subset $$B$$ homeomorphic to the Cantor set, you get continuous surjective map $$B\to X$$. (This is a theorem due to Hausdorff.)