# A converse of sorts to the intermediate value theorem, with an additional property

I need to solve the following problem:

Suppose $f$ has the intermediate value property, i.e. if $f(a)<c<f(b)$, then there exists a value $d$ between $a$ and $b$ for which $f(d)=c$, and also has the additional property that $f^{-1}(a)$ is closed for every $a$ in a dense subset of $\mathbb{R}$, then $f$ is continuous.

I can see plenty of counterexamples when the second property is not added, but I can't seem to bridge the gap between adding the property and proving $f$ is continuous. I can't get there either directly or by contradiction, because the additional property doesn't seem directly relevant to the property of continuity, so could anyone please tell me how to go about doing this? Thanks!

-
I am confused by "for every $A$ in a dense subset of $\mathbb{R}$". Do you mean every dense subset $A \subset \mathbb{R}$? –  Brandon Carter Jan 7 '11 at 4:20
When I first saw this I remembered the following: preimages of closed sets are closed for continuity. Perhaps you could used this fact to prove your statement. –  PEV Jan 7 '11 at 4:22
@Brandon: Oops; sorry, I messed that up. –  Arturo Magidin Jan 7 '11 at 4:26
This is a slightly more general version of Chapter 4 # 19 in Rudin's POA –  user9352 Aug 8 '11 at 20:00
Related question: math.stackexchange.com/q/83786 –  Jonas Meyer Jun 30 '12 at 2:24

Suppose $x_n$ tends to $x$, but $f(x_n)$ does not tend to $f(x)$. Then there is a neighbourhood $(f(x)-\epsilon, f(x)+\epsilon)$ which $f(x_n)$ misses infinitely often. WLOG $f(x_n)>f(x)+\epsilon$ for infinitely many $n$. Hence $f(y)>f(x)+\epsilon$ for $y$ arbitrarily close to $x$. But then, for any $a$ in $(f(x),f(x)+\epsilon)$, the intermediate value property tells us that $f$ takes the value $a$ at points arbitrarily close to $x$. By our other assumption, at least one such $a$ has closed preimage. Contradiction.

-

As noted in the comments, this is a slightly more general version of a problem in Rudin. I assume for simplicity that the dense set is $\mathbb{Q}$.

Solution: Fix $x_0\in\mathbb{R}$, and fix a sequence $\{x_n\}$ converging to $x_0$. By the sequential characterization of continuity, it suffices to show that $f(x_n)\rightarrow f(x_0)$. Suppose not. Then an infinite number of the $f(x_n)$ are not equal to $f(x_0)$, and without loss of generality, we can assume there are infinitely many $n$ so that $f(x_n)>f(x_0)$. Passing to a subsequence, we can assume this is true for all $n$.

Because the sequence $\{f(x_n\}$ does not converge to $f(x_0)$, there exists $r\in\mathbb{Q}$ with $f(x_n)>r>f(x_0)$ for all $n$. By the intermediate value property, for every $n$, there exists $t_n$ with $f(t_n)=r$ for some $t_n$ between $x_n$ and $x_0$. By the squeeze principle, $t_n\rightarrow x_0$. But the set of all $t$ with $f(t)=r$ is closed, so because $x_0$ is a limit point, $f(x_0)=r$, a contradiction.

Source: W. Rudin, Principles of Mathematical Analysis, Chapter 4, exercise 19.

-