Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 6 down vote accepted

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

share|improve this answer
    
Beat me to it..... –  user38268 Jun 11 '12 at 7:05
    
Me too. We all think of the same counterexamples. –  Alex Becker Jun 11 '12 at 7:06
    
Except Asaf, who had to get fancy. :-) –  Brian M. Scott Jun 11 '12 at 7:08
    
@BrianM.Scott 4 upvotes in the space of 2 minutes, a record to beat :D –  user38268 Jun 11 '12 at 7:08
    
@AlexBecker Well that was kinda the obvious one to go for :D :D –  user38268 Jun 11 '12 at 7:08

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.

share|improve this answer

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$.

share|improve this answer
    
If we take $K$ to be a compact set which is nowhere dense, but has a positive measure (copies of a fat Cantor set in every $[k,k+1]$, for example) then we can get such function $f$ which is discontinuous on a set of positive measure, which is interesting. –  Asaf Karagila Jun 11 '12 at 7:33
    
Surely not in every $[k,k+1]$? That set would be unbounded. –  Johan Jun 11 '12 at 7:57
    
@Johan: True. However if we make this union disjoint we have a closed set that is still good enough for our purposes. –  Asaf Karagila Jun 11 '12 at 8:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.