# Can a discontinuous function at all points in the domain ($\subset \mathbb R^n$) be integrable?

Let $A\subset \mathbb R^n$ be a closed n-dimensional cell and $$X=A\cap\mathbb Q^n=\{x_1,x_2,\dots,x_k,\dots\}$$ be a enumeration of $A\cap\mathbb Q^n$. Define $f\colon A\to\mathbb R$ by $$f(x)\colon\begin{cases}\frac{1}{2^k}, \textrm{ if } x=x_k\in X;\\ 0, \textrm{ if } x\in A-X\end{cases}.$$

Is this function integrable?

My attempt

Since the set of discontinuous points of $f$ is A (which has measure not zero), the function isn't integrable.

But, on the other hand, given $\varepsilon>0$ define $A_\varepsilon=\{x\in A: f(x)\geq \varepsilon\}$. Then $A_\varepsilon=\{x_1, x_2,\dots, {x_k}_\varepsilon\}$ is finite. Define a partition $P_\varepsilon$ of $A$ such that $B_1, B_2,\dots,{B_k}_\varepsilon\in P_\varepsilon$ with $B_i\cap A_\varepsilon=\{x_i\}, 1\leq i \leq k_\varepsilon$ and $$\sum_{i=1}^{k_\varepsilon}vol(B_i)<\varepsilon.$$ Then, $L(f,P_\varepsilon)=0, M_{B_i}\leq 1/2$ and $f(x)<\varepsilon$ for $x\in A-A_\varepsilon$. So $$U(f, P_\varepsilon)-L(f, P_\varepsilon)=\sum_{i=1}^{k_\varepsilon}M_{B_i}vol(B_i) + \sum_{B\in P_\varepsilon, B\neq B_i} M_B vol(B)$$ $$< \frac{1}{2}\sum_{i=1}^{k_\varepsilon}vol(B_i)+\sum_{B\in P_\varepsilon, B\neq B_i} \varepsilon vol(B)$$ $$< \frac{1}{2}\varepsilon+\varepsilon vol(A)=\left(\frac{1}{2}+vol(A)\right)\varepsilon.$$ Thus, $f$ is integrable.

Which solution is correct?

• Your function is disconnected everywhere (or maybe the indicator function of $X$ is). Nevertheless, it is integrable and its integral is 0. Also the indicator function of X is also integrable of integral 0, simply because $f$ is bounded and the set $X$ has measure $0$. (In this comment, all is with respect to the Lebesgue measure.) – Thibaut Dumont Nov 9 '17 at 23:00
• "isn't integrable" with respect to what measure? (riemann vs lebesgue) – Max Nov 9 '17 at 23:01
• It should be clear that the OP is thinking "integrable" means "Riemann integrable", but the OP should make this clear – zhw. Nov 9 '17 at 23:06
• Pretty sure your function is continuous at any point that has at least one irrational co-ordinate. – JonathanZ Nov 9 '17 at 23:07
• "Since the set of discontinuous points of $f$ is A" That's false. – zhw. Nov 9 '17 at 23:12

Here's a sketch of how you can show $f$ is continuous at any point $x_0$ that has at least one irrational co-ordinate (which is the same as $x_0 \in A - X$, in your notation):
Use the basic $\epsilon$-$\delta$ definition of continuity. Since $f(x_0) = 0$, if we are given a $\epsilon > 0$ we need to find a $\delta$ neighborhood of $x_0$ on which $|f| < \epsilon$. If you take a $N$ large enough so that $1/2^N < \epsilon$, then there are only a finite number of points where $f(x) \ge 1/2^N$, i.e. $\{x_1, ... x_N \}$, the first $N$ points in your enumeration of $A \cap \mathbb{Q}^n$. Make your $\delta$ small enough so that none of those points are in your neighborhood and you're done. (I'm leaving it up to you to write an explicit formula for $\delta$.)