I am working through a theorem in Advanced Calculus, Fitzpatrick. Ch3, Theorem 3.23
Suppose $f: D \rightarrow \mathbb{R}$ is monotone. Prove that if $f(D)$ is an interval, then $f$ is continuous
I solved it a different way than the book, I am looking for confirmation that my method is valid. If not, where did I go wrong?
My attempt I will just do the case when $f$ is monotone increasing.
Assume $f(D)$ is an interval. Our goal is to prove $$\forall x \in D \quad \{x_n\} \text { converges to } x \rightarrow \{f(x_n)\} \text{ converges to } f(x)$$
Let $x$ be arbitrary element of $D$ and assume there exists a sequence $\{x_n\} \subset D$ that converges to $x$. There exists a subsequence of $\{x_n\}$, call it $\{x_{n_k}\}$, that is monotone increasing. It can be shown that since $\{x_n\}$ converges to $x$, then $\{x_{n_k}\}$ converges to $sup \{x_{n_k}\} = x$.
Since $f$ is monotonic increasing, $\{f(x_{n_k})\}$ is monotonic increasing. Note that this implies $\forall k \in \mathbb{N}, f(x_{n_k}) \leq f(x)$, since $x$ is the supremum of the subsequence. Therefore $\{f(x_{n_k})\}$ is a bounded monotonic sequence, which converges to $sup \{f(x_{n_k})\} = f(x)$.
Therefore we have shown $\{f(x_{n_k})\}$ converges to $f(x)$ for arbitrary $x \in D$.