Image of Interval by Continuous Function is Interval

Theorem
Let $I$ be a real interval.

Let $f: I \to \R$ be a continuous real function.

Then the image of $f$ is a real interval.

Proof
Let $J$ be the image of $f$.

By Interval Defined by Betweenness, it suffices to show that:
 * $\forall y_1, y_2 \in J: \forall \lambda \in \R: y_1 \le \lambda \le y_2 \implies \lambda \in J$

So suppose $y_1, y_2 \in J$, and suppose $\lambda \in \R$ is such that $y_1 \le \lambda \le y_2$.

Consider these subsets of $I$:
 * $S = \left\{{x \in I: f \left({x}\right) \le \lambda}\right\}$
 * $T = \left\{{x \in I: f \left({x}\right) \ge \lambda}\right\}$

As $y_1 \in S$ and $y_2 \in T$, it follows that $S$ and $T$ are both non-empty.

Also, $I = S \cup T$.

So from Interval Divided into Subsets, a point in one subset is at zero distance from the other.

So, suppose that $s \in S$ is at zero distance from $T$.

From Limit of Sequence to Zero Distance Point, we can find a sequence $\left \langle {t_n} \right \rangle$ in $T$ such that $\displaystyle \lim_{n \to \infty} t_n = s$.

Since $f$ is continuous on $I$, it follows from Limit of Image of Sequence that $\displaystyle \lim_{n \to \infty} f \left({t_n}\right) = f \left({s}\right)$.

But $\forall n \in \N^*: f \left({t_n}\right) \ge \lambda$.

Therefore by Lower and Upper Bounds for Sequences, $f \left({s}\right) \ge \lambda$.

We already have that $f \left({s}\right) \le \lambda$.

Therefore $f \left({s}\right) = \lambda$ and so $\lambda \in J$.

A similar argument applies if a point of $T$ is at zero distance from $S$.

Topological Proof
As before, let $J$ be the image of $f$.

By Subset of Real Numbers is Interval iff Connected we need to show that $J$ is connected (and hence an interval).

Suppose not.

Then there exists a separation $S \mid T$ of $J$.

Define $A = f^{-1}(S)$ and $B = f^{-1}(T)$. $A$ and $B$ are both non-empty.

Because $f$ is continuous, by Continuous iff inverse image of any open set is open we must have $A$ and $B$ open.

Now, $A \cap B = f^{-1}(S) \cap f^{-1}(T) = f^{-1}(S \cap T) = \emptyset$, because $S \mid T$ is a separation.

Also, $A \cup B = f^{-1}(S) \cup f^{-1}(T) = f^{-1}(S \cup T) = f^{-1}(J) = I$ ($S \mid T$ is a separation of $J$).

Hence $A \mid B$ is a separation of $I$. $I$ can certainly not be an interval (because it is not connected).

This is a contradiction. Thus $J$ must be an interval.

Note: The above proof (sans modification) will also be valid if the interval $I$ is replaced by a connected domain $D \subset \R^n$ in the statement of the theorem. This, more general form of the theorem becomes very useful when dealing with multivariable calculus.