"Length" of rationals in an interval

763 Views Asked by At

For $x \in \mathbb{R}$, define $r(x)$ as follows: $$ r(x)= \begin{cases} 1 &\text{if $x$ is rational},\\ 0 &\text{if $x$ is irrational}. \end{cases} $$

Q. What is $\int_0^1 r(x) dx$ ?

I know the rationals are dense in an interval, but countable, and so "sparse."

My motivation is a desire to average over the rationals, and in some sense this integral would be the denominator. If the integral is zero, then I'll have to think of another route. Thanks!

3

There are 3 best solutions below

6
On BEST ANSWER

It depends on whether you're considering the Riemann integral or Lebesgue integral.

Note that every interval of any partition of $[0,1]$ contains a rational point, so any upper sum for $r(x)$ is $1$. Similarly, any lower sum for $r(x)$ is 0. Thus, $r(x)$ is not Riemann integrable.

However, $r(x)$ is the indicator function for $\mathbb{Q}$, which is a measurable set, so $r(x)$ is Lebesgue integrable on $[0,1]$. Unfortunately, since $\mathbb{Q} \cap [0,1]$ is countable, it has measure zero. Thus, we may compute the Lebesgue integral: $$\int_{0}^{1} \mathbb{1}_{\mathbb{Q}} \, d\mu = \mu(\mathbb{Q} \cap [0,1]) = 0$$

0
On

The integral exists in the Lebesgue sence and it is zero. That is because the rationals have measure zero, being a countable set. $r$ is the characteristic function of the rationals, and for such function the integral is given by $$ \int_0^1 r(x) \, dx = \lambda([0,1] \cap \mathbf Q) $$ where $\lambda$ is the Lebesgue measure. We have for measurable sets $A \subseteq \mathbf R$ that $$ \lambda(A) = \inf \left\{ \sum_{i=1}^\infty (b_i - a_i) \mid A \subseteq \bigcup_i [a_i, b_i) \right\} $$ Now for a countable $A = \{c_n \mid n \in \mathbf N\}$ (for example $A = [0,1]\cap \mathbf Q$), and any $\epsilon > 0$, let $b_i = c_i + \epsilon 2^{-(i+1)}$, $a_i = c_i - \epsilon 2^{-(i+1)}$ then $A \subseteq \bigcup_i [a_i, b_i)$ and $$ \sum_i (b_i - a_i) = \sum_i \epsilon 2^{-i} = \epsilon. $$ Hence $\lambda(A) \le \epsilon$ for every $\epsilon$, giving $\lambda(A) = 0$. Hence $$ \int_0^1 r(x) \, dx = \lambda(\mathbf Q \cap [0,1]) = 0. $$

0
On

Others have focused on the specific value of the integral itself. However, it is clear from your description that you wish to evaluate something along the lines of $$ \frac{\int_0^1 f(x)r(x)dx}{\int_0^1 r(x)dx} $$ where $r(x)$ is the rational indicator function.

While the component integrals cannot be evaluated, the overall concept is still meaningful. It is likely best to think of this in terms of a Riemann sum restricted to subsets of the rationals. In effect, you seek $$ \lim_{n\to\infty} \frac{1}{n!}\sum_{i=1}^{n!} f\left(\frac{i}{n!}\right) $$ where we restrict $n$ to integer values. Note that I have chosen $n!$ to ensure that subsequent sums will always include every point from the previous term. Also note that this is using the right-side value for each point, which means that f(0) does not affect the sum at any point.

It should be noted that this expression may not be well defined for some functions, and for others it may not be uniquely defined. A more rigorous definition would involve $\limsup$ and $\liminf$, and a requirement that these be equal for the "average" to exist.