I'm tasked with proving the following:
Let $f: D \rightarrow \mathbb{R}$ be strictly increasing. Show that if $f(D)$ is an interval then $f$ is continuous.
To gain some intuition for how to solve this, I tried to find an example of each of the following:
An example of a function which is strictly increasing, but the codomain is not an interval, and thus resulting in it not being continuous.: Let $D = [0,1]$ and let $f(x) = x $ for $x \in [0,0.5)$ and let $f(x) = 2+x$ for $x \in [0.5, 1]$.
An example of a function in which the codomain is an interval, but not strictly increasing, and thus resulting in it not being continuous. Having trouble coming up with an example for this one.
I saw this question: $f$ is monotone on D and $f(D)$ is an interval But to be honest it did not help me understand anything more deeply.
Can someone help me come up with an example for $2.$ ? And also give me a hint on proving this?
For 2, let $D = [-1, 1]$, and let $$ f(x) = \left\{ \begin{array}{lll} x + 1 & \mbox{ on } & [-1, 0[ \\ x & \mbox{ on } & [0, 1] \\ \end{array} \right. $$
Keep in mind, though, that failure of monotonicity does not necessarily result in failure of continuity; e.g., on the same $D$, take $f(x) = x^2$.