Examples of continuous functions $f:(0,1)\to[0,1]$ [closed]

Hi so the question is asking if if there is a continuous function over $(0,1)$ which will result in the image $[0,1]$. Thank you so much! Explanations are greatly appreciated!

• Is the image supposed to be $[0,1]$ as indicated in the title, or $(0,1)$ as indicated in the question? – user307169 Oct 14 '16 at 5:10
• Emm, how about $x \mapsto x$? You need to experiment just a little bit. – copper.hat Oct 14 '16 at 5:17
• Or, to answer the title question, $x \mapsto {1 \over 2} (1+\sin (2 \pi x))$? – copper.hat Oct 14 '16 at 5:19
• u the image is supposed to be [0,1] sorry! – cupcakelover1016 Oct 14 '16 at 5:28
• Have a look at this question: Continuous function from $(0,1)$ onto $[0,1]$. – Martin Sleziak Oct 14 '16 at 14:13

you may consider the function $f(x)=\frac{\cos{(100x)+1}}{2}$. Surely it is continuous and reaches its maximum and minimum several times in $(0,1)$.

Hope I helped.

• Yes it helps! Thanks! – ch271828n Oct 22 '19 at 23:46

Assuming the image desired is $[0,1]$ (including the endpoints) an example continous function on $(0,1)$ would be $$f(x) = \left\{ \begin{array}{cl} 0 & x < \frac14 \\ 2x-\frac12 & \frac14 \leq x \leq \frac34 \\ 1 & x > \frac34 \end{array}\right.$$ This function is continuous and has the desired image.

A much tougher question is whether there can be a function that is infinitely differentiable that maps this open interval onto its closure. One of the other answers shows that even this is possible.

\begin{align*} f(x)=\begin{cases} 0, & \text{ if $x<1/4$,} \\ 2(x-1/4), & \text{if $1/4 \leq x \leq 3/4$,} \\ 1, & \text{ if $x>3/4$.} \end{cases} \end{align*}

EDIT: Similar to previous answer. If you want to get creative with a similar idea...

\begin{align*} f(x)=\begin{cases} sin(2(x-1/4)\pi), & \text{if $1/4 \leq x \leq 3/4$,} \\ 0, & \text{ else.} \end{cases} \end{align*}

• If you correct your mistake in the second line (which makes the function discontinuous and the image include points slightly greater than $1$, this is the same function I used in my answer. – Mark Fischler Oct 14 '16 at 5:20
• Great minds think alike, although some less error prone. Will change to different example – Logician6 Oct 14 '16 at 5:23

HINT: Let $f$ be any bijection from $(0, 1)$ to $(-1, 2)$. This "spills over" the interval $[0, 1]$, so what you want to do is take the parts where it spills over and "fold them back." Do you see how to do this?

Assuming you mean the range to be $[0,1]$ as the title says, $f(x)=\frac{1+ sin(2 \pi x)}{2}$ has $f((0,1))=[0,1]$.

There are many examples of such functions. Take for example $f:(0,1) \to [0,1]$, $x \mapsto \sin^2(4 \pi x)$.

You cannot have a continuous bijection, however. Then you would have a continuous bijection $f^{-1}:[0,1] \to (0,1)$ but the preimage of the open $(0,1)$ is $[0,1]$, absurd.

Draw a zigzag line in the $xy$-plane as follows. Start at $(0,0);$ go in a straight line to $(\frac13,1);$ then straight to $(\frac23,0);$ then straight to $(1,1).$ This is the graph of a continuous function on $[0,1].$ (You didn't say it had to be differentiable, did you?) Erase the endpoints $(0,0$ and $(1,1)$ and it's a continuous function on $(0,1).$ What's the image?

Consider the piecewise function: \begin{cases} 2x, \qquad &\text{ for } 0 < x < \frac{1}{2}, \\ 1, &\text{ otherwise. } \end{cases}

EDIT: Oops, thought we wanted the image to be $(0, 1]$. To get the appropriate answer, consider: \begin{cases} 4x, \qquad &\text{ for } 0 < x < \frac{1}{4}, \\ 1 - 4(x - \frac{1}{4}) = 2 - 4x, &\text{ for } \frac{1}{4} < x \leq \frac{1}{2}, \\ 0, &\text{ otherwise.} \end{cases}