Mathematics is the summit of everything I find wonderful about mankind. It requires the most rigorous thinking of which we are capable married to an unflinching creativity, astounding sense of space and movement, and a poetic regard for the pregnancy of words. Technically, I suppose that’s a marriage on the polygamous side, but I’m all for that too. In any case, once you get past the decade-long tutorial, learning the names and rules for all the different tools, you get to start having fun trying to Break Math. Seeing mathematicians hot on the hunt for something that will tear down a millennia-long assumption is really quite beautiful, and another example of humans just being great.

One of my favorite examples of Math Gone Mad is called (among other less whimsical names) the Popcorn Function. It goes like this:

F(x) = { 1/q if x is a rational number of the form p/q.

0 if x is irrational. }

And here is a snapshot of a part of it.

It’s popularly called the popcorn function because all of the rational x’s pop up to one over their denominator, while all of the irrationals stay stuck on the x-axis. Now, think back to your high school Pre-Calculus or Calculus class. You might remember a working definition of continuity that says, “A graph is continuous if you don’t have to lift your pencil while drawing it.” Just looking at this picture, it is hard to picture something LESS continuous-seeming.

AND YET, it turns out that this function is continuous at all irrational numbers but discontinuous at all rational numbers.

That seems a rather wildly improbable statement, and yet the proof of it is delightfully uncomplicated, and in fact is something you might want to whip out at your next cocktail party while the Catan board is getting set up. It all relies on a more rigorous definition of continuity, known as the ε-δ definition. Just written out, it looks horrid:

“A function f(x) is continuous at x=a if, for any ε > 0, there exists a δ > 0 such that if |x-a| < δ, then |f(x) – f(a) | < ε.”

When I introduce this to my calculus students, there is usually a fair amount of rending of clothing and gnashing of teeth, but the idea is actually very simple: “If two x values, let’s say a and b, are close to each other, then f(a) and f(b) should be close to each other too.” It’s the pencil requirement written mathematically – to move right a little bit while drawing my curve I shouldn’t have to move up or down very far.

So, to prove that something is continuous, I have to show that, for any value of epsilon (ε), no matter how small, I can find a neighborhood of x values around x=a that all end up within ε of f(a). Alternately, to prove that a function is NOT continuous at x=a I just need to produce a value of ε for which it is impossible to find such a neighborhood around x=a.

Now, I said that the Popcorn Function is continuous at every irrational number and discontinuous at every rational number. Let’s start with the easy part, proving that the rationals are discontinuous. To do it, I’m going to use a smashing attribute of the number line – that the irrationals and rationals are “dense.” That means that, no matter how small a step I take from a rational number, I’m going to cross infinitely many irrationals, and no matter how small a step I take from an irrational number, I’m going to cross an infinite number of rational numbers along the way. Any neighborhood, no matter how small, of any number will contain infinitely many other irrational and rational numbers. There is just as much richness to contemplate from 0 to 1 as from negative infinity to positive infinity.

So, let’s say that my “a” value is rational, so f(a) = 1/a. I’m going to choose 1/2a as my ε value. Now, no matter what value of delta I choose, there are going to be infinitely many irrational x-values within that neighborhood of a, all with a function value of 0. So, |f(x)-f(a)| for those irrational x’s will equal 1/a, which is more than our ε value. So, not all points within any delta of a will end up within ε of f(a), so the function is not continuous at x=a if a is rational. Neat!

But we have barely begun to climb Mt. Nifty. Now, suppose a is irrational (so, f(a) = 0), and that I choose some random, rational value for ε (if the fact that I’m limiting ε to rational numbers disturbs you, good, but if you really want to use an irrational ε, I can always find a rational one both smaller than it but still positive, and use *that *ε for the proof). Epsilon, being rational, has an integer denominator, let’s call it q. So, all I need to do is find a delta neighborhood around “a” that definitely does not contain any x values with a denominator smaller than q.

And, it turns out, I can do that. Think about it. Let’s say my “a” is equal to 2 point something something something. Now, between 2 and 3 there is only one reduced fraction with denominator equal to 2 (namely, 5/2), only 2 with denominator equal to 3 (7/3 and 8/3), only 2 with denominator equal to 4 (9/4, and 11/4), and so on. The point being, that no matter how big q (the denominator of my original ε) is, there are only a finite number of rational values around a with a smaller denominator. Since there are only finitely many, one of them will be CLOSEST to “a”. If I choose my delta just smaller than that distance, I am absolutely guaranteed that no x value within that delta neighborhood will have a denominator smaller than q, and as such, f(x) will always be less than ε, and so, at x=a, the function is continuous!!

And one more ! for good measure.

So, in spite of the fact that there are infinitely many places where this function is hopping up off the number line, it is actually, technically, continuous at every single irrational number. What’s even weirder is that, and here I’m going to turn to the calculus-remembering folk for a bit, this function is actually integrable too, since its set of discontinuities, the rational numbers, is countable! *Electric Air Guitar Riff!*

Wrapped up in this one function is a large part of all my favorite stuff about math and about the humans who make it. There are some spectacularly clean definitions that have been seized upon by some wonderfully playful minds to create an object that breaks every bond of common sense. It’s the same process or rules-brokered explosive creativity you see in Beethoven’s Third Symphony, or the perspective tinkering of a Braque canvas, only rendered, at least for me, several orders of magnitude more exciting by virtue of being so ethereal, so elusively abstract.

It’s like I always say: If you love poetry, you’ll love math more. Eventually.

FURTHER READING: If you liked that function, there are tons of other such to be had out there. A great place to start is Bernard Gelbaum and John Olmsted’s *Counterexamples in Analysis*, which is a book of nothing but dastardly clever things that seem to defy common sense. To get most of it, though, requires something of a background in Real Analysis, for which Charles Pugh’s *Real Mathematical Analysis* is a great starting point that just about anybody can dive into right away!