Prove that a monotone and surjective function is continuous Let $I$ be a interval and $f:I \rightarrow \mathbb{R}$ monotone and surjective prove that $f$ is continuous.
I tried using the definition of $\epsilon$-$\delta$ and supposing that $f$ is not continuous but I don't see where use that $f$ is surjective.

choose a point 'a' from I. Wlog choose a is an interior point, then there exists an open interval $(x_1, x_2)$ in I containing a, now since f is monotone (wlog, assume increasing) $f(x_1)\leq f(a)\leq f(x_2)$. let $$p= min\{f(a)-f(x_1),f(x_2)-f(a)\}$$ now $f(a)-p$ and $f(a)+p$ will belong to f(I), and since f is surjective they have a preimage, say $r$ and $s$ respectively,(by contrapositive since f is increasing
$$f(x)\leq f(y) \leq x \leq y, r \leq a \leq s)$$ now take
$$ delta1 = min \{a-r, s-a\} $$
=> $r \leq (a-delta1) \leq a \leq (a+delta1) \leq s)$
now epsilon be given, if $epsilon > p$, then delta1 works by epsilon-delta definition of continuity,
now, say epsilon is less than p, then f(a)-epsilon and f(a)+epsilon must have a preimage(because f is surjective) say c and d respectively, now take delta=min{a-c, d-a} this delta will work.. why? draw pictures and check.. this is a easy nice proof, use geometry and you'll never forget this proof...
