Let \(X\) be a topological space such that every function \(f: X \to \mathbb{R}\) is continuous. Then

A. \(X\) has the discrete topology.

B. \(X\) has the indiscrete topology.

C. \(X\) is compact.

D. \(X\) is not connected.


We know that if \(Y\) is a discrete space then any function \(g: Y \to Z \) is continuous.

Option A asks whether the converse to this is true in the case that \(Z= \mathbb{R} \).

To prove/disprove whether \(X\) has the discrete topology or not it is enough to prove whether every singleton set is open or not.

If we can show that for every \(x\in X\) there exists a function \(f_x :X \to \mathbb{R}\) such that \(f_x^{-1} (-1,1) = \{x\} \) then we are done. Because we are given that \(f_x\) if exists must be continuous, and since \((-1,1)\) is open in \(\mathbb{R}\) we will have the inverse image of it open in \(X\), so \(\{x\} \) will be open in \(X\).

Now, this target is easy to handle. We define for each \(x\in X\)

\(f_x (x) = 0 \) and \(f_x (y) =2\) for \(y \neq x \).

This \(f_x\) satisfies our desired property. So \(X\) is discrete.

Taking \(X= \mathbb{Z}\) (for example) shows that \(X\) does not need to be indiscrete nor does it have to be compact.

Taking \(X= \{0\} \) shows that \(X\) may be connected. Ofcourse if \(X\) has cardinality more than 1, it is not connected.