Continuous functions on trivial topologies are constant? I am reading Singer/Thorpe Lecture Notes on Elementary Topology and Geometry and at the start of Section 2.2 it is stated, "If S is a topological space in which the only open sets are the empty set and S, then one sees easily that the only continuous real-valued functions on S are the constant functions."
I have been stuck at this section for a couple of days, as I am having trouble with the above statement. If I consider an arbitrary set S with more than one element and the trivial topology on S, then the identity mapping from S to itself should be both continuous (preimage of the empty set and S itself are the empty set and S, so both are open) and non-constant (as S has more than one element, so more than one element is mapped to).
The answers to this question on stack exchange: When does trivial topology implies continuous functions are constant functions? seem to also imply that there would be additional requirements necessary in order to make the original statement true.
I'm guessing there is a logical error in my counterexample and that I am misunderstanding the text, but I am having trouble in figuring it out myself. Thank you in advance for the help :)
 A: If $f: S \to \Bbb R$ is continuous (where $\Bbb R$ has its standard topology; this is what's meant by a "continuous real-valued function") and $f$ is not constant, then $f$ assumes at least two distinct values, say $f(s_0) \neq f(s_1)$, say WLOG $f(s_0) < f(s_1)$. Then $U = (\leftarrow, f(s_1))$ is open in $\Bbb R$ (it's an open segment so open in the order topology), $f(s_1) \notin U$ so $s_1 \notin f^{-1}[U]$, and $f(s_0) \in U$ so $s_0 \in f^{-1}[U]$.
As $f$ is assumed to be continuous, $f^{-1}[U]$ is open in $S$ while $\emptyset \neq f^{-1}[U] \neq S$, which contradicts the fact that $S$ has the trivial topology. So $f$ was constant QED.
We could also have used the closed set $\{f(s_0)\}$ as well for a similar reasoning with closed sets etc. In the linked question they use only that we could take this closed singleton set as $\Bbb R$ is a $T_1$ space. So it's essentially that same argument.
A: Suppose that $f:S\to\mathbb{R}$ is continuous. Let $c\in f(S)$ and $\epsilon>0.$ Then $I=(c-\epsilon, c+\epsilon)$ is open so since $f$ is continuous, $f^{-1}(I)\subseteq S$ is open. But there are only two open sets in $S$: the empty set and the whole of $S$. And since $c\in f(S),$ $f^{-1}(I)$ cannot be empty but must be all of $S$. Thus, $f(S) \subseteq (c-\epsilon, c+\epsilon).$ Since this is valid for all $\epsilon>0$ this implies that $f(S)=\{c\},$ i.e. $f$ is constant.
