Is there a monotonic function discontinuous over some dense set?

Can we construct a monotonic function $f : \mathbb{R} \to \mathbb{R}$ such that there is a dense set in some interval $(a,b)$ for which $f$ is discontinuous at all points in the dense set? What about a strictly monotonic function?

My intuition tells me that such a function is impossible.

Here is a rough sketch of an attempt at proving that such a function does not exist: we could suppose a function satisfies these conditions. Take an $\epsilon > 0$ and two points $x,y$ in this dense set such that $x<y$. Then, $f(x)<f(y)$ because if they are equal, then the function is constant at all points in between, and there is another element of $X$ between $x$ and $y$, which would be a contradiction. Take $f(y)-f(x)$. By the Archimedean property of the reals, $f(y)-f(x)<n\epsilon$ for some $n$.

However, after this point, I am stuck. Could we somehow partition $(x,y)$ into $n$ subintervals and conclude that there must be some point on the dense set that is continuous?

Such a function is possible.

Let $\Bbb Q=\{q_n:n\in\Bbb N\}$ be an enumeration of the rational numbers, and define

$$f:\Bbb R\to\Bbb R:x\mapsto\sum_{q_n\le x}\frac1{2^n}\;.\tag{1}$$

The series $\sum_{n\ge 0}\frac1{2^n}$ is absolutely convergent, so $(1)$ makes sense. If $x<y$, there is some rational $q_n\in(x,y)$, and clearly $f(y)\ge f(x)+\frac1{2^n}$, so $f$ is monotone increasing. However, $f$ is discontinuous at every rational:

$$\lim_{x\to {q_n}^-}f(x)=\sum_{q_k<q_n}\frac1{2^k}<\sum_{q_k\le q_n}\frac1{2^k}=f(q_n)\;.$$

Thus, $f$ is discontinuous on a set that is dense in $\Bbb R$ (and in every open interval of $\Bbb R$).

• Seriously? I was just typing that... – Asaf Karagila Jul 19 '12 at 7:09
• @Asaf: It’s a pretty standard example, I think. – Brian M. Scott Jul 19 '12 at 7:10
• True.${}{}{}{}$ – Asaf Karagila Jul 19 '12 at 7:11
• @AndrewSalmon: Of course there is not. It also does not assume that. – Asaf Karagila Jul 19 '12 at 7:15
• @BrianM.Scott you mentioned in one of comments: "You can use the same trick to build a function that’s discontinuous at each point of any countably infinite X⊆R." Can we build a function defined on E⊆R that is discontinuous only at countable infinite subset C⊆E – Sushil Nov 25 '14 at 1:49

For those interested, here is a slightly more rigorous proof that the construction exists using measure theory.

We will define a function $H$ which is continuous from the left at ever $x \in [0,1]$ but is only continuous from the right at the irrationals. To build such a function we need the folliowing scaffolding.

First let $\psi: \mathbb{N} \to \mathbb{Q} \cap [0,1]$ be a bijection enumerating the rationals in the interval $[0,1]$. Then define $B(x) = \{n : \psi(n)< x\}$ or equivalently $B(x) = \psi^{-1}([0,x))$. Finally let $\mu: P(\mathbb{N}) \to \overline{\mathbb{R}}$ be the counting measure. We additionally define a measure $\nu: P(\mathbb{N}) \to \mathbb{R}$ such that $$\nu(A) = \int_A 2^{-n} d \mu(n).$$ The measure $\nu$ has the additional property that $\nu \ll \mu$ and $\nu(\mathbb{N}) = \sum_{n \in \mathbb{N}} 2^{-n} \mu({n}) = 1 < \infty.$

We claim that the function $H(x) = \nu(B(x))$ has the properties of $f$ in the statement of the problem. We will first show that for every $x \in [0,1]$ the function $H(x)$ is left continuous. Take a sequence of $x_k \to x$ from the left, we can then rearrange the sequence to be strict monotonic. It follows that if $k > m$ then $$B(x_m) = \{n: \psi(n) < x_m < x_k < x\} \subset \{n: \psi(n) < x_k < x\} = B(x_k).$$ By the finiteness of $\nu$ we have that by upward measure continuity $$\lim_{k \to \infty} H(x_k) = \lim_{k \to \infty} \nu(B(x_k)) = \nu\left(\bigcup_{k=1}^\infty B(x_k) \right) = \nu(\left \{n: \psi(n) < x\}\right ) = H(x).$$ Note that if $n \in \bigcup B(x_k)$ there is an $K$ so that $\psi(n) < x_k < x$ so any $n$ with $\psi(n) < x$ is in $\bigcup B(x_k).$

Next we claim that $H$ is only right continuous only when $x$ is irrational. Take a sequence of $x_k \to x$ from the right and rearrange the sequence to be strict montonic. It follows that if $k > m$ then $$B(x_m) = \{n: \psi(n) < x_m\} \supset \{n: \psi(n) < x_k < x_m\} = B(x_k).$$ By finiteness of $\nu$ and downard measure continuity $$\lim_{k \to \infty} H(x_k) = \lim_{k \to \infty} \nu(B(x_k)) = \nu\left(\bigcap_{k=1}^\infty B(x_k) \right) = \nu(\left \{n: \psi(n) < x_k\ \forall k\}\right ).$$

If $x$ is irrational then $m \in \{n: \psi(n) < x_k\ \forall k\}$ implies that $\psi(m) < x$ and if $\psi(m) < x$ then $\psi(m) < x_k$ for all $k$ so $\{n: \psi(n) < x_k\ \forall k\} = B(x)$ and $H(x_k) \to H(x)$ from the right. If $x$ is rational then $x= \psi(q)$ for some $q \in \mathbb{N}.$ Thus $x < x_k \forall k$ implies that $\{n: \psi(n) < x_k\ \forall k\} = B(x) + \{q\} = D$. It follows that $\nu(D) = \nu(B(x)) + 2^{-q} > H(x)$. So $H(x_k) \to H(x) + 2^{-q} \neq H(x)$ from the right, and so $H$ is not right continuous at the rationals.

We have thus shown that for any $x \in [0,1] \setminus \mathbb{Q}$, any sequence $x_k \to x$ has the property $\lim H(x_k) = x$ from the left and the right, and if $x \in [0,1] \cap \mathbb{Q}$ then if $x_k \to x$, $\lim H(x_k)$ does not exist. Therefore $H$ is continuous at every irrational and discontinuous at every rational.

You can then repeat this construction along the whole real line by adding the nearest integer each time.