# Example of a continuous map having a connected codomain but a disconnected domain.

As I was working problems on connectedness (of metric spaces and subsets of metric spaces) for my analysis class, I came across a generalized form of the intermediate value theorem that stated: the continuous image of a connected set is connected. While this interesting and all, it got me thinking:

Are there examples of continuous maps having a connected codomain, but a disconnected domain?

I think I may have constructed one, but I am unsure if this is correct or not: define the continuous function $$f : (-\infty, 0) \cup (0, \infty) \to \{5\}$$ by $$f(x) := 5$$. Therefore, the codomain is clearly connected and the domain is disconnected? As I thought more about this, wouldn't constructing such examples contradict the (generalized) intermediate value theorem?

• The intermediate value theorem says that if the domain is connected, the image is aswell. It doesn't say anything about what happens when the domain isn't connected, so no there's no contradiction. Commented Oct 8, 2020 at 20:37