# Find a function defined on $[0,1]$, valued on an interval, but is discontinuous at each point.

Find a function defined on $$[0,1]$$, valued on an interval, but is discontinuous at each point.

That is, try to find a function $$f: [0,1]\to \Bbb R$$ such that $$f([0,1])$$ is an interval, but discontinuous at each point.

Here is my try. Let $$\Bbb Q=\{r_1,r_2,\cdots\}$$ with $$r_1=0, r_2=1, \cdots$$. Then define $$f(x)=x$$ for irrational $$x$$, $$f(r_n)=r_{n+1}$$, then $$f([0,1])=(0,1]$$, and is discontinuous at rational points, but how about irrational points?

Try $$f(x) = \cases {x & if x is rational\cr x + 1/2 & if x < 1/2 and x is irrational\cr x - 1/2 & if x > 1/2 and x is irrational}$$
• What does $x>\frac12$ is irrational even mean?? Sep 20 '18 at 23:02
• I mean $x > 1/2$ and $x$ is irrational. Sep 20 '18 at 23:03