Does there exist a continuous function $f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ exactly two times?
im not getting the red lines as how can postive value achieved 3 times .
Can anybody elaborate in detail as im not getting in my head.
thanks u
Say that $c \in (a,b)$ is where $f$ achieves its positive maximum $f(c) = M$ on $[a,b]$. Then there is some $x\in (a,c)$ such that $f(x) = M/2$. Similarly, there is some $y\in (c,b)$ such that $f(y) = M/2$ by the intermediate value theorem.
Since $f$ is positive in $(-\infty,a)$ and negative in $(b,+\infty)$, there is some point $w\in (-\infty,a)$ such that $f(w) = 2M$ because $f$ is surjective. By the intermediate value theorem, there is a point $z \in (w,a)$ such that $f(z) = M/2$.
But then we have produced three distinct points where $f(z) = f(x) = f(y) = M/2$.