# An Increasing Function Discontinuous at All Rational Numbers

Let $q: \mathbb{N}\rightarrow \mathbb{Q}$ be a bijective map and let $g: \mathbb{Q}\rightarrow \mathbb{R}$ define $g(q(n))=2^{-n}$. Show that $\sum_{r\in \mathbb{Q}}g(r)$ is absolutely convergent. Let $f:\mathbb{R}\rightarrow \mathbb{R}$ be define by the formula $f(x):=\sum_{r\in \mathbb{Q}:r<x}g(r)$, show that.

(1) $f$ is well-defined.

(2) $f$ is strictly monotonic increasing.

(3) $f$ is discontinuous at every rational number.

(4) $f$ is continuous at any irrational number $x$ (hint: first demonstrate that the functions $f_n(x):=\sum_{r\in \mathbb{Q}:r<x,\,g(r)\ge 2^{-n}}g(r)$ are continuous at $x$, and that $|f(x)-f_n(x)|\le 2^{-n}$).

Sketch-proof

First we have to show that $\sum_{r\in \mathbb{Q}}g(r)$ converges absolutely (I know that is obvious but I'd like to do a more elaborated argument of this fact). It suffice to show that for any finite subset of $\mathbb{Q}$ say $F$, the series $\sum _{r\in F}|g(r)|$ is bounded.

Let $F\subset \mathbb{Q}$ and $\#F< \infty$. Then we have that the sequence $(q^{-1}(x))_{x\in F}$ is finite and therefore bounded by some $M\in \mathbb{N}$. Setting $\{q(m):m\in \mathbb{N} \text{ and } m\le M\}$ we know that it contains $F$. Thus

\begin{align} \sum _{r\in F}|g(r)|\le \sum _{\{q(m):m\in \mathbb{N},\, m\le M\}}|g(r)| = \sum _{m=0}^M|g(\,q(m)\,)|\\ =\sum _{m=0}^M 2^{-m} \le \sum _{m=0}^\infty 2^{-m}<\infty \end{align}

Now since $F$ was an arbitrary subset of $\mathbb{Q}$, for any finite subset the upper bound works in other words we have

$$\sup \bigg\{\sum _{x\in F}|f(x)|:F\subset X; \#F<\infty \bigg\}<\infty$$

which shows that the series converges absolutely as desired.

(1) $f$ is well-defined.

we have to show that $f(x)$ is defined for every $x\in \mathbb{R}$. Let $x\in \mathbb{R}$, then we have

$$\sum_{r\in \mathbb{Q}:r<x}g(r)\le \sum_{r\in \mathbb{Q}}g(r)$$

Since $g(r)$ is always non-negative for any rational number and since the latter is convergent then the former must converges also. Hence $f(x)$ always exists.

(2) $f$ is strictly monotonic increasing.

Let $x,y\in \mathbb{R}$ such that $x<y$. Then there exists some rational number in between, let call it $s$, i.e., $x<s<y$. Since $s$ is rational then there exists some $n\in \mathbb{N}$ for which $q(n)=s$. So

$$f(y)=\sum_{r\in \mathbb{Q}:r<y}g(r)=\sum_{r\in \mathbb{Q}:r<x}g(r) +\sum_{r\in X}g(r)$$

where $X = \{r\in \mathbb{Q}:r<y \} \backslash \{ r\in \mathbb{Q}:r<x\}$, clearly $s\in X$ so is a non-empty set, and since $g(r)$ is always positive for any rational. Then

$$\sum_{r\in X}g(r)\ge g(s)=g(q(n))= 2^{-n}$$

Thus putting this together we can conclude that $f(y) > f(x)$, as desired.

(3) $f$ is discontinuous to every rational number.

Let $s$ be an arbitrary rational number, then there exists a $n\in \mathbb{N}$ so that $q(n)=s$. Now for what we have shown in (2), for any real number $x$ such that $x>s$, we have $f(x)\ge f(s)+2^{-n}$.

We argue by contradiction, suppose that $f$ is continuous at $s$. Let $\varepsilon$ be a positive real such that $\varepsilon < 2^{-n}$. Since $f$ is continuous then there is some $\delta >0$ such that $|f(y)-f(s)|<\varepsilon$ whenever $y$ is a real number which is $\delta$- close to $s$, i.e., $|y-s|<\delta$. But there for any $x\in (s,s +\delta)$ we have $f(x)-f(s)\ge 2^{-n}>\varepsilon$. Contradiction. Hence $f$ cannot be continuous at any rational number as claimed.

(4) $f$ is continuous at any irrational number $x$.

Let $x$ be an irrational number and let define the functions $f_n: \mathbb{R} \rightarrow \mathbb{R}$ by setting $$f_n(x):=\sum_{r\in \mathbb{Q}:r<x,\,g(r)\ge 2^{-n}}g(r)$$

Let define $Q_n= \{r\in \mathbb{Q}: g(r)\ge 2^{-n}\}$. We claim that $Q_n$ is finite. If $r \in Q_n$ so $g(r)\ge 2^{-n}$ and since $r\in \mathbb{Q}$, there is some $m$ such that $q(m)=r$. Thus $g(r)=g(q(m))= 2^{-m}\ge 2^{-n}$, which means that $m\le n$, in other words $Q_n= \{q(i): 0\le i \le n \}$, which clearly contains a finite number of rational numbers.

We shall show that $f_n$ is continuous at $x$.

Given $\varepsilon>0$ and $n\in \mathbb{N}$. We set $\delta = \min \{\, |r-x|: r\in Q_n \,\}$, $\delta$ is well-defined since $Q_n$ is non-empty (at least contain $q(0)$) and all $|r-x|$ are different to zero since $x$ is irrational, then $\delta>0$. Let $\{z\in \mathbb{R}: |z-x|<\delta \}$, we claim that $|f_n(z)-f_n(x)|< \varepsilon$.

$$|f_n(z)-f_n(x)| = \Bigg|\sum_{r\in \mathbb{Q}:r<z,\,r\in Q_n}g(r)\, -\sum_{r\in \mathbb{Q}:r<x,\,r\in Q_n}g(r) \Bigg|$$

If we can show that $\{r\in \mathbb{Q}:r<z,\,r\in Q_n\}=\{r\in \mathbb{Q}:r<x,\,r\in Q_n\}$, then both series are the same and the difference is zero.

$LHS\Rightarrow RHS$

By contradiction suppose that there is some element $r$ in $LHS$ that is not in the $RHS$. So $r$ is rational, $r<z$ and $r\in Q_n$. Since $r$ is not in the $RHS$ then we would have $r\ge x$. Clearly the equality is not possible since $x$ is irrational. In the case $r>x$, we have $x<r<z$. So, $z-x>r-x$, but $z-x< \delta \le r-x$ since $r\in Q_n$, contradiction.

$RHS\Rightarrow LHS$

Again for contradiction suppose there is some $r$ in $RHS$ that is not in the $LHS$. So this is only possible if $r\ge z$. If $z=r$, we have $|z-x|<\delta \le |r-x|=|z-x|$, a contradiction. The case when $r>z$ is similar to the last case in $LHS\Rightarrow RHS$, just with the roles of $z$ and $x$ interchanged.

Thus both sets are equal and then the series are the same. Hence its difference is zero and $f_n$ is continuous at $x$ as claimed.

Claim: $|f(x)-f_n(x)|\le 2^{-n}$. Since $f(x)=\sum_{r\in \mathbb{Q}:r<x}g(r)$, then we have

$$f(x)=\sum_{r\in \mathbb{Q}:r<x, r\in Q_n}g(r)+\sum_{r\in X}g(r)$$

where $X=\{r\in \mathbb{Q}:r<x\}-\{r\in \mathbb{Q}:r<x, r\in Q_n\}$. Now since $X\subset \{r\in \mathbb{Q}: g(r)< 2^{-n}\}$, and $g(r)$ is non-negative for all the rational numbers then

\begin{align} \sum_{r\in X}g(r)\le \sum_{r\in \mathbb{Q}: g(r)< 2^{-n}}g(r) = \sum_{i=n+1}^\infty2^{-i}\\ =2^{-n} \end{align}

as desired.

To conclude we have to show that $f$ is continuous at $x$. Since

\begin{align}|f(y)-f(x)|\le |f(y)-f_n(y)|+|f_n(y)-f_n(x)|+|f_n(x)-f(x)| \\ \le 2^{-n} +|f_n(y)-f_n(x)|+2^{-n} \end{align}

Given $\varepsilon>0$, we set $N$ such that $2^{-N}<\varepsilon$ and we choose $\delta = \min \{\, |r-x|: r\in Q_N \,\}$. Then as we have proven, for all $y\in (x-\delta,x+\delta)$ we must have $|f_N(y)-f_N(x)|\le \varepsilon$. So,

\begin{align}|f(y)-f(x)|\le |f(y)-f_N(y)|+|f_N(y)-f_N(x)|+|f_N(x)-f(x)| \\ \le 2^{-N} +|f_N(y)-f_N(x)|+2^{-N} \\ \le 3\varepsilon \end{align}

which proves that $f$ is continuous at any irrational as desired.

Hopefully this work :)

The functions $f_n$ are simply partial sums of $f$: Notice that if $r=q(m)$ and $g(r)\geq 2^{-n}$, then $2^{-m}\geq 2^{-n}$, that is, $m\leq n$, so in each $f_n$ you only choose finitely many rational numbers to make the sum. Notice that, if $n\in\mathbb{N}$ is given and $x$ is irrational, you can find an interval around $x$ that does not contain any rational $r$ with $g(r)\geq 2^{-n}$, so the sum that defines $f_n$ contains the same elements in that interval, so $f_n$ is constant in that interval, hence continuous at $x$.
Now notice that, for every $z\in\mathbb{R}$, $$|f(z)-f_n(z)|=\sum_{r\in\mathbb{Q},r<z} g(r)-\sum_{r\in\mathbb{Q},r<z,g(r)\geq 2^{-n}}g(r)=\sum_{r\in\mathbb{Q},r<z,g(r)<2^{-n}}g(r)$$ so $|f(z)-f_n(z)|\leq 2^{-(n+1)}+2^{-(n+2)}+\cdots=2^{-n}$, which can be as small as you want. (you should check this last inequality using the fact that $g$ is injective.)
Now, let $x$ be an irrational number. Using the inequality $$|f(x)-f(y)|\leq |f_n(x)-f_n(x)|+|f_n(x)-f_n(y)|+|f_n(y)-f(y)|,$$ you can find an $n$ such that the first and the last term on the right are as small as you want, and, using the continuity of $f_n$ at $x$, a $\delta$ such that the middle term is small for $|x-y|<\delta$. With this, you show that $f$ is continuous at $x$.