Prove that the function $f$ is continuous only at the irrational points.

$f(x)=\begin{cases} 0 & ;x \in \mathbb R-\mathbb Q \\ \dfrac{1}{n} & ;x=\dfrac {m}{n} :\gcd(m,n)=1;m,n \in \mathbb Z \\ 1 & ;x=0 \end{cases}$

Attempt: Let us suppose $a \in [0,1]$ such that $f$ is continuous in $[0,1]$ Then :

$\forall \epsilon >0, \exists \delta >0 $ such that $|g(x)-g(a)|< \epsilon$ whenever $|x-a|< \delta$

Case $1$ :Suppose $a$ is a rational element in the interval $[0,1]$

Then if $a=\dfrac {p}{q} \implies g(a) = \dfrac {1}{q}$. Hence :

$|g(x)-\dfrac {1}{q} |< \epsilon~~~........(1)$.

$(a)$ Now, if $x$ is a rational element, then $(1)$ reduces to $\dfrac {1}{q} < \epsilon$ which is not true always.

Hence, there is no continuity for any rational point $a$

Case $2$ :Suppose $a$ is an irrational element in the interval $[0,1]$

$\forall \epsilon >0, \exists \delta >0 $ such that $|g(x)-g(a)|< \epsilon$ whenever $|x-a|< \delta$

Hence, $|g(x)-0|< \epsilon ~~~...........(2)$

$(a)$ Now, if $x= \dfrac {r}{s}$ is a rational element: $g(x) =\dfrac {1}{s}$

There always exist an integer $s$ such that $(2)$ holds

But, how do we find the value of $\delta$?

$(b)$ If $x$ is an irrational element, then $|g(x)|=0< \epsilon$

Which is always true for any $\delta$.

Did I attempt this problem correctly?

Thank you for your help.


2 Answers 2


Firstly, $f$ can't be continuous at any rational point. Because if $x =\frac{m}{n}$ with $(m,n) = 1$, then $f(x) = \frac{1}{n}$. But we can always find an irrational sequence $x_n \to x$ and $f(x_n) = 0$ doesn't converge to $\frac{1}{n}$.

Secondly, $f$ is continuous at irrational points.

Take any $y$ irrational so $f(y) = 0$. For any $\epsilon >0$, we know the number of intgers $n$ such that $\frac{1}{n} > \epsilon$ is finite. For each fixed such $n$, the number of $m$ such that $\frac{m}{n}$ is in the interval $[y-1, y+1]$ is finite. Thus the number of rational numbers $\frac{m}{n}$ in the interval $[y-1, y+1]$ with $\frac{1}{n} > \epsilon$ is finite. Define $d$ as the smallest distance of these $\frac{m}{n}$ with $y$. Then for any $z$ with $|y-z|<d$ we have $|f(z)-f(y)|<\epsilon$

  • $\begingroup$ Thank you for your answer. I have edited my question. I meant $f$ to be continuous at only the irrational points only $\endgroup$
    – MathMan
    Oct 6, 2014 at 15:31
  • 1
    $\begingroup$ @VHP Yeah I see your edition. In fact $f$ is continuous not only at irrational points in $[0,1]$, but at all the irrational points in $\mathbb{R}$ $\endgroup$ Oct 6, 2014 at 15:34
  • $\begingroup$ @Liy: What happens if we use a point outside $|y-z|<d$? $\endgroup$
    – MathMan
    Oct 6, 2014 at 16:17
  • $\begingroup$ @VHP It may be one of the $\frac{m}{n}$ with $\frac{1}{n}> \epsilon$ $\endgroup$ Oct 6, 2014 at 16:19
  • $\begingroup$ I have a little trouble understanding this. Could you please give me an example? $\endgroup$
    – MathMan
    Oct 6, 2014 at 16:24

Yes you have proceeded in a right way. Observe for any $\epsilon>0$ $\exists n\in \Bbb N$ s.t $\frac1n<\epsilon$ & for any $a\in \Bbb R\setminus \Bbb Q$ we can choose $\frac pq \in \Bbb Q$ s.t $\frac 1q<\frac1n<\epsilon$

  • $\begingroup$ Thank you for your answer :-) $\endgroup$
    – MathMan
    Oct 6, 2014 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .