## Iterated Integrals III

I recently heard a characterization (if someone remembers the source, please let me know) of the situation in analysis as being that there are no theorems — only conjectures that don’t yet have counterexamples. Today’s counterexample is adapted from one in Apostol’s book, but it’s far simpler than his seems to be.

We might guess that we can always evaluate double integrals by iterated integrals as we’ve been discussing. After all, that’s exactly what we do in multivariable calculus courses as soon as we introduce iterated integrals, never looking back to all those messy double and triple Riemann sums again. Unfortunately, the existence of the iterated integrals — even if both of them exist and their values agree — is not enough to guarantee that the double integral exists. Today, we will see a counterexample.

Let be the set of points in the unit square so that and , where and are two fractions with the same denominator, each of which are in lowest terms. That is, it contains the point , but not the point , since when we write these latter two fractions in lowest terms they are no longer over a common denominator. We will consider the characteristic function , which is on points in and elsewhere in the unit square.

First, I assert that both iterated integrals exist and have the same value. That is

Indeed, the set is symmetric between the two coordinates, so we only need to evaluate one of these iterated integrals and the other one will automatically have the same value.

If is an irrational number in , then there is no at all so that . Thus we can easily calculate the inner integral

On the other hand, if is a rational number, we can write it in lowest terms as . Then there are only a finite number of points having the same denominator at all. Thus we can break the interval into a finite number of pieces, on each of which the characteristic function has the constant value zero. Thus we can calculate the inner integral

And so we see that for any the inner integral evaluates to . Then it’s easy to calculate the outer integral

and, as we said before, the other iterated integral also has the value .

On the other hand, the double integral does *not* exist. Yes, is countable, and so it has measure zero. However, it’s also dense, which means is discontinuous *everywhere* in the unit square.

Saying that is dense in the square means that every neighborhood of every point of the square contains some point of . Indeed, consider a point in the square and some radius . Since the real numbers are Archimedean, we can pick some , and as many people on Nick‘s Twitter experiment (remember to follow @DrMathochist!) reminded us, there are infinitely many prime numbers. Thus we can pick a *prime* . Then we can round up to the next larger fraction of the form , which will be in lowest terms unless , in which case we round down to . Similarly, we can round up (or down) to a fraction in lowest terms. This gives us a new point , and we can calculate the distance

So there is a point in within any radius of .

But now when we try to set up the upper and lower integrals to check Riemann’s condition we find that *every* subinterval of any partition must contain some points in and some points not in . The points within tell us that the upper sum gets a sample value of for each subinterval, giving a total upper sum of . Meanwhile the points outside of tell us that the lower sum gets a sample value of for each subinterval, giving a total lower sum of . Clearly Riemann’s condition fails to hold, and thus the double integral

fails to exist, despite the iterated integrals existing and agreeing.