Difficult Intermediate Value Theorem Problem- two roots I have been stuck on this Real Analysis problem for hours and am just totally clueless- I am sure it is some application of the Intermediate Value Theorem-
suppose $\ f: \mathbb{R}\rightarrow\mathbb{R} $ is continuous at every point. Prove that the equation
$ \ f(x) = c $ cannot have exactly two solutions for every value of $\ c. $
Would appreciate some help
Thanks 
 A: If every value of $f$ occurs exactly once, there is nothing to prove.
Otherwise, let $c$ be such that $f(a)=f(b)=c$ for $a<b$.
If $f$ is constant in $[a,b]$, then we are done, because $c$ is attained at least 3 times.
Otherwise, $f$ attains its maximum $M$ at an interior point $u$ in $[a,b]$. The value $M$ is then a local maximum. (This fails if $M=c$, but in this case take the minimum instead.)
If $f$ does not attain the value $M$ at another point in $\mathbb R$, then we are done.
Otherwise, let $v\ne u$ be such that $f(v)=M$ ($v$ is not necessarily in $[a,b]$).
For small enough $\epsilon>0$, the value $M-\varepsilon$ is then attained at least 3 times: twice near $u$ and at least once near $v$.
A: Let $c$ be any value, and let $x < x'$ be the two values satisfying $f(x) = f(x') = c$. Now the midpoint $y = .5(x + x')$ satisfies either $f(y) > c$ or $f(y) < c$.  Let us assume the first case, the other case being handled similarly. Let $d := f(y) > c$.
Note that every output value $\alpha$ in the range $(c, d)$ is attained by $f$ in the interval $(x, y)$, and again in the interval $(y, x')$; this holds by two applications of the Intermediate Value Theorem.
So all such output values $\alpha$ are attained twice by $f$ in the interval $I := [x, x']$ and, by our original assumption on $f$, they can be attained nowhere outside of that interval. By another application of IVT, this means that $f \leq c$ outside of $I$.  
But by a result proved in first-year analysis, the continuous function $f$ must be bounded on the interval $I$, since that interval is closed.  Combining this with the above, we find that there is some $C$ such that $f(z) \leq C$ for all inputs $z \in \mathbb{R}$. Then $f^{-1}(C + 1) = \emptyset$.  But this is a contradiction to our initial hypothesis about $f$.
A: Let $c_1$ such that, $f(x_1)=f(x_2)=c_1$. Take $y_1 = \frac{x_1+x_2}{2}$, and $c_2 = \frac{f(y_1) + c_1}{2}$. Then using the intermediate theorem, you can find $x_3$ and $x_4$ such that $f(x_3)=f(x_4)=c_2$, with $x_3$ strictly between $x_1$ and $y_1$ and $x_4$ strictly between $y_1$ and $x_2$.
That way you create a sequence of $x_n$, $x_{n+1}$ that become closer and closer to one another.
Then if the sequence of $f(x_n)$ converges, then it is bounded (Bolzano Weierstrass), then there is one $c$ that is smaller than the boundary that contradicts $f(x)=c$ has one solution for every $c$.
If the sequence of $f(x_n)$ does not converge, then it goes to infinity which contradicts the continuity of the function.
A: Suppose to the contrary that a continuous function $f$ does attain every value exactly twice.
The function $f$ has exactly two zeros. Say they are located at $a$ and $b$, with $a < b$. 
Since $f$ is continuous on $[a,b]$ and not identically zero it must attain a nonzero value. Assume without loss of generality that $f$ attains a positive value on $[a,b]$. Then $f$ must attain a maximum positive value on $[a,b]$ at some point $c \in (a,b)$.
Since $f$ attains every real value exactly twice there is a point $d \in \mathbb R$ with $f(d) = 2 f(c)$. By the way $c$ was selected we must have $d \notin [a,b]$.
The points $a,b,c,d$ are arranged in one of the orders $$d < a < c < b \quad \text{or} \quad a < c < b < d$$ and in these cases the corresponding function values are $$2f(c), 0, f(c), 0 \quad \text{or} \quad 0, f(c), 0, 2f(c).$$
The intermediate value theorem tells you that the function $f$ must attain the value $\dfrac{f(c)}{2}$ at least three times, contrary to hypothesis. Thus no such function exists.
A: Suppose $f$ is continuous on $\mathbb{R}$ and takes on every value in its codomain exactly twice. Also suppose $f(a)=f(b)$ where $a<x<y<b$. By IVT
$$f(x)<f(a)<f(y)\Rightarrow\exists c\in(x,y):f(c)=f(a)\\
f(y)<f(a)<f(x)\Rightarrow\exists c\in(x,y):f(c)=f(a)$$ 
So in both cases $f(z)=f(a)$ has at least $3$ solutions for $z$ namely $a,b,c$. As $x,y$ were arbitrarily chosen in $(a,b)$ so $f$ must satisfy exactly one of the following choices 
$$f(x)<f(a)\forall x\in(a,b)\\f(x)>f(a)\forall x\in(a,b)$$
In case of the first choice pick any $t<a,r>b$ and $x\in(a,b)$. By IVT 
$$f(t)<f(x)<f(a)\Rightarrow\exists c\in(t,a):f(c)=f(x)\\
f(r)<f(x)<f(a)=f(b)\Rightarrow\exists k\in(b,r):f(k)=f(x)$$
So if we can find $t<a,r>b:f(t),f(r)<f(x)$, $f(z)=f(x)$ has at least $3$ solutions. So $f$ satisfies only one of the following choices:
$$f(t)<f(x)<f(r)\;\forall\;t<a,r>b\\
f(x)<f(t),f(r)\;\forall\;t<a,r>b\\
f(x)=f(t_1)\text{ where }t_1<a\text{ and }f(x)<f(t),f(r)\;\forall\;t_1\neq t<a,r>b\\
f(x)=f(r_1)\text{ where }r_1>b\text{ and }f(x)<f(t),f(r)\;\forall\;t<a,r_1\neq r>b$$
The first choice gives us
$$\lim_{t\to a-}f(t)\le f(x)\le \lim_{r\to b+}f(r)\\
\Rightarrow f(a)\le f(x)\le f(b)=f(a)\Rightarrow f(x)=f(a)$$
Which contradicts $f(x)<f(a)$. 
For the $2$nd choice, $f$ must admit its global minimum in $(a,b)$. Let $m=f(c)$ be this minimum. There must be $c\neq c'\in(a,b):f(c')=m$ as $f$ admits $m$ twice. WLOG assume $c<c'$.
$$f(a)>f\left({c+c'\over2}\right)>f(c)\Rightarrow\exists d\in(a,c):f(d)=f\left({c+c'\over2}\right)\\
f(a)=f(b)>f\left({c+c'\over2}\right)>f(c')=f(c)\Rightarrow\exists d'\in(c',b):f(d')=f\left({c+c'\over2}\right)\\$$
So $f(z)=f\left({c+c'\over2}\right)$ has at least $3$ solutions namely $d,{c+c'\over2},d'$. For the $3$rd choice we have at least $3$ solutions for $f(z)={f(t_1)+f(a)\over 2}={f(x)+f(a)\over 2}={f(x)+f(b)\over 2}$ one inside $(t_1,a)$,one inside $(a,x)$ and one inside $(x,b)$. Similarly choice $4$ would give rise to at least $3$ solutions for ${f(x)+f(a)\over 2}$. 
