Connectedness of top. space, Intermediate Value Theorem for continuous mappings to $\mathbb{R}$
This problem is from Andreas Gathmann's lecture notes on Topology.
Similar questions have been asked already.
The problem:
Let $X$ be a top. space.
Show that:
$X$ is connected $\iff$
for every continuous function
$f:X \rightarrow \mathbb{R}$ and any
two points $x, y \in X$ every value
between $f(x)$ and $f(y)$ is attained
by $f$ on $X$.
$\Rightarrow:$
Let $X$ be connected, then $f(X)$ is connected since $f$ is continuous.
Let $x, y \in X$, and $f(x) <f(y)$.
Assume there is a $z \in \mathbb{R} $ with
$f(x) <z<f(y)$ and $z \not \in f(X) $.
Then $U:=f(X) \cap (-\infty, z)$, $(\not = \emptyset)$, and
$V:=f(X) \cap (z, \infty)$, $(\not =\emptyset)$,
are open in $f(X)$ (subspace topology), and $U \cap V =\emptyset$.
We have
$f(X) =U \cup V$, a contradiction, since $f(X)$ is connected.
$\Leftarrow$:
Assume $X$ is not connected.
Then there exist open and disjoint sets $U$ and $V$(both not empty) s.t.
$X=U \cup V$.
Consider
$f:X \rightarrow \mathbb{R}$ where
$x \rightarrow 0$ for $x \in U$,
$x \rightarrow 1$ for $x \in V$.
Then $f$ is continuous, however the Intermediate Value theorem is not applicable, and we are done.
Please correct and comment. Thank you.
Solution 1:
Both proofs are correct, the first could be made shorter by not reproving known facts. If $f(x) < f(y)$ are in $f[X]$, then $[f(x), f(y)]$ is connected in $\Bbb R$ and so as $f[X]$ is connected, $[f(x), f(y)] \subseteq f[X]$ and you're done right away (your $z \in [f(x), f(y)]$ etc.). This is assuming you know the characterisation of connected subsets of $\Bbb R$, of course.
The reverse implication is quite a standard idea (using a continuous two-valued map), I see nothing to simplify it.