A Pair of Counterexamples in Vector Calculus

November 27, 2011

While recently reviewing some topics in vector calculus, I became
curious as to why violating seemingly innocuous conditions for some
theorems leads to surprisingly wild results. In fact, I was struck by
how these theorems resemble computer programs, not in some
abstract
way, but in how the lack of “input validation” leads
to
non-obvious
behavior in the face of erroneous input.

I found that understanding why these counterexamples lead to wild
results deepened my understanding of the theorems involved and their
proofs.[1] Besides,
pathological examples are more interesting than well-behaved ones!

Let
\[
\begin{aligned}
L &= -\frac{y}{x^2+y^2} \text{, } M = \frac{x}{x^2+y^2} \text{,}
\end{aligned}
\]
and \(C\) be a curve going clockwise around the rectangle \(D = [-1,
1]^2\).[2] Then the integral of \(L \,dx + M \, dy\) around \(C\) is \(2
\pi\) since it encloses the origin. But
\[
\frac{\partial{M}}{\partial{x}} = \frac{\partial{L}}{\partial{y}} = \frac{y^2-x^2}{x^2+y^2}
\]
so the difference of the two vanishes everywhere but the origin, where
neither function is defined. Therefore, the (improper) integral over
\(D\) also vanishes, proving the inequality. ∎

Of course, the easy explanation is that the discontinuity of \(L\)
and \(M\) at the origin violates a condition of Green's theorem. But
that doesn't really tell us anything, so let's break down the theorem
and see where exactly it fails.

Green's theorem is usually proved first for rectangles \([a, b]
\times [c, d]\), which suffices for our purpose. If \(C\) is a curve
that goes counter-clockwise around such a rectangle \(D\), then we can
easily show that
\[
\oint_C L \,dx = - \iint_D \frac{\partial{L}}{\partial{y}} \,dx \,dy
\]
and
\[
\oint_C M \,dy = \iint_D \frac{\partial{M}}{\partial{x}} \,dx \,dy \text{,}
\]
with the sum of these two formulas proving the theorem.

So the first sign of trouble is that the theorem freely
interchanges addition and integration. Since the partial derivatives
of our functions diverge at the origin, if \(D\) contains the origin
then the integrals of those partial derivatives over \(D\) may not
even be defined, even if the integral of their difference is.

But the problem arises even before that. The statements above are
proved by showing
\[
\oint_C L \,dx = - \int_a^b \left( \int_c^d \frac{\partial{L}}{\partial{y}} \,dy \right) \,dx
\]
and
\[
\oint_C M \,dy = \int_c^d \left( \int_a^b \frac{\partial{M}}{\partial{x}} \,dx \right) \,dy
\text{.}
\]
both of which hold for our example. But notice that in one case we
integrate with respect to \(y\) first, and in the other case we
integrate with respect to \(x\) first. Therefore, we have to
interchange the order of integration or convert to a double integral
in order to get them to a form where we can add them. And there's the
rub: if \(D\) contains the origin, switching the order of integration
for either integral above switches the sign of the result!

This fully explains the discrepancy; since the result of both
integrals above (with the iteration order preserved) is \(\pi\),
adding them together as-is gives the expected result of \(2 \pi\).
But if we switch the iteration order of one of the iterated integrals
as done in the proof of Green's theorem, then we switch the result of
that integral to \(-\pi\), which cancels with the result of the other
unchanged integral to produce \(0\).

So now let's examine this strange behavior of the sign of an
integration's result depending on the iteration order. This leads us
to our next “counterexample,” this time
for Fubini's
theorem:

Similarly,
\[
\int_{-1}^1 V(y)\,dy = \pi \text{,}
\]
so the iterated integrals of \(f(x, y)\) over \([-1, 1]^2\) differ; in
fact, as we claimed above, switching the iteration order switches the
sign of the result. ∎

We can repeat the above calculations for an arbitrary rectangle to
see that the iterated integrals of \(f(x, y)\) differ if \(D\)
contains the origin either as an interior point or a corner. But
there's an easier way to prove that statement and also gain some
insight as to why \(f(x, y)\) has this strange property.

Note that the key facts in the above calculations were that \(U(x)
\lt 0\) for any \(x \ne 0\) and \(V(y) \gt 0\) for any \(y \ne 0\).
Therefore, integrating \(U(x)\) over any interval on the \(x\)-axis
would produce a negative result and integrating \(V(x)\) over any
interval on the \(y\)-axis would produce a positive result, leading to
the difference in iterated integrals. This holds more generally; for
any \(m, n \gt 0\):
\[
\int_{-n}^n f(x, y) \,dy \lt 0
\qquad \text{ and } \qquad
\int_{-m}^m f(x, y) \,dx \gt 0 \text{.}
\]
Therefore,
\[
\int_{-m}^m \left( \int_{-n}^n f(x, y) \,dy \right) \,dx \lt 0
\qquad \text{ and } \qquad
\int_{-n}^n \left( \int_{-m}^m f(x, y) \,dx \right) \,dy \gt 0
\]
so the iterated integrals of \(f(x, y)\) differ over the rectangles
\([-m, m] \times [-n, n]\). Since any rectangle \(D\) containing the
origin as an interior point must contain some smaller rectangle \(E =
[-m, m] \times [-n, n]\), the iterated integrals of \(f(x, y)\) over
\(E\) differ and therefore must also differ over \(D\).

Furthermore, since \(f(x, y)\) is even in both \(x\) and \(y\), you
can carry out a similar argument to the above with intervals of the
form \([0, m]\) or \([-m, 0]\) to show that the iterated integrals of
\(f(x, y)\) must also differ over any rectangle with the origin as a
corner.

So the essential property of \(f(x, y)\) is that slicing it along
the \(x\)-axis gives a function which has positive area under the
curve on any interval symmetric around \(0\) or with \(0\) as an
endpoint, and that slicing it similarly along the \(y\)-axis gives a
function with has negative area. Therefore, on a rectangle symmetric
around the origin or with the origin as a corner, one can choose the
sign of the iterated integral by choosing which axis to slice
first.

The next thing to investigate is how exactly the iterated integrals
of \(f(x, y)\) over the rectangle \(D\) are expressed such that they
differ only when \(D\) contains the origin, especially considering
that the \(f(x, y)\) is expressed in quite a simple form. To do that,
let's consider the simple case of a rectangle \(D = [\delta, 1] \times
[\epsilon, 1]\) where we can vary \(\delta\) and \(\epsilon\) at
will.

Using the properties of \(\mathrm{sgn}(x)\), we can simplify this to the final
expression:
\[
\Delta(\delta, \epsilon) =
\frac{\pi}{2}
\bigl( 1 - \mathrm{sgn}(\delta) \bigr) \bigl( 1 - \mathrm{sgn}(\epsilon) \bigr)
\]
which we can prove still holds if either \(\delta\) or \(\epsilon\) is
zero (or both).

So with the simplified expression for \(\Delta(\delta, \epsilon)\),
it becomes apparent how \(\mathrm{sgn}(x)\) is used to control the value of
\(\Delta(\delta, \epsilon)\); as long as either \(\delta\) or
\(\epsilon\) is positive, \(1 - \mathrm{sgn}(x)\) zeroes out the entire
expression.

[1] There are
actually wholebooks dedicated to
counterexamples. They make good bathroom reading material.
↩

[2] The vector field \((L, M)\) also serves as the
canonical “counterexample” to
the gradient
theorem. ↩