continuous function problem let f be a continuous function on $[a,b]$. If f assumes every of it´s values no more than 2 times, then there is at least one value that f assumes just one time. How can I prove it?please I need help
 A: Hint: If $f$ achieves a maximum in $(a,b)$, then any value sufficiently close to that maximum is achieved twice in a small neighborhood of where the maximum is achieved.

Added: to flesh this out a little bit, the observation above suffices to show that $f$ can only achieve an extremum twice if that extremum is achieved at both endpoints $a,b$. But then the other extremum is achieved exactly once.
A: Because $f$ is continuous on $[a, b]$, we know that $f$ reaches a maximum at some point $y_1 \in [a, b]$. Now, we suppose that $f$ reaches this maximum two times, and show that this leads to a contradiction, so $f$ can only reach it's maximum value once.
Going off our assumption that $f$ reaches it's maximum twice, for some $y_2 \in [a, b]$, where $y_2 > y_1$, $f(y_2) = f(y_1)$. Since $f$ is also continuous on $[y_1, y_2],$ it has a minimum value $c$ on this interval. Also, $c \in (y_1, y_2)$, because if this were false then $c$ is either $y_1$ or $y_2$, and then $f$ has a maximum that is the same as its minimum, meaning $f$ is constant on the interval, contradicting the fact that $f$ only takes on each value at most two times.
So we know there is a $c \in (y_1, y_2)$. Pick any $x$ such that $f(c) < f(x) < f(y_1)$. Then, by the IVT, there are points $x_1, x_2,$ and $x_3$ in the intervals $(a, y_1)$, $(y_1, c)$, and $(c, y_2)$, respectively such that $f(x_1) = f(x_2) = f(x_3) = f(x)$, a contradiction. We conclude that $f$ can only take on its maximum value once.
A: If f assumes every of it´s values no more than 2 times, either f is monotonous, or it has a single turning point (either a maximum or a minimum).  f reaches the turning point only once, so that value is assumed only once.
