Intermediate Value Theorem (Topology)

Theorem
Let $f : X \to Y$ be a continuous map, where $X$ is a connected space and $Y$ is an ordered set in the order topology.

If $a$ and $b$ are two points of $X$ and if $r$ is a point of $Y$ lying between $f(a)$ and $f(b)$, then there exists a point $c$ of $X$ such that $f(c) = r$.

Proof
Let $a, b \in X$, and let $r \in Y$ lie between $f(a)$ and $f(b)$.

Define sets $A = f(X) \cap (-\infty \, . \, . \, r)$ and $B = f(X) \cap (r \, . \, . \, \infty)$.

These sets are clearly disjoint, and they are clearly nonempty since one contains $f(a)$ and the other contains $f(b)$.

We can also see that they are both open by definition as the intersection of open sets.

Assume there is no point $c$ such that $f(c) = r$.

Then $f(X) = A \cup B$, so $A$ and $B$ constitute a separation of $X$.

But this contradicts the fact that the image of a connected space under a continuous mapping is connected.