Closed or open if it's continuous and not surjective?

If $f:[0,1]\rightarrow [a,b]$ is a continuous function, and $f([0,1])=(c,d)\subset [a,b]$. Is $f^{-1}([a,b])$ open or closed in $[0,1]$?

If open: Since $[a,b]$ is closed so is $f^{-1}([a,b])$; contradiction.

If closed: Since $(c,d)$ is open so is $f^{-1}([a,b])=f^{-1}((c,d))$; contradiction.

Def. for a continuous function in general topology:

Let $X$ and $Y$ be topological spaces. A function $f : X \rightarrow Y$ is continuous if $f^{-1} (Y)$ is open/closed in $X$ for every open/closed set $V$ in $Y$.

• Why do you think you have a contradiction? – Michael Albanese Jun 20 '15 at 2:48
• $f^{-1}([a,b])=[0,1]$ so it's both open and closed. – David Peterson Jun 20 '15 at 2:48
• @Michael Albanese: Because when I suppose it to be closed/open it comes to be open/closed! – L.G. Jun 20 '15 at 2:49
• @HIP13044b: A set can be both open and closed, which is the case here. In fact, for any topological space $(X, \tau)$, $X$ is always open and closed (as is $\emptyset$). – Michael Albanese Jun 20 '15 at 2:51

The image of a closed bounded interval under a continuous function is closed and bounded (follows from Bolzano intermediate value theorem, and the fact that f atteins a min and a max, in $\mathbb{R}$)! Further, in the image of any compact (ie sequentially compact) metric space is also compact. How can you have a continuous function with this property? If a function satisfies $f([0,1])=(c,d)$ then it's not continuous.
If $f:[0,1]\rightarrow [a,b]$ is a continuous function, and $f([0,1])=(c,d)\subset [a,b]$. Is $f^{-1}([a,b])$ open or closed in $[0,1]$?
Well, the problem is that you have assumed that $f$ is a function that cannot exist. In particular, if $f$ is a continuous function on $[0,1],$ then since $[0,1]$ is compact, we have that $f\bigl([0,1]\bigr)$ is also compact, so will be open only if it is empty.\$ However, the image of a non-empty set cannot be empty!