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


  • $\begingroup$ 8 people think this question is well researched? $\endgroup$
    – Alec Teal
    Jun 12, 2015 at 21:10
  • 2
    $\begingroup$ @AlecTeal: What makes you think that? Anybody can upvote a question for whatever reason. Or, indeed, downvote it (as presumably you did for the dubious reason that it had too many upvotes). $\endgroup$
    – TonyK
    Jun 13, 2015 at 22:00

5 Answers 5


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$.

  • $\begingroup$ "$f$ attains its maximum M in [a,b] at an interior point $u$": not necessarily. It might attain its maximum at $a$ and $b$. (Not this $f$, obviously, because this $f$ can't even exist.) $\endgroup$
    – TonyK
    Jun 12, 2015 at 14:05
  • $\begingroup$ @TonyK, sure. I've edited my answer. Thanks. $\endgroup$
    – lhf
    Jun 12, 2015 at 14:07
  • $\begingroup$ The last sentence needs to be proved, even though it may seems obvious --- otherwise the original claim is just as obvious as this statement, and we can also claim it needs no proof. $\endgroup$
    – Hans
    Jun 12, 2015 at 17:31

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$.


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.

  • $\begingroup$ Think about the function x -> log(|x|) $\endgroup$
    – d--b
    Jun 12, 2015 at 12:41
  • $\begingroup$ I edited it, formatting the math. $\endgroup$ Jun 12, 2015 at 12:48
  • $\begingroup$ This is a real analysis I don't think we've defined logs at this stage. Also this is use of intermediate value theorem. $\endgroup$
    – MathNYYB
    Jun 12, 2015 at 12:48
  • $\begingroup$ @MathNYYB He uses it in the first paragraph. $\endgroup$ Jun 12, 2015 at 12:50
  • $\begingroup$ Sorry just edited again, sorry about the math formatting $\endgroup$
    – d--b
    Jun 12, 2015 at 12:51

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.

  • $\begingroup$ You're right. I misread. Clearing the comments now. $\endgroup$
    – lhf
    Jun 12, 2015 at 14:34

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}$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .