# Investigate whether there exists a function $f : [a,b]\rightarrow R$ that is continuous and that takes exactly twice each of its values. [duplicate]

Let a < b. Investigate whether there exists a function $f : [a,b]\rightarrow R$ that is continuous and that takes exactly twice each of its values.

• The accepted solution is not helpful – Shubhodip Mondal Dec 5 '14 at 19:20
• @ShubhodipMondal There are a few more duplicates. – user147263 Dec 5 '14 at 20:31

Assume there is.

A continuous function in a closed interval reaches a maximum and a minimum.Assume the maximum is not achieved at both $a$ and $b$. Let $M$ and $M'$ be the points where it reaches the maximum. Without loss of generality assume $M'<b$. Let $m_1$ and $m_2$ be the minimums achieved by $f$ in the intervals $(M,M')$ and $(M',b)$ let $m$ be the maximum between both of them. now pick a value $y$ in $(m,f(M))$. Then that value is reached three times. Why? denote by $x$ the point where the function achieves its minimum in the interval $(M,M')$. Then by the intermediate value theorem $y$ is reached once in $(M',b)$, once in $(M,x)$ and once in $(x,M')$.

This contradicts that every value is achieved exactly twice. Therefore the maximum must be achieved in the endpoints.

Use the same argument mutatis mutandis to prove the minimum must be achieved in the endpoints.

Conclude the function is constant since the maximum and minimum is achieved at the same point. Conclude no such function exists.

No it can not happen.

Hint: Let $M = \sup f$ and $m = \inf f$. Let there be two points $x_1 < x_2$ such that $f(x_1) = f(x_2) = M$ and $y_1 < y_2$ such that $f(y_1) = f(y_2) = m$.

Case 1: $[y_1, y_2] \subset [x_1,x_2]$ (resp. $[x_1,x_2] \subset [y_1,y_2]$ ). By IVT $f$ takes all values from $[-m,M]$ once in $[x_1,y_1]$ (resp $[y_1, x_1]$ ) and then in $[y_2, x_2]$ (resp. $[x_2, y_2]$ ). So in the interval $[y_1,y_2]$ (resp. $[x_1,x_2]$) $f$ has to be constant, which is a big contradiction.

Case 2: Exactly one of $x_1, x_2$ belong to the interval $[y_1,y_2]$. In this case by IVT each $x \ne M,m$ is taken thrice by $f$.

Case 3: $[y_1,y_2]$ and $[x_1,x_2]$ are disjoint. This again can not happen. Lets say $y_1< y_2< x_1< x_2$. every $x \in [m,M]$ is assumed once by $f$ in the range $[y_2,x_1]$. Let $t = \sup_{x \in [y_1,y_2]} f(x)$. Then any $z \in [-m, t]$ is assumed at least twice in the interval $(y_1,y_2)$, which is assumed once already in $[y_2,x_1]$.

All the cases are covered and we are done.