## Bounded functions that behave almost everywhere are Riemann integrable

### Quick description

This article is about a principle that often helps in proofs that functions are Riemann integrable. The idea is that if the difficulties can somehow be contained in a union of intervals of small total length, then you are OK.

### Example 1

Let be defined by setting if and if . Then is Riemann integrable.

To prove this we use Riemann's criterion: is integrable if for every we can find a dissection such that the upper sum and the lower sum differ by at most . We also use the fact that every continuous function on a closed bounded interval is Riemann integrable.

The second fact implies that is integrable between and for every . Riemann's criterion tells us both that it is enough to find a dissection with upper and lower sums that are close and that we can find such a dissection if we just look at the interval . But in that case, we can simply choose a dissection of such that the upper and lower sums differ by at most , and turn it into a dissection of by adding the interval to the beginning. What can this extra interval contribute to the difference between the upper and lower sums? At most , since no two values of differ by more than . So if we choose to be , then the complete dissection has upper and lower sums that differ by at most .

### General discussion

The basic idea of the above proof was that the only point where a problem arises is . So we contain in a very small interval and don't bother to cut that interval up in a clever way: instead we simply use the fact that it is thin and not too tall. As for the rest of , there we don't have any trouble because is continuous, so we use known facts to find a good dissection of that part.

### Example 2

Let be defined as follows. If is irrational, then . If , where and are non-negative integers with highest common factor , then . Then is Riemann integrable.

Here, we have infinitely many discontinuities (one at every rational), so our job is less easy. However, the discontinuity at is only a jump of , and we can exploit this as follows. Suppose we are trying to find a dissection with upper and lower sums that differ by at most . First let be a positive integer greater than . Now if is any interval that contains no rational with denominator less than , then the supremum of over all is less than , and the infimum is . So the contribution makes to the difference between the upper and lower sums of a dissection that includes is at most times the width of . Therefore, the total contribution from all such intervals is at most . So what do we do now? Well. there are at most rationals in with denominator less than . Around each one put an interval of width at most . Call these the bad intervals. Then add in some other intervals to make up a dissection of , and call these ones the good intervals. Then the total contribution to the difference between the upper and lower sums is at most from the bad intervals and from the good intervals, so we are done.

### General discussion

In the first example, there is only one difficult point: . In the second, the situation is more subtle: there are difficulties at all rationals, but they become less and less severe as the denominators increase, and there are only finitely many rationals of any given denominator.

The method explained here is a special case of the divide and conquer trick.