Function with two preimages per y

529 Views Asked by At

I am searching for a function f: R -> R which has exactly two preimages for every y. I was thinking about stuff like x^2 but this function doesn’t have preimages for y<0 and furthermore, there is just one preimages for y=0.

So I came to the idea, that a function like that cannot be continuous (might be an interesting thing to prove that).

Does anyone have a nice example for a function f like that?

2

There are 2 best solutions below

0
On BEST ANSWER

As noted in the comments, this $f$ will not be continuous.

Define $f:\mathbb{R}\to\mathbb{R}$ by $f(x)=x-k$ if $2k-1<x\leq 2k+1$ for some $k\in\mathbb{Z}$.

enter image description here

This function also happens to be surjective.

0
On

Construct a bijection $f_1 : (-\infty, 0) \to \mathbb R$ and a bijection $f_2 : [0, \infty) \to \mathbb R$. Define $$f(x)=\left\{ \begin{array}{cc} f_1(x) & \mbox{ if } x < 0 \\ f_2(x)& \mbox{ if } x \geq 0 \\ \end{array} \right.$$