4

I know it is impossible to create a continuous $f:\mathbb{R}\to \mathbb{R}$ that takes all of its values twice. I also know it is possible to create a continuous $f:\mathbb{R}\to \mathbb{R}$ that takes all of its values three times, but can someone give me a discontinuous function $f:\mathbb{R}\to \mathbb{R}$ that takes all of its values twice? Thank you.

GuyHero
  • 51

4 Answers4

5

Take copies of the lines $f(x)= -x,\ x\in [0,1)$, and place them strategically (think of the most well-known bijection from $\mathbb{N}$ to $ \mathbb{Z}$)

Adam Rubinson
  • 20,052
0

Fix a bijection $g$ between $\mathbb{R}$ and $\{0,1\}^{\mathbb{N}}$.

Then, given any $x \in \mathbb{R}$, define $f(x)$ to be $g^{-1}(s)$, where $s$ is the sequence $g(x)$ shifted to the left by one spot.

One can then easily verify that this $f$ satisfies the required condition.

0

The graph of my function is just a bunch of parallel half-closed line segments of length $\sqrt{5}.$ I first define the function $\varphi$ on $[0,1)$ by $$\varphi(t)=2t \ \text{ when }\ 0\le t \lt {1\over 2}$$ $$\varphi(t)=2t-1 \ \text{ when }\ {1\over 2}\le t \lt 1$$ For all integers $n,$ $$f(x)=n+\varphi(x-n) \ \text{when} \ n\le x\lt n+1.$$

David
  • 1
0

Define $f(0) = 0$ and $f(x) = log(|x|)$ otherwise. Now, for every $y \neq 0, y \in \mathbb{R}$ there are exactly two values of $x$ such $f(x)=y$. The problem remains is when $y=0$ there are three values of $x$ ($x$=-1,0,1) such that $f(x)=0$.

We modify $f(x)$ as following: Let $f^{-1}$ be the inverse function of $f$ for positive $x$. Define $$g(1)=1$$ $$g(f^{-1}(1)) = 2$$ $$g(f^{-1}(2)) = 3$$ $$ ... $$ $$g(f^{-1}(n)) = n+1$$ $$ ... $$ and for the other values of $x$ let $g(x)=f(x)$. Then $g(x)$ is the function desired.

To verify this: if $y_n$ is a positive integer, there is exactly one $x_n \in (1,\infty)$ such that $g(x_n)=y_n$. Namely, $x_n=exp(y_{n-1})\,$. Since $e^y$ is monotonic this $x_n$ is unique. On the other hand, if $y>0$ is not a positive integer, then the interval $x \in (f^{-1}(\lfloor y \rfloor), f^{-1}(\lceil y \rceil))$ is not modified and hence there is one unique $x$ such that $g(x)=f(x)=y$.

WHLin
  • 224