Goal: Show that there exists a strictly increasing function on $\mathbb{R}$ discontinuous at all points of $\mathbb{Q}$ and continuous at all irrational numbers.


  1. Let $f(x)$ denote the popcorn function on $\mathbb{R}$ s.t.

$$ f(x) = \begin{cases} \frac{1}{q} &\text{if }x\text{ is rational, }x=\tfrac{p}{q}\text{ in lowest terms and } q > 0\\ 0 &\text{if }x\text{ is irrational.} \end{cases} $$

The popcorn function $f(x)$ can be visualized on $(0,1)$ as follows:

enter image description here

  1. Let $g(x): \mathbb{R}_{\ge 0}\rightarrow \mathbb{R}$ denote the following function:

$$ g(x) = \begin{cases} 0 &\text{if }x=0\\ \sup\{g(y) : y < x\} + \frac{1}{q} &\text{if }x>0\text{ is rational, }x=\tfrac{p}{q}\text{ in lowest terms and } q > 0\\ \sup\{g(y) : y < x\} &\text{if }x>0\text{ is irrational.} \end{cases} $$

  1. Extend $g(x)$ to all of $\mathbb{R}$ by making $g(-x) = -g(x)$. We'll refer to this extended function as $g(x)$ as well (abusing the name $g$ without harm).

  2. $g$ is strictly increasing: Let $x < y$. Then there exists a fully reduced rational $p/q \in (x,y)$ so that

$$ g(x) < g(x) + p/q \le g\left(p/q\right) \le g(y) $$

which implies $g(x) < g(y)$ as desired.

  1. $g$ is discontinuous at all points of $\mathbb{Q}$: Let $x = {p \over q}$ be a fully reduced rational. We can further assume $x$ is positive without loss of generality. Let $\epsilon = {1 \over q}$. Then for any $\delta > 0$, we have that $(x- \delta, x)$ contains at least one rational $y$ so that

$$ g(y) < g(y) + {1 \over q} \le g(x) $$

This in particular implies that $g(y) \notin (g(x)- \epsilon, g(x)+\epsilon)$ so that $g$ fails to be continuous at $x$ as desired.

Question: How can I show that $g$ is continuous at all irrational points?

  • $\begingroup$ You mean to use $\sup f(x)$ in the definition of $g(x)$? $\endgroup$ Apr 26, 2014 at 13:17
  • $\begingroup$ I meant to use $\sup g(x)$ so that the function can be strictly increasing. $\endgroup$ Apr 26, 2014 at 13:22
  • $\begingroup$ Then the definitin of $g$ is circular. In fact from $1>\frac12>\frac13>\ldots$, you would require $g(1)\ge 1+g(\frac12)\ge 1+\frac12+g(\frac13)\ge 1+\frac12+\frac13+\ldots$ $\endgroup$ Apr 26, 2014 at 13:23

1 Answer 1


My suggestion: Try $$ g(x)=\sum_{0\le q\le x}f(q)^3$$ or $$ g(x)=\sum_{n\in\mathbb N}\frac{\lfloor nx\rfloor}{n^3}$$ for $x>0$ and then $$h(x)=\begin{cases}g(x)&\text{if }x>0\\0&\text{if }x=0\\-g(-x)&\text{if }x<0\end{cases}$$

  • $\begingroup$ How does one establish that $\sum_{0\le q\le x}f(q)^3$ is continuous on irrational points? I'm assuming this is where the power of $3$ will come in handy. $\endgroup$ Apr 26, 2014 at 14:29
  • $\begingroup$ Hagen von Eitzen Can you help Connection of complex $e^z$ and real Dirichlet please? $\endgroup$
    – BCLC
    Aug 19, 2018 at 6:26

You must log in to answer this question.

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