We know that there exist real functions which are continuous at each irrational and dis- continuous at each rational number.

But does there exist a function $f: \mathbb{R} \to \mathbb{R}$ that is differentiable at every irrational and discontinuous at every rational?

  • 1
    $\begingroup$ In case anyone isn't familiar with the functions mentioned in the first sentence $\endgroup$
    – Casebash
    Aug 11, 2010 at 7:48
  • $\begingroup$ @Casebash: Here is one. Define $f$ in the following manner. $f(p/q)=\frac{1}{q}$, if $p/q$ is in its lowest terms with $q>0$ and $f(x)=0$ for $x \in \mathbb{R}\setminus \mathbb{Q}$. You can see this in "Methods of Real Analysis" book by R.R.Goldberg $\endgroup$
    – anonymous
    Aug 11, 2010 at 8:14
  • 6
    $\begingroup$ The title could be more specific: at least the word "differentiable" should be in there somewhere. $\endgroup$ Aug 11, 2010 at 14:43
  • $\begingroup$ Hi- Can i interchange the question and post it. New question would be does there exists functions $f:\mathbb{R} \to \mathbb{R}$ which is differentiable at each rational and discontinuous at every irrational $\endgroup$
    – anonymous
    Aug 12, 2010 at 12:47
  • 2
    $\begingroup$ There are no functions continuous on precisely the rationals, since the irrationals are not an $F_\sigma$ set. $\endgroup$
    – user641
    Aug 12, 2010 at 21:56

2 Answers 2


I think that there can be no such function.

Suppose that $f$ is discontinuous at some point $q$. There must be constants $A,B$ so that $f(s) < A < B < f(t)$ holds for points $s,t$ arbitrarily near to $q$.

Suppose that $x_0<q$ satisfies $q-x_0 < B-A$. Choose sequences $s_n, t_n > x_0$ converging to $q$ and satisfying $f(s_n) < A < B < f(t_n)$. Then we have

$$\frac{f(t_n) - f(x_0)}{t_n - x_0} - \frac{f(s_n) - f(x_0)}{s_n - x_0} > \frac{B - f(x_0)}{t_n - x_0} - \frac{A - f(x_0)}{s_n - x_0} \to \frac{B-A}{q - x_0} > 1$$

and may conclude that there exist $s,t$ as close to $q$ as we like satisfying

$$\frac{f(t) - f(x_0)}{t - x_0} - \frac{f(s) - f(x_0)}{s - x_0} > 1$$

Arguing similarly when $x_0 > q$ and trivially (since the Newton quotients will be unbounded as a result of the discontinuity) when $x_0 = q$ we get the same conclusion with only $|x_0 - q| < B-A$.

For $n$ a positive integer let $X_n$ denote all of the points $x_0$ in $\mathbf{R}$ for which there exist $s,t$ at distance less than $1/n$ from $x_0$ satisfying the preceding inequality. Our argument implies that, for every $n$, $X_n$ is a neighbourhood of every point $q$ at which $f$ is discontinuous (consider the points $x_0$ whose distance from $q$ is less than $1/n$ and $B-A = B_q - A_q$). If it happens that the points of discontinuity are dense (as in the case of $\mathbf{Q}$) then this implies that every $X_n$ contains an open dense set and thus $\bigcap_n X_n$ is second category in $\mathbf{R}$.

The point is of course that no point at which $f$ is differentiable can be in all the $X_n$ so if $f$ is discontinuous on the rationals then $f$ is differentiable on at most a set of 1st category in $\mathbf{R}$ (which the irrationals are not).


It came up in an answer that has been deleted that a solution to this problem can be found as "solution 2" in the following file: http://www.isibang.ac.in/~statmath/problems/soljan09.pdf. Another reference is "A theorem concerning functions discontinuous on a dense set" by Fort.

  • $\begingroup$ Yes; it seems Chandru1 has left the building. $\endgroup$ Apr 2, 2011 at 5:04
  • $\begingroup$ The argument in Fort is the same. I think I'll just delete mine. $\endgroup$
    – Mike F
    Apr 2, 2011 at 5:19
  • $\begingroup$ Actually I don't know how to do that... $\endgroup$
    – Mike F
    Apr 2, 2011 at 5:22
  • 1
    $\begingroup$ @Jonas: Well I suppose I was momentarily ticked off that I had gone to the trouble of answering this question only subsequently learn that i) the question's owner has deleted their account as Arturo's 1st post seems to suggest and ii) the question had already been answered but the answer was deleted for whatever reason. But then I had a cup of tea and remembered this is just a website. $\endgroup$
    – Mike F
    Apr 2, 2011 at 7:52
  • 5
    $\begingroup$ @Mike You should continue to drink this brand of tea, it has some beneficial effects. :-) $\endgroup$
    – Did
    Apr 2, 2011 at 10:17

You must log in to answer this question.