# Example of Riemann integrable $f: [0,1] \to \mathbb R$ whose set of discontinuity points is an uncountable and dense set in $[0,1]$ [closed]

Give example of a function $f: [0,1] \to \mathbb R$ which is integrable ( Lebesgue or Riemann , if possible , both) but whose set of discontinuity points is an uncountable set and dense in $[0,1]$ ?

## closed as off-topic by Najib Idrissi, Jimmy R., Aditya Hase, Ivo Terek, HakimNov 26 '14 at 19:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Najib Idrissi, Jimmy R., Aditya Hase, Ivo Terek, Hakim
If this question can be reworded to fit the rules in the help center, please edit the question.

• Integrable in what sense? Lebesgue? The first example that comes to mind works in that case. – Najib Idrissi Nov 26 '14 at 15:21
• @NajibIdrissi: Lebesgue is ok , I would really like to see your example ; but Riemann is also wanted – user123733 Nov 26 '14 at 15:22

An example of Lebesgue integrable function is easy, as shown in other answers.

It is a known fact that a function $f: \mathbb{R} \to \mathbb{R}$ is Riemann integrable if and only if $f$ is bounded and the set of discontinuities has measure zero.

Let $C$ be the usual ternary Cantor set, and let $\mathbb{Q}$ denote the set of rational numbers. The function

$$f(x) = \begin{cases} 200, &x \in C \\ 1/q, &x = p/q \text{ is rational in lowest terms and } x \notin C \\ 0, &\text{otherwise} \end{cases}$$ is discontinuous in $C \cup \mathbb{Q}$, which is uncountable and dense but has measure zero (hence $f$ is Riemann integrable).

• Awesome construction! – layman Nov 26 '14 at 15:45
• @Pedro M. : Could you just please explain the measure $0$ part of $C \cap \mathbb Q$ – user123733 Nov 26 '14 at 16:02
• @user123733 It's actually $C \cup \mathbb{Q}$ that has measure $0$. This is because the cantor set $C$ has measure $0$, and the rationals $\mathbb{Q}$ have measure $0$, so $m(C \cup \mathbb{Q} ) \leq m(C) + m(\mathbb{Q}) = 0 + 0 = 0$, which shows $m(C \cup \mathbb{Q}) = 0$. – layman Nov 26 '14 at 16:20

An easy example is this: Let $C$ be the Cantor set and denote by $\chi_C$ its characteristic function, so that for $x\in[0,1]$, we have that $\chi_C(x)=0$ if $x\notin C$, and $\chi_C(x)=1$ if $x\in C$. Clearly $\chi_C$ is bounded, $0\le\chi_C(x)\le 1$ for all $x$. This function is discontinuous at an uncountable set of points (all points in $C$, because they are limit of points not in $C$, since $C$ is nowhere dense, but they are alos limit of points in $C$, since $C$ is perfect).

Now, let $i$ be the increasing function obtained by enumerating the rationals in $[0,1]$, say $q_0,q_1,\dots$, and letting $i(x)=\sum_{q_n\le x}2^{-n}$, that is, given $x\in[0,1]$, we look at the set of rationals in $[0,x]$, we look at the set $I\subseteq\mathbb N$ of indices of these rationals (according to our enumeration), and then set $i(x)=\sum_{n\in I}2^{-n}$. Clearly $i$ is bounded, $0\le i(x)\le 2$ for all $x$. The set of discontinuities of $i$ is dense in $[0,1]$ (because $i$ is discontinuous precisely at the points in $\mathbb Q\cap[0,1]$. That these are discontinuity points is easy to see, since we explicitly added jumps there. But if $x$ is irrational, for any $N$, in a sufficiently small neighborhood of $x$ we only find rationals with indices larger than $N$, and $\sum_{j>N}2^{-j}=\tau$ can be made arbitrarily small by choosing $N$ sufficiently large. Now, if $y$ is any point in that neighborhood, then $|i(x)-i(y)|\le2\tau$, so $i$ is continuous at $x$).

Finally, $f=\chi_C+i$ is Riemann integrable, and its set of discontinuities is both dense and uncountable. One can argue directly about its integrability, or one can quote Lebesgue's characterization, that a function is Riemann integrable iff it is bounded and its set of discontinuities has measure zero. But both $C$ and $\mathbb Q\cap[0,1]$ have measure zero, and so does their union.

If you mean Lebesgue integrable, then $f(x) = \begin{cases} 0 & x \in \mathbb{Q} \cap [0,1] \\ 1 & x \not \in [0,1] \cap \mathbb{Q} \\ \end{cases}$ is a function that is discontinuous at every irrational (hence on an uncountable, dense set), but it is integrable, and $\int \limits_{[0,1]} f(x) \,d\mu = 0m(\mathbb{Q} \cap [0,1]) + 1m(\mathbb{Q}^{c} \cap [0,1]) = 0 \cdot 0 + 1 \cdot 1 = 1$.

Note that this function is not Riemann integrable. Do you know why?

If you want a function that is Riemann integrable, but is discontinuous at an uncountable dense set, then you need to construct a function whose set of discontinuities is both uncountable and a set of measure $0$ (since a function is Riemann integrable iff its set of discontinuities has measure $0$).

• In fact, it's discontinuous at all the rationals also. So, the set of discontinuity points is all of [0,1]. – Nate Eldredge Nov 26 '14 at 15:24
• @NateEldredge Right, I was just pointing out the irrationals because they wanted an uncountable dense set of discontinuities, though I guess $[0,1]$ is dense in itself. – layman Nov 26 '14 at 15:26
• It certainly is! – Nate Eldredge Nov 26 '14 at 15:28
• @MathIsHardNoItsNot: But the Cantor set is uncountable of Lebesgue measure $0$ , so can we find such to satisfy my conditions ? – user123733 Nov 26 '14 at 15:33
• @user123733 The cantor set is not dense in $[0,1]$, and you said you want a function whose set of discontinuities is dense. – layman Nov 26 '14 at 15:36