# Construct an increasing function f on R that is continuous at every irrational number an

Construct an increasing function $f$ on $R$ that is continuous at every irrational number and is discontinuous at every rational number.
Solution: Let ${r}_{n}$ be a sequence with distinct terms whose range is $\mathbb{Q}$. Let $f:\mathbb{R}\to \mathbb{R}$ be given by
$f\left(x\right)=\sum _{{r}_{n}
You can still ask an expert for help

## Want to know more about Irrational numbers?

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Alexzander Bowman
Let

It's increasing. Besides, it is discontinuous at ${r}_{0}$ and only at ${r}_{0}$.
Now, let

It's increasing and it is discontinuous at ${r}_{1}$ and only at ${r}_{1}$. So, ${f}_{0}+{f}_{1}$ is increasing and it is discontinuous at ${r}_{0}$ and at ${r}_{1}$ and only at those points.
More generally, for each $n\in {\mathbb{Z}}_{+}$, let

Then $f$ is increasing, since it is equal to $\sum _{n=0}^{\mathrm{\infty }}{f}_{n}$. And it is not hard to see that it is discontinuous at $x$ if and only if $x\in \left\{{q}_{n}\mid n\in {\mathbb{Z}}_{+}\right\}=\mathbb{Q}$ (this follows from the fact that the convergence of the series $\sum _{n=0}^{\mathrm{\infty }}{f}_{n}$ is uniform, by the Weierstrass $M$-test). The reason why I told you in the comments that it should be $\frac{1}{{2}^{n}}$ rather than $\frac{1}{2n}$ was so that the expression $\sum _{n=0}^{\mathrm{\infty }}{f}_{n}$ makes sense, that is, so that it converges, for every $x\in \mathbb{R}$.