# Confusion on "preimage of a closed set under a continuous function is closed"

I have some confusion on the theorem: preimage of a closed set under a continuous function is closed. If we define $$f:(0,1)\to \{0\}$$ then $$f$$ is a continuous function since $$f(x)=0$$ for all $$x$$ in the domain, and we can apply the theorem so that $$(0,1)$$ is closed. But this is clearly not correct and I can't find what is wrong.

• $(0,1)$ is a closed subset of $(0,1)$ (and more generally every topological space is open and closed in itself). It's just not closed in $\Bbb{R}$; that's a separate unrelated matter which doesn't in any was disprove the theorem. You need read more about the subset topology. Commented Oct 3, 2022 at 4:48

Here is the problem: when you write $$f:(0,1) \to \{0\}$$, you're assuming that the domain $$(0,1)$$ carries a topology (in this case, it will be the subspace topology induced by the Euclidean topology in the real line). So the conclusion here is that $$f^{-1}(\{0\})=(0,1)$$ is closed in $$(0,1)$$. And every subset of a topological space is closed in its own subspace topology.
If the word "topology" doesn't make sense to you yet, the correct conclusion is that $$f^{-1}(\{0\})$$ is just the intersection of $$(0,1)$$ with a closed subset of $$\mathbb{R}$$.
Let $$(X,d_X)$$ and $$(Y,d_Y)$$ be two metric spaces and let $$f:X\to Y$$ be a function. Then $$f$$ is continuous if and only if for any set $$S$$ closed in $$Y$$, the preimage $$f^{-1}(S)$$ is closed in $$X$$.
Note that in this case your space $$X$$ is the space $$(0,1)$$ instead of the usual space $$\mathbb R$$, and $$(0,1)$$ is always closed in $$(0,1)$$.