# Find all continuous functions $f: \mathbb{R} \rightarrow \mathbb{N}$ and all continous functions $f: \mathbb{N} \rightarrow \mathbb{R}$.

Find all continuous functions $$f: \mathbb{R} \rightarrow \mathbb{N}$$ and all continuous functions $$f: \mathbb{N} \rightarrow \mathbb{R}$$.

My thinking process went something like this. For the case of $$f: \mathbb{R} \rightarrow \mathbb{N}$$, if I think about the function in the $$xOy$$ plane, if we would have any point at which the value would change from one natural number to some other natural number then at that point we would have a jump discontinuity. So every number from the domain $$\mathbb{R}$$ needs to be mapped to the same natural number in order to have a continuous function. Thus, we need the function to be something like

$$f:\mathbb{R} \rightarrow \mathbb{N} \hspace{1cm} f(x) = n$$

for any $$n \in \mathbb{N}$$.

In the case of $$f: \mathbb{N} \rightarrow \mathbb{R}$$ again thinking about the function in the plane $$xOy$$, the values of the function at two consecutive points $$n$$ and $$n+1$$ are not 'tied' together by anything, there's just empty space, so the function is nowhere continuous. Thus, there are no continuous functions $$f: \mathbb{N} \rightarrow \mathbb{R}$$.

I hope my reasoning is correct. But my real problem is about the writing process of this proof. Obviously I can't write on the paper all of this story that I just came up with. But how can I create a rigorous proof with what I just wrote (with definitions and all of that fluff). Thinking in terms of pictures is nice, but I have to formalize my thinking with definitions, theorems, and the like and in that regard I am lacking terribly. So how can I approach the writing of this proof?

• If you want to speak about continuity, you need some topology on both spaces. On $\Bbb R$ is quite clear, but... What topology are you considering over $\Bbb N$? Nov 4, 2020 at 19:39
• You also need to have a formal definition of continuity to work from. The graph of a function being a single connected curve is possible, but it is not the conventional choice. Nov 4, 2020 at 19:42
• For second case constant functions like in first case obbiously also work, regardless of topology.
– zwim
Nov 4, 2020 at 19:46
• Since this is an Introduction to Analysis class, I think it is most likely that the topology on these spaces are the standard topology on $\mathbb{R}$ and the subspace topology on $\mathbb{N}$ @TitoEliatron Nov 4, 2020 at 19:54
• @TitoEliatron Unfortunately I am not familiar with the term of 'topology', we haven't studied anything related to it so far. I'm sorry, but I can't clarify this.
– user592938
Nov 4, 2020 at 23:54

Since this is an Introduction to Analysis class, I think it is most likely that the topology on these spaces are the standard topology on $$\mathbb{R}$$ and the subspace topology on $$\mathbb{N}$$. The subspace topology on $$\mathbb{N}$$ is equivalent to the discrete topology on $$\mathbb{N}$$, so every function $$f:\mathbb{N} \to \mathbb{R}$$ is continuous. On the other hand, the inclusion $$i:\mathbb{N} \hookrightarrow \mathbb{R}$$ is continuous. So then if we have a continuous function $$f:\mathbb{R} \to \mathbb{N}$$, the composition $$i \circ f$$ is continuous. But then, if $$| \text{im}f | \neq 1$$ (i.e. if $$f$$ does not collapse $$\mathbb{R}$$ to a single point), then we have a continuous function $$i \circ f$$ that sends the connected space $$\mathbb{R}$$ to a disconnected subset. But if $$g: X \to Y$$ is a continuous function, $$X$$ is connected if and only if $$\text{im} g$$ is connected. So the only functions $$f: \mathbb{R} \to \mathbb{N}$$ that are continuous are those that map the reals to a singleton.