A function takes every function value twice - proof it is not continuous

I want to prove the following nice statement I've found:

A function $f: [0,1] \rightarrow \mathbb{R}$ takes every function value twice - proof it is not continuous

I've already found an answer to my question but one thing is still not clear to my mind. The answer I found was here on math.StackExchange posted by Arthur:

Whole post:

"Assume that you have a function $f$ that does take every real value exactly twice. Let $f(a) = f(b) = 0$ with $a < b$. Let $c \in (a,b)$ be given, and assume without loss of generality $f(c) > 0$. Then for every $0 < \epsilon < f(c)$ there exist $d \in (a,c)$ and $e \in (c,b)$ such that $f(d) = f(e) = \epsilon$. So on the intervals $[0,a)$ and $(b,1]$ our function cannot go any higher than zero. That means that $f$ should take every positive real value on the interval $[a,b]$. However the restriction of $f$ to $[a,b]$ is continuous from a closed interval to $\mathbb{R}$ and thus bounded. Contradiction."

Now everything is clear here except for:

"However the restriction of $f$ to $[a,b]$ is continuous from a closed interval to $\mathbb{R}$ and thus bounded. Contradiction."

Well I think know what Arthur is telling there: Because of the boundary there is always at least one function value that can't be taken twice by the function, e.g. just like the peak of $-x^2$.

But that is exactly where I was stuck before I started researching that issue. Is it really possible to just say it the way Arthur did? I thought that I'd have to further somehow prove the statement that boundary leads to that contradiction.

I hope that it is clear what I was trying to express here...

Anyways as always - thank you for your help!

FunkyPeanut


The statement of the problem and the other answers given are completely unrelated. If the function is from $[0,1]$ to $\mathbb{R}$, it cannot take each real value even once, since it has to be bounded (i.e. continuous functions map closed intervals to closed intervals).

However, the statement is about showing a function cannot take each value on its image (which if its continuous, is a closed interval) exactly twice. We then have to show a 2 to 1 function is not continuous. As a matter of fact, such functions have an infinite number of discontinuities, as discussed here real analysis function takes on each value twice? and here http://www.ams.org/journals/proc/1986-098-02/S0002-9939-1986-0854049-8/S0002-9939-1986-0854049-8.pdf

I reproduce an answer to that question which has an example:

Let $x_\alpha$ be a well-ordering of $[0,1]$.

For any ordinal $\alpha = \theta + n < \frak{c}$ where $\theta$ is a limit ordinal or $0$ and $n$ is a finite ordinal, let $F(\theta + n > \cdot 2) = F(\theta + n \cdot 2 + 1) = x_\alpha$.

Now define $f(x_\alpha) = F(\alpha)$ for all $\alpha \lt \frak{c}$ and it is clear that $f$ has the required property.

If we do not require the function to take each value exactly twice, then the statement is false, and there are many simple continuous functions that satisfy the conditions.


The maximum value theorem says every continuous function on a closed bounded interval assumes a maximum value. That would mean the function never goes above that value in that interval. Thus your function $f$ would never assume any values higher than $\max\{ f(x) : a\le x \le b\}$, contradicting the assumption that it assumes every such value twice.