# Show that there's no continuous function that takes each of its values $f(x)$ exactly twice.

I need to prove the following:

There's no continuous function $f:[a,b]\to \mathbb{R}$ that takes each of its values $f(x)$, $x\in [a,b]$ exactly twice.

First of all, I didn't understand the question. For example $x^2$ takes $1$ twice, in the interval $[-1,1]$. Is it saying that it does not occur for all $x$ in the interval? But what about $f(x) = c$? Is it saying that it does not occur only exactly $2$ times, then? I have no idea about how to prove it. I know that for $f(x)$ such that $f(a)<f(x)<f(b)$, if $f$ is continuous then there is a $c\in [a,b]$ such that $f(c) = f(x)$.

Now, there's the following proof in my book and I really wanted to understand it, instead of just getting a new proof

Since the interval $[a,b]$ has only $2$ extreme points, then the maximum or minimum of $f$ must be in a point $c\in int([a,b])$ and and in another point $d\in [a,b]$. Then, there exists $\delta>0$ such that in the intervals $[c-\delta, c), (c,c+\delta)$ (and if $d$ is not extreme of $[a,b]$, $[d-\delta, d]$) the function takes values that are less than $f(c) = f(d)$. Let $A$ be the greatest of the numbers $f(c-\delta), f(c+\delta), f(d-\delta)$. By the intermediate value theorem, there are $x\in [c-\delta, c), y\in (c, c+\delta]$ and $z\in [d-\delta, d)$ such that $f(x)=f(y)=f(z)=A$. Contradiction.

Well, why the last part? Why is it that I can apply the intermediate value theorem to these values? For example, $<f(c-\delta)<p<f(c)$, then by the theorem I know that there exists $m\in [c-\delta, c)$ such that $f(m) = p$. Same for the other intervals. But what guarantees thhat the greatest of the values between $x\in [c-\delta, c), y\in (c, c+\delta]$ will be inside the intervals $[c-\delta), c), (c,c+\delta), [d-\delta, d)$?

• By "taking each of its values exactly twice" it means "for each $y$ in the range of $f$, the function $f$ takes the value $y$ exactly twice." The example $f(x)=x^2$ on $[-1,1]$ does not work, since it takes the value $0$ once. The example $f(x)=c$ does not work either, since it takes the value $c$ more than twice. Jul 4 '16 at 0:03

Earlier I had linked my question with this one of yours and it was closed as a duplicate. But you are not so much interested in knowing a proof of the result, but rather you are interested in understanding the proof given in your textbook. The following answer is thus an explanation for the proof given in your textbook.

The solution given in your textbook is very concise and does not give all the details. Since $f$ is continuous on $[a, b]$ its range is also a closed interval $[m, M]$. The solution assumes that $m < M$ otherwise $f$ is a constant and does not meet hypotheses of the question.

Next it says that the value $M$ is taken at two distinct points $c, d$ and says that one of them say $c \in (a, b)$ and $d \in [a, b]$. It is however possible that both $c, d$ are endpoints of $[a, b]$. This is not mentioned or considered in the solution. Anyway proceeding with the textbook solution let $c \in (a, b), d \in [a, b]$ and $f(c) = f(d) = M$. Moreover $f(x) < M$ for all $x \in [a, b], x \neq c, x\neq d$.

Next the solution proposes the existence of $\delta > 0$ such that $f(x) < M$ for all $x \in [c - \delta, c) \cup (c, c + \delta)$. Further if $d \neq a$ then we also have $f(x) < M$ for all $x \in [d - \delta, d)$ (there is a typo in the solution where it writes $[d - \delta, d]$ instead of $[d - \delta, d)$). All these statements are true by the last sentence of previous paragraph. And note that the solution does not handle the case $d = a$. Now it considers $$A = \max(f(c - \delta), f(c + \delta), f(d - \delta))$$ BTW out of these values $f(c - \delta), f(c + \delta), f(d - \delta)$ at max two can be equal. If $B$ is the minimum of these values then $B < A < M$ and thus by intermediate value theorem $A$ is attained once in each of the three intervals $[c - \delta, c], [c, c + \delta]$ and $[d - \delta, d]$ and thus $f$ takes the value $A$ at three distinct points $x, y, z$. That these three points are distinct follows from the fact that $\delta$ can be chosen so that $(c - \delta), (c, c + \delta)$ and $(d - \delta, d)$ are pairwise disjoint. This is contrary to the hypotheses in the question. This completes the proof.

The solution needs to address the two cases which are left out:

• The case when $c, d$ are both the end points of $[a, b]$.
• The case when $d = a$ and $c \in (a, b)$. Here we consider $[d, d + \delta]$ and argue like your textbook solution.

For the first case when $c, d$ are endpoints so that for example $c = a, d = b$, we necessarily need to consider the points $p, q \in (a, b), p < q$ where $f$ takes minimum value $m$. Thus we have $f(p) = f(q) = m < M = f(a) = f(b)$. Note further that all the values of $f$ in $(p, q)$ are greater than $m$ and hence if $M'$ is maximum value of $f$ in $[p, q]$ then $m < M' < M$. And suppose $M'$ is attained at $r \in (p, q)$. Let $K$ be any number such that $m < K < M' < M$. Then by intermediate value theorem $f$ takes the value $K$ once in each of the intervals $(a, p), (p, r), (r, q), (q, b)$ and this contradicts the hypotheses.

• thanks, you're gonna get a bounty for that :) Jul 6 '16 at 21:00

Suppose $f:[0,1]\to\mathbb{R}$ takes each of its values exactly twice. Consider the self-map FLIP of the interval $[0,1]$ switching the two points where the values of the function are equal. This FLIP a continuous map without fixed points. But any self-map of the closed interval must have a fixed point by (the trivial one-dimensional case of) Brouwer's fixed point theorem. This proves that there is no such function $f$.

• Nice idea! Can you just elaborate how this self map is continuous? Perhaps it was not too obvious for me to figure out instantly. Jul 6 '16 at 15:11
• If it were not continuous at $c$, then for a sequence $u_n$ converging to $c$ the sequence FLIP$(u_n)$ will not converge to FLIP$(c)$. By choosing a subsequence if necessary we can assume it converges to a point $d$ different from FLIP$(c)$. But then by continuity of $f$, the value of $f$ at $p$ will be the same as its value at $c$. That gives three points with the same value instead of two. Jul 6 '16 at 15:26
• I got it. Your answer makes perfect sense and avoids handling of many cases and the use of ivt based on these cases. +1 for the excellent proof. Jul 6 '16 at 16:49
• @ParamanandSingh, there is one item that needs to be clarified here, namely why the new limit point you get is not the original point c. Anyway since the OP accepted another answer I will not pursue this further. Jul 7 '16 at 8:15
• Yes you are right. However if both $u_{n}$ and its flip $u_{n}' = \mathrm{FLIP}(u_{n})$ tend to $c$ then there is an obvious problem. Note that there are points near $c$ as well as near $d$ where the value of $f$ is close to $f(c) = K$. Hence it is possible to choose a value of $f$ say $L$ near $K$ and $n$ such that $L = f(u_{n}) = f(u_{n}')$ and also $L = f(d')$ for some $d'$ near $d$. A formal argument will require IVT I guess (at least I was not able to avoid IVT). Jul 7 '16 at 12:25

Hint: you don't need to use continuity, only the Darboux (intermediate value) property. Look at the minimum and maximum value of $f$ in the interval.

Notice that they have to be distinct (otherwise it is clearly false), and then consider the relative placement of the four points where the extreme values are attained, and using the Darboux property argue that in each cases, some values will be attained at least three times.

• There are other configurations: there can be a local minimum between the two maxima and the two minima could be outside. Granted, this implies more duplicate values, but it should be handled.
– robjohn
Jul 4 '16 at 2:02

Given such a function, $$[a,b]$$ is partitioned into uncountably many pairs $$\{x_1,x_2\}$$ with $$f(x_1)=f(x_2)$$. Can two pairs $$\{x_1,x_2\}$$ and $$\{x_3,x_4\}$$ overlap? In such a acase we would have wlog $$x_1. Pick $$c$$ between $$f(x_1)$$ and $$f(x_2)$$. By the Intermediate value property, there exists $$\xi\in(x_1,x_3)$$ with $$f(\xi)=c$$. But such $$\xi$$ also exists in $$(x_3,x_2)$$ and in $$(x_2,x_4)$$, contradicting the special property of $$f$$. We conclude that two distinct pairs $$\{x_1,x_2\}$$ and $$\{x_3,x_4\}$$ can only be nested. Then the intersection of the nested closed intervals with these pairs as endpoints is non-empty and contains a point $$\bar x_1$$ that cannot occur in a pair $$\{\bar x_1,\bar x_2\}$$.

• I just realised that I may have downvoted this by accident. My apologies but it seems that I cannot correct my mistake unless you edit it. Aug 1 '20 at 12:49

I think the following way may be simpler.

Translation of the function doesnot change the generality. So assume that by translating f(x) we make it crosses the $$x$$ axis. Let denote it by $$\tilde f$$

By the hypothesis, $$\exists x_1,x_2\in \mathbb R$$ such that $$\tilde f(x_1)=0=\tilde f(x_2)$$ with $$x_1. Moreover there is no another point $$x\in\mathbb R$$ that $$\tilde f(x)=0$$.

So either $$\tilde f\le 0$$ or $$\tilde f\ge 0$$ on $$[x_1,x_2]$$ by extreme value theorem $$\tilde f$$ takes one of its extreme values at interior of $$[x_1,x_2]$$, according to its sign. And it is unique so we get contradiction.

Why is one of the extremas on $$[x_1,x_2]$$ unique?

i) Inductive geometrically: If we were to draw horizontal lines from $$x$$ axis since the hyphothesis states graph should intersect with these lines exactly twice, until to maxima or minima, there may be no problem but at these extremas the horizontal line can only intersects once. (This explanation is only intuitional, see the figure below)

ii) More formally (we emphasize the idea in formal way to elaborate the idea), WLOG assume $$\tilde f\ge 0$$ and we have minimum at boundaries, denote first maximum $$c_1$$. Assume we have another maximum at $$x=c_2$$. Since $$\tilde f$$ is continuous at $$c_1,c_2$$ there exist two closed neighborhood $$\delta_1,\delta_2$$, now consider $$\delta=min\{\delta_1,\delta_2\}$$. Observe $$\tilde f(\delta_{c_1})=[c^{*}_1, \tilde f(c_1)=M]$$ and $$\tilde f(\delta_{c_2})=[c^{*}_2,\tilde f(c_2)=M]$$

So in the $$y$$ axis closed interval $$[min\{c^{*}_1,c^{*}_2\},M]$$ every point corresponds to $$4$$ different value in $$x$$ axis.

Edit: About geometric interpretation of uniqueness of one of the extremas. • Why is the extreme value unique? It may be taken at two points in the interval or one point may lie outside the interval. Dec 25 '20 at 2:13
• First of all we only consider $[x_1,x_2]$ We have two cases : If $\tilde f\ge 0$ then minimum is $0$ and maximum occurs at interior and unique. If $\tilde f \le 0$ then maximum is $0$ and minimum is unique. They are unique because if as you have written there were two of these points there would be 2 turning points and between these two max/min there would be local min/max and in the interval $[x_1,x_2]$ there would be 4 points sets takes the same value. Dec 25 '20 at 8:05