# Can a function be continuous at only one point in its domain and discontinuous everywhere else [duplicate]

Can you please explain if this is possible or not? Does there exist a function that is continuous at only one point in its domain?

## marked as duplicate by user61527, ncmathsadist, leo, hardmath, user17762 Nov 30 '13 at 4:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• What are your ideas? what have you tried? use the definition of continuity at a point, it will lead you to the answer – Kevin Nov 29 '13 at 19:44
• @mepinon : As you can see, this is possible and easy to do. Your question is certainly a duplicate: I have seen extremely similar questions here before. The answers to the old versions may have more interesting information. I don't feel like tracking down the duplicates right now. – Stefan Smith Nov 29 '13 at 22:59

## 3 Answers

Consider $$f(x)=\begin{cases} x &\text{if x is rational}\\ 0 &\text{otherwise} \end{cases}$$

Yes. Just take a bounded function $f : \mathbb R \to \mathbb R$, which is everywhere discontinuous. Then consider $g(x) = f(x) \cdot x$.

Or, take a function whose domain has exactly one point ;)

• +1; note that Alex and Brian's answers are special cases of this one, with $f(x) = 1$ if $x \in \mathbb Q$ and $0$ otherwise. – Ilmari Karonen Nov 29 '13 at 21:31
• @MaciejPiechotka: If you have a metric (or topological) space consisting only of one point, then the only converging (even the only existing) sequence is the constant sequence. Hence, the continuity condition is trivially satisfied and every function having this space as domain is continuous. – gerw Nov 29 '13 at 21:33
• @gerw - you're right (note to myself - Friday night is not the best time to comment on math.se). I've deleted the comment. – Maciej Piechotka Nov 29 '13 at 21:35

Yes. A standard example is

$$f:\Bbb R\to\Bbb R:x\mapsto\begin{cases} x,&\text{if }x\in\Bbb Q\\ 0,&\text{if }x\in\Bbb R\setminus\Bbb Q\;, \end{cases}$$

which is continuous only at $x=0$.