3
$\begingroup$

I know that the condition that $f(X)$ is compact if $X$ is compact should not be sufficient to say that $f$ is continuous, but I can't come up with an example of such discontinuous $f$. What is it?

Thanks

3 Answers 3

7

Let $f:\Bbb R\to\Bbb R$ be such that $f(x)=0$ if $x\le 0$ and $f(x)=1$ if $x>0$.

  • 0
    @AlexBecker Well that was kinda the obvious one to go for :D :D2012-06-11
6

You can take $f\colon\mathbb {R\to R}$ to be $f(x)=\begin{cases}0 & x\in\mathbb Q\\ 1 & x\notin\mathbb Q\end{cases}$

This function is discontinuous everywhere but its image is a finite set and therefore compact.

3

More generally, if you let $K$ be any compact subset of $\mathbb R$ with at least two points, pick some $x_0\in K$ and let $f:\mathbb R\to\mathbb R$ defined by $f(x)=\begin{cases}x & x\in K\\ x_0 & x\notin K\end{cases}$ then $f$ is a discontinuous function with image $K$.

  • 0
    @Johan: True. However if we make this union disjoint we have a closed set that is still good enough for our purposes.2012-06-11