# 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. – angryavian 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 :) – Guerlando OCs 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. – Paramanand Singh 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. – Mikhail Katz 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. – Paramanand Singh 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. – Mikhail Katz 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). – Paramanand Singh 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