# Example of an increasing, integrable function $f:[0,1]\to\mathbb{R}$ which is discontinuous at all rationals?

Problem: Show that there exists a function $f:[0,1]\rightarrow\mathbb{R}$ such that:

1. $f$ is discontinuous in all $x\in \mathbb Q$.
2. $f$ is increasing in $[0,1]$.
3. $f$ is integrable.

EDIT: Sorry, it is not discontinuous in all $x\in \mathbb R \setminus \mathbb Q$, just in $\mathbb Q$.

-
I think that $1$ and $3$ contradict itself, since if $f$ is almost everywhere not continuous it is not integrable – Belgi Feb 6 '13 at 10:45
@Belgi: that depends on your measure... – akkkk Feb 6 '13 at 10:54
@Belgi The indicator function of the rationals is not continuous anywhere, but is integrable on any measurable set. – JSchlather Feb 6 '13 at 10:56

In general for any countable set $C \subset \mathbb R$ you can find a monotone function that is discontinuous only on $C$. Your particular case has already been answered elsewhere on the site, see this answer of Brian Scott.
You can take $f_0(x)=x$ and a surjective map $q:\mathbb{N}\to\mathbb{Q}\cap[0,1]$, then take: $$I_x^N = \{n\in\mathbb{N}:q(n)\leq x\},$$ $$f_N(x) = f_0(x)+\sum_{n\in I_x^N}\frac{1}{n^2+1},$$ $$f(x) = \sup_{N}\, f_N(x).$$