# Continuous function which maps (0,1] to {0}, (0,1), [0,1), [0,1] [duplicate]

Let $f: \mathbb R \to \mathbb R$ be a continuous function. Which one of the following sets cannot be the image of $(0,1]$ under $f$?

• $\{0\}$
• $(0,1)$
• $[0,1)$
• $[0,1]$.

We know that $(0,1]$ is neither open nor closed, since $f$ is continuous, "every inverse mapping of closed set is closed" by the result above, $\{0\}, (0,1), [0,1]$ are sets that cannot be image of $(0,1]$. Am I right?

My argument: Inverse exists only when function is one one and onto, so will there be continuous function such that inverse never exists but the image of $(0,1]$ be one of the above three sets?

## marked as duplicate by Namaste, TheSimpliFire, Y. Forman, Sahiba Arora, muaddibJan 31 '18 at 18:12

All except the second are possible.

$f(x) = 0$. $f((0,1]) = \{0\}$.

$f(x) = 1-x$. $f((0,1]) = [0,1)$.

$f(x) = {1 \over 2} (1+ \sin (2 \pi x))$. $f((0,1]) = [0,1]$.

To see why $(0,1)$ cannot be the image, suppose $f((0,1]) = (0,1)$. Since $[0,1]$ is compact, then $f([0,1])$ must be compact. However, since $f([0,1]) = (0,1) \cup \{f(0)\}$, which is not compact, we have a contradiction.

Note: As Martin has pointed out in the comments below, there are continuous $f:(0,1] \to (0,1)$, but as the paragraph above shows, they cannot be extended to $\mathbb{R}$.

• In fact there is such a continuous function. An example is given here: Continuous function from (0, 1] onto (0, 1)? – Martin Sleziak Jun 4 '15 at 9:02
• @MartinSleziak: The function in the question must be continuous on $\mathbb{R}$, the example given above cannot be extended continuously to $\mathbb{R}^n$. – copper.hat Jun 4 '15 at 15:02
• You're right, I did not read the question carefully and expected continuity on $(0,1]$. – Martin Sleziak Jun 4 '15 at 15:03