Let $f: D \rightarrow \mathbb{R}$, continuous at all points. Show that for each interval $I \subset D$, $f(I) \subset \mathbb{R}$ is an interval Can someone help me with this proof.
I tried the following:
WTP: $\forall I \subset D$, $f(I)\subset \mathbb{R}$ is an interval.
$f(I) =  \{ f(x)| x \in I \}$
proof. Let $I = [a,b]$ an interval walog.
$I \subset D$. Let $a, b \in I$
Let $f(a), f(b) \in I$ (walog. $f(a) < f(b)$)
walog. Let $f(a) \leq y \leq f(b)$ using the intermediate value theorem $\Rightarrow \exists x \in [a,b]$
such that $f(x) = y$.
$ \therefore \forall y$  such that $f(a) \leq y \leq f(b) \Rightarrow f(a) \leq f(x) \leq f(b)$, $x \in I$
$ \therefore  \exists [f(a), f(b)] \subset f(I)$
WTP: $f(I) \subset [f(a), f(b)]$
To be honest I got to this point, but I don't know if I'm on the right track.
 A: To expand on Mason's comment, you are assuming that $I$ is a closed and bounded interval. But there are 10 different types of interval, Closed and bounded is only one of them.
Intervals can be characterized as the sets $C$ with the property:

*

*for any $u, v \in C$ with $u < v$, if $u < x < v$, then $x \in C$ as well.

If you have that characterization of intervals, then your task is much easier.  Because all you need to show is that if $u,v \in I$ with $f(u) < f(v)$, then for any $y$ with $f(u) < y < f(v)$, there is some $x \in I$ with $f(x) = y$, which follows from the intermediate value theorem.
But almost certainly, you do not have that characterization available, as almost no one ever gives it. so you have to examine each of the ten possible intervals and show that they all work:
$$[a,b], [a, b), (a, b], (a,b), [a,\infty), (a, \infty), (-\infty, b], (-\infty, b), (-\infty, \infty), \emptyset$$
(whether the empty set is an interval is something people may differ on).
In all cases, you need to show $f(I) = \{\ [\text{ or }(\ \} \inf f(I), \sup f(I)\{\ ]\text{ or })\ \}$.
