Image of Interval by Continuous Function is Interval/Proof 1

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_{> 0}: 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$.