# Cases when the Intermediate Value Theorem is true - Part 2

I previously asked this question and was told that an answer is certainly possible but I am still looking for an example.

The question was for cases when the intermediate value theorem is true and a continuous function takes all values between f(a) and f(b) at least ones, is there ever a case when a particular value is attained infinitely many times? I know the trivial cases like f(x)=5 but something non-trivial, where $f(a)\neq f(b)$. I think the conclusion was that uncountably many times isn't possible but countably infinitely many times is certainly possible. Thanks!

-
You never did explain exactly which cases you consider to be trivial. – Chris Eagle Nov 2 '12 at 10:24
Well the trivial cases were where f(a)=f(b)=f(x)=a constant so that's why I had the requirement $f(a)\neq f(b)$. – Fixed Point Nov 3 '12 at 7:27

Let $f(x)=x\sin\frac1x$ on the interval $[0,1]$: clearly $\{x\in[0,1]:f(x)=0\}$ is countably infinite. If you like, you can extend $f$ to $[-1,1$ by defining $f(x)=x$ for $x\in[-1,0]$, so that $0$ is a value intermediate between the values at the endpoints of the interval.

Added: For a more exotic example, let $C$ be the middle-thirds Cantor set. $[0,1]\setminus C$ is the union of countably infinitely many pairwise disjoint open intervals $(a_k,b_k)$ whose endpoints are in $C$. For $k\in\Bbb N$ let $c_k=\frac12(a_k+b_k)$, the midpoint of the interval $(a_k,b_k)$. Define $f:[-1,2]\to[-1,2]$ as follows:

\begin{align*} f(x)=\begin{cases} x,&\text{if }-1\le x\le 0\\ 0,&\text{if }x\in C\\ 2x-2,&\text{if }1\le x\le 2\\ x-a_k,&\text{if }a_k\le x\le c_k\\ b_k-x,&\text{if }c_k\le x\le b_k\;. \end{cases} \end{align*}

Then $f$ is continuous, $f(x)=0$ iff $x\in C$, and $|C|=2^\omega=\mathfrak c$ is uncountable.

-
Wow totally kickass answer. Thanks. – Fixed Point Nov 3 '12 at 8:05
@PrinceAli: You’re welcome. – Brian M. Scott Nov 3 '12 at 14:44

For a simpler example, define $f$ on $[0,1]$ by $$f(x)=\begin{cases} x-1/3 & x<1/3 \\ 0 & 1/3 \le x \le 2/3 \\ x-2/3 & x>2/3\end{cases}$$ Then $f$ is continuous, $-1/3=f(0) \neq f(1)=1/3$ but $f$ takes the value $0$ uncountably many times.

-