If $f$ is continuous and $I$ is an interval, then $f(I)$ is an interval My prof says that the proof is not technically correct. But I didn't understand from his explanation how it is not correct. Can you please take a look and let me know why exactly my proof is not correct?
Let $f$ be a continuous function and $I$ be an interval, say $[a, b]$. Prove that $f(I)$ is an interval, where $f(I)=\{f(x), x\in I\}$.

Proof:
  Suppose, for the sake of contradiction, that $f(I)$ is not an interval. Then $\exists x \in I$ such that $f(x)\not\in f(I)$. By the Extreme Value Theorem, $\exists c\in [a,b]$ such that $f(c)\ge f(y), \forall y\in I$. In particular, $f(c)\ge f(a)$. Also $\exists d \in [a,b]$ such that $f(d)\le f(y), \forall y \in I$. Thus $f(d)\le f(x)\le f(c)$. Since $f$ is continuous, and $f(d)$ and $f(c)$ are the end points of $f(I)$, $f(x)$ must be in $f(I)$. Hene, $f(I)$ is an interval.

 A: The obvious mistakes in your approach have been amply described in other answers. I would like to focus on providing a solution. Let's note that a set $I$ of real numbers is called an interval if for any points $x, y \in I$ with $x < y$ we have $z \in I$ for all numbers $z$ satisfying $x < z < y$. A set consisting of a single real number is also an interval according to this definition.
Now let $I$ be an interval and $f$ be a function from $I$ to $\mathbb{R}$ and suppose that $f$ is continuous. If $f(I)$ is not an interval then there exist two points $a, b \in f(I)$ such that $a < b$ and there is a number $c \in (a, b)$ such that $c \notin f(I)$. Let $x, y \in I$ be such that $f(x) = a, f(y) = b$. Since $a < c < b$ therefore by intermediate value theorem there is a number $z$ between $x, y$ (so that $z \in I$) such that $f(z) = c$. Hence by definition of $f(I)$, the number $c$ lies in $f(I)$. We reach a contradiction and thus $f(I)$ must be an interval.
Thus the result in question is an immediate consequence of the intermediate value theorem for continuous functions.
A: Let $f:I \rightarrow \mathbb{R}$ be a continuous function. Suppose $f(I)$ is not an interval. Then there is an $y \in \mathbb{R}$ such that for all $x \in I$, either $f(x) < y$ or $y < f(x)$ and both the sets $\{x \in I\ |\ f(x)<y\}$ and $\{x \in I\ |\ y<f(x)\}$ are non-empty. Consider the intervals $I_1: = (-\infty, y)$ and $I_2:=(y,\infty)$. Then $f^{-1}[I_1]\cap f^{-1}[I_2]=\emptyset$. Since $f$ is continuous both pre-images of $I_1$ and $I_2$ under $f$ are open sets in $I$. But then $I=f^{-1}[I_1]\cup f^{-1}[I_2]$. Then $I$ is not an interval, since it is a union of two non-empty disjoint open sets.
A: Proof 1.  Any non-empty interval $I$ is equal to $\cup_{n\in N}J_n$ where each $J_n$ is a non-empty bounded  closed interval with $J_{n+1}\supset J_n$ for each $n.$ 
Let $c_n, d_n\in J_n$ with $f(c_n)=\min \{f(x):x\in J_n\}$ and $d_n=\max \{f(x):x\in J_n\}.$ 
By the Intermediate Value Property, every $y \in (f(c_n),f(d_n)$ (if there is any) is equal to $f(x)$ for some $x$ between $c_n$ and $d_n$. Such $x$ belongs to $J_n.$ Therefore $$f(J_n)\supset [f(c_n),f(d_n)].$$  And $$f(J_n)\subset [f(c_n),f(d_n)]$$ by def'n of $c_n$ and $d_n.$ So $$f(J_n)=[f(c_n),f(d_n)].$$ Since $J_n\subset J_{n+1}$ we have $$f(c_{n+.1})\leq f(c_n)\leq f(d_n)\leq f(d_{n+1}.$$ So if we let $S=\inf_{n\in N}f(c_n)$ and $T=\sup_{n\in N}f(d_n)$ (allowing the possibilities  $S=-\infty$ or $T=\infty)$ then $$(S,T)\subset f(I)\subset [S,T].$$
Proof 2. By contradiction. Any $V\subset R$ is NOT an interval iff there exist $a,b,c\in T$ with $a,c\in T$ and $b\not \in T.$ 
If $f(I)$ is not an interval,find $x,y\in J$ with $f(x)=a<c=f(y),$ where some $b\in (a,c)\backslash f(I).$ 
But this contradicts the Intermediate Value Property, because every $b\in (f(x),f(y))$ is equal to $f(z)$ for some $z$ between $x$ and $y$, which makes $z\in I$  and  hence $b=f(z)\in f(I)$.
Proof 3. (i) Prove a subspace of $R$ is a connected space iff it is an interval. (ii) The continuous image of a connected space is a connected space.
