# What topology must X have if every real-valued function defined on X is continuous?

Question:

What topology must $X$ have if every real-valued function defined on $X$ is continuous?

Solution:

$X$ must have the discrete topology where every subset is open.

To show this it suffices to show points in $X$ are open.

Let $x \in X$. Define $f : X \rightarrow \mathbb{R}$ by

$f(x) = 0$ and $f(y) = 1 \:\:\forall\: y \:\neq \:x$.

Then $f^{−1} ((\frac{-1}{2}, \frac{1}{2})) = \{x\}$.

Thus if $f$ is continuous, since $(\frac{-1}{2}, \frac{1}{2})$ is open, $\{x\}$ is open.

Can anyone possibly explain the logic and reasons behind this solution to someone very new to topology?

• That's a pretty unclear question. What in particular do you want explained? You're looking at a bump function on $X$, which is $1$ on $x$ and $0$ everywhere else. If this is continuous, $\{x\}$ has to be open. – Balarka Sen Jan 23 '16 at 19:51
• Well i dont understand why it must have the discrete topology. I understand that it suffices to show that points in X are open to show that X have the discrete topology. Then they construct a function. I dont understand why its enough to use this particular function or what is happening on the fifth row of the solution. I understand tho that if f is continous its inverse takes open intervals to open intervals. – JKnecht Jan 23 '16 at 20:11
• I started with topology a couple of days ago so its still pretty confusing to me... – JKnecht Jan 23 '16 at 20:13
• They're saying every real valued function on $X$ is continuous. So in particular this "bump" function $f$ must be continuous too. But by definition, preimage of open sets by continuous functions is open. Thus, $f^{-1}(-1/2, 1/2)$ needs to be open, as $(-1/2, 1/2)$ is open. However, the only value $f$ takes in $(-1/2, 1/2)$ is $0$ and only when $f$ is applied to $x$, so $f^{-1}(-1/2, 1/2) = \{x\}$. So $\{x\}$ needs to be open. – Balarka Sen Jan 23 '16 at 20:16
• @Balarka Sen...Yes now i am starting to understand. And i even understand why they can say that it must have the discrete topology. Thanks! – JKnecht Jan 23 '16 at 20:33

The codomain being $\mathbb{R}$ is a little misleading...all you need to know is that $\mathbb{R}$ contains a copy of $\{0,1\}$ with the discrete topology. (Note that the subspace $\{0,1\} \subset \mathbb{R}$ is such that the subspace topology is the discrete topology).
Any map $f:X \to \{0,1\}$ separates $X$ into two disjoint subsets--the preimage of $0$ and the preimage of $1$. Intuitively, because $0$ and $1$ are not "close together" in the codomain, this function is "breaking" $X$ into two pieces, one of which it assigns to $0$ and the other to $1$. If $f$ is surjective, these two pieces are nonempty.
In order for $f$ to be continuous (i.e. in order for $f^{-1}(\{1\})$ and $f^{-1}(\{0\})$ to be open), the pieces had to be already "broken apart" to begin with (since continuity means $f$ can't break anything). So if any such function is continuous, that means that anytime I break $X$ into two pieces $X_1$ and $X_2$, the sets $X_1$ and $X_2$ were already different connected components--in other words, they are both closed and open.
Since any subset $X_1 \subset X$ is open, $X$ has the discrete topology.