# If every function $f:X\to\mathbb R$ is continuous for a non-empty topological space $X$ then does $X$ have the discrete topology ?

Let $X$ be a non-empty topological space such that every function $f:X\to\mathbb R$ is continuous , then is every subset of $X$ open ?

Pick any $x\in X$ and define $f:X\to\mathbb R$ as follows: \begin{align*} f(y)=\begin{cases}1&\text{if $y=x$,}\\0&\text{if $y\in X$, $y\neq x$.}\end{cases} \end{align*} Then, the interval $(1/2,3/2)$ is open in $\mathbb R$, so $\{x\}=f^{-1}((1/2,3/2))$ is open in $X$, since $f$ is continuous by assumption. Therefore, every singleton in $X$ is open, so the topology in question must be the discrete one.
Given $A\subseteq X$, consider the mapping $f:X\to \Bbb R$ that sends every element of $A$ to $1$ and every element of its complement to $0$. Then?
• Might this proof even work for any set we map to with $\geq 2$ elements? – GPerez Dec 29 '14 at 15:58
• It might actually have to be $T_0$, I think. – GPerez Dec 29 '14 at 16:10
• For instance, $\{a,b\}$ and the coarse topology won't prove anything about $X$. – GPerez Dec 29 '14 at 16:12