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?
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}$.
This function also happens to be surjective.