Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following function on $[0,1]$: $$ f(x) = \begin{cases} 1/m, & \text{if $x={m\over n} \in \Bbb Q$} \\ 0, & \text{if $x$ $\notin \Bbb Q$} \\ \end{cases}$$

Here, as usual, $\Bbb Q$ is the collection of all rational numbers and we assume that $m$ and $n$ have no common divisors. Prove that the function $f$ is continuous at any point $x \in [0,1]$\ $\Bbb Q$ . (any irrationals in $[0,1]$)

Please give a rigorous proof, or you can just give me a hint.

share|cite|improve this question
a more rigorous proof than ? what did you try? is it homework ? – Dominic Michaelis Mar 6 '13 at 15:44
@Thomas Im perfectly sure it is right – Dylan Zhu Mar 6 '13 at 15:47
@DominicMichaelis just forget that, it is a homework. – Dylan Zhu Mar 6 '13 at 15:48
up vote 2 down vote accepted

Hint Let $x$ be any irrational in $(0,1)$. Then for any $n >0$ there are only finitely many fractions in $(0,1)$ whose denominator is less than $n$. Thus you can find one of them, lets call it $\frac{k}{m}$ which is closest to $x$.

But then if $y$ is closer than $\frac km$ to $x$, then either $y$ is irrational, or is rational and has a denominator larger than $n$.

This is the main idea of the proof, you should be able to write it easily now with $\epsilon, \delta$...

share|cite|improve this answer

It suffices to show that if $r\in [0,1]$ is irrational and $(q_i)$ is a sequence in $[0,1]$ converging to $r$, then $\lim\limits_{i\to\infty} f(q_i)=f(r)=0$. Since $f(q_i)=0$ for any irrational $q_i$, we can ignore the irrationals and assume $q_i$ is rational for all $i$, so we write $q_i=m_i/n_i$. For each $n\in\mathbb N$, let $X_n=\{m/k\in [0,1]:0<k\leq n\}$. Note that $X_n$ is finite and that $r\notin X_n$, so we have some $\epsilon>0$ such that $|r-m/k|>\epsilon$ for all $m/k\in X_n$. Since $m_i/n_i\to r$ we have some $N\in\mathbb N$ such that $i\geq N \implies |r-m_i/n_i|<\epsilon$, thus $i\geq N\implies n_i>n$. If we choose $N$ such that $i\geq N|\implies |r-m_i/n_i|>r/2$, we get that $m_i/n_i>r/2$ and so $m_i>nr/2$, thus $f(m_i/n_i)<\frac{2}{nr}$. Letting $n\to \infty$ we see that the $f(m_i/n_i)\to 0$, as desired.

share|cite|improve this answer

Your Answer


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.