If $\{q_{n}\}$ be an ennumeration of rational numbers then how can I show that the function defined below

$f(x)=\begin{cases}0&\text{if }x\in \mathbb{R}\setminus\mathbb{Q}\\\frac{1}{2^{m}}& x\in\mathbb Q,x=q_{m}, \,m \geq1\\\end{cases}$

is continuous at all irrational numbers and discontinuous at all rationals.

I have already shown that it is discontinuous at rationals by sequential criteria for continuity. I also need to show that it is continuous at all irrationals.

I realize that this is similar to Thomae Function. But there we have a concept of order. But here the $q_{n}$'s are just an arbitrary ennumeration. Then how should one prove this?. Is what I am required to show even true?

  • $\begingroup$ You can use the same approach as here: math.stackexchange.com/a/3008948/42969 $\endgroup$
    – Martin R
    Nov 12, 2021 at 12:31
  • $\begingroup$ @MartinR Can you please tell me how I should relate the infinite sum with what I have? $\endgroup$
    – user974205
    Nov 12, 2021 at 12:34

1 Answer 1


Just use the definition of the limit. Let $x\notin\mathbb{Q}$ and $\epsilon>0$. There is some $m_0\in\mathbb{N}$ such that $\frac{1}{2^m}<\epsilon$ for all $m\geq m_0$. Now, take $\delta=\min\{|x-q_1|, |x-q_2|,...,|x-q_{m_0}|\}>0$. We'll show that if $|x-y|<\delta$ then $|f(x)-f(y)|<\epsilon$. Indeed, if $y\notin\mathbb{Q}$ then the statement is trivial, as we have $|f(x)-f(y)|=0$ in this case. If $y\in\mathbb{Q}$ then we have $y=q_m$ for some $m$. But since $|x-y|<\delta$ we must have $m>m_0$, and so:


So $f$ is indeed continuous at the point $x$.


You must log in to answer this question.