
In the world of mathematics, some of the simplest rules can create objects of astonishing complexity, challenging our fundamental intuitions. Thomae's function, also known as the popcorn or raindrop function, is a prime example. Defined with simple fractional logic, it behaves in ways that seem to defy the standard properties of functions we first learn. This article addresses the gap between our intuitive understanding of concepts like continuity and integration and the rigorous, often surprising, reality revealed by mathematical analysis. The reader will embark on a journey through the paradoxical nature of this function. The first chapter, "Principles and Mechanisms," will dissect the function's core properties, revealing why it is continuous at every irrational number and discontinuous at every rational one, and how, despite this, its integral vanishes. The second chapter, "Applications and Interdisciplinary Connections," will showcase the function's role as a sophisticated tool for testing concepts in modern analysis, from Fourier series to weak derivatives. Through this exploration, Thomae's function is revealed not as a mere curiosity, but as a profound teacher.
Imagine trying to draw a picture of the numbers. On a line, you place the integers: 0, 1, 2, and so on. Then you fill in the fractions, the rational numbers. You quickly realize they are everywhere; between any two, you can always find another. This dense cloud of points seems to fill the line completely. But then come the irrationals, numbers like and , which cannot be written as fractions. It turns out there are vastly more of these, filling in all the remaining gaps.
Now, let's try to attach a value to each of these points, to build a function. What if we assigned a value based on a number's "simplicity"? Let's say that for any irrational number , the value of our function is zero. They are, in a sense, the foundation. For a rational number , written in its simplest form (like instead of ), let's say the value of our function is . This is Thomae's function, though you might prefer to call it the popcorn function. If you try to graph it, you see something remarkable. At (which we can write as ) and (as ), the function value is . At , it's . At and , it's . As the denominator gets bigger, the value gets smaller. The graph looks like a burst of popcorn, with a few large kernels at the top and a dense cloud of smaller ones settling toward the x-axis, where the irrationals lie flat at zero.
This simple set of rules creates a mathematical object of astonishing complexity, a little "monster" that challenges our deepest intuitions about how functions ought to behave. By studying it, we can learn a tremendous amount about the very fabric of the number line and the core ideas of calculus.
The first, most natural question to ask about any function is: where is it continuous? A function is continuous at a point if, as you get closer and closer to that point, the function's value gets closer and closer to the value at that point. There are no sudden jumps or breaks.
Let's first look at a rational number, say . The function's value is . But no matter how tightly you zoom in on , your tiny window will always contain irrational numbers. At every one of those irrational numbers, the function's value is 0. So, you have a point at a height of , surrounded by a dense sea of points at a height of 0. This is the very definition of a discontinuity! The function makes a sudden jump. In fact, we can be more precise: as you approach any rational number , you'll always be able to find a sequence of irrationals getting closer and closer, where the function's value is always 0. This tells us that the limit of the function as we approach any point—rational or irrational—must be 0. But at the rational point , the function's value is . Since the limit (0) does not equal the function's value (), the function is discontinuous at every single rational number.
Now for the real surprise. What happens at an irrational number, say ? Here, the function's value is . For the function to be continuous here, the values of the function near must approach 0. Let's think about what it means for a number to be "near" . If we pick a rational number that is very, very close to , what can we say about it? It can't be a simple fraction like or . To get a really good approximation of an irrational number, you need a fraction with a very large denominator. For instance, is a better approximation of than . The closer you want your fraction to be to , the larger its denominator must become.
And that is the whole secret! If a rational number is close to our irrational point , its denominator must be large. But if is large, the function's value, , is small. Thus, as you move closer to any irrational number, the "popcorn" points around it are forced to lie closer and closer to the x-axis. The function's values smoothly approach 0, which is precisely the value of the function at the irrational point. And so, in a beautiful paradox, Thomae's function is continuous at every irrational number and discontinuous at every rational number.
Our next challenge is to find the area under this curve between, say, 0 and 1. This seems like a nightmare. The function has infinitely many discontinuities! Our intuition from introductory calculus might scream that such a function cannot be Riemann integrable. But let's follow the procedure.
The Riemann integral is defined by squeezing the area between two estimates: an upper sum and a lower sum. To find the lower sum, we slice the interval into thin vertical columns. In each column, we take the lowest value the function reaches and use that as the height of our rectangle. For Thomae's function, every interval, no matter how tiny, contains an irrational number. And at every irrational number, . So, the minimum value in every single column is 0. The lower sum is therefore always 0, no matter how we partition the interval.
The clever part is the upper sum. Here, we use the highest value in each column. This seems problematic, as some values are as high as 1. But let's be strategic. The points where the function has a large value are rare. For any given positive number , say , the set of points where is the set of rationals with . This is a finite set of points! There are only so many fractions with denominators of 100 or less. We can trap these few "high-value" points inside a collection of incredibly thin columns. We can make the total width of these columns as small as we want—let's say their total width is less than some tiny number. Their contribution to the total area will be (height) (tiny width), which is a very small number.
What about the rest of the interval? In all the other columns, which make up the vast majority of the interval , every point has a function value . The contribution to the area from this part is (height less than ) (total width less than 1), which is also a very small number.
By making our choice of smaller and smaller, we can shrink the total area of the upper-sum rectangles, squeezing it down toward 0. Since the upper sum can be made arbitrarily close to 0 and the lower sum is always 0, they meet! The Riemann integral exists, and its value is 0.
There is a more modern, and I must say more powerful, way to see this: Lebesgue integration. This theory introduces the concept of a set's "measure". A set has measure zero if it is negligibly small, even if it has infinitely many points. A countable set of points, like the rational numbers, has measure zero. Thomae's function is non-zero only on the set of rational numbers. Therefore, it is said to be equal to the zero function almost everywhere. The Lebesgue integral is wise to this; it knows that sets of measure zero don't contribute to the total area. It sees Thomae's function, sees the zero function, and declares them to be the same for the purposes of integration. Since the integral of the zero function is 0, the Lebesgue integral of Thomae's function is also 0. It's a remarkably elegant shortcut.
So, this function is continuous in some places, discontinuous in others, yet its integral is perfectly well-behaved. What other roles can it play? It turns out that Thomae's function is a perfect test case for pushing the boundaries of what we know.
One of the cornerstones of calculus is the Fundamental Theorem, which links differentiation and integration. If we integrate a function to get a new function , then the derivative of should give us back . We know the integral of Thomae's function is 0 for any interval, so for all . The derivative of is then . So, wherever , which is at all the irrational numbers. The theorem holds true "almost everywhere".
But does this mean Thomae's function could be the derivative of some other function? The answer is a resounding no! There is a beautiful result called Darboux's Theorem, which states that any function that is a derivative must satisfy the intermediate value property. This means that if the derivative takes on two different values, it must also take on every value in between. A derivative can't skip values. But our popcorn function is full of gaps! It has a value of and a value of , but it never takes on a value like or , because these are not of the form . By failing to have the intermediate value property, Thomae's function proves it can never be the derivative of any function, period.
Finally, let's ask how "wiggly" this function is. We can measure a function's "wiggleness" by its total variation—the total vertical distance its graph travels as we move from one end of an interval to the other. For a simple function like , the total variation is just the rise. But for Thomae's function, we can create a path that zig-zags between the rational points and the irrational points. For each rational we visit, we add at least to our total vertical travel (once up from 0 to , and once back down). By choosing to visit a sequence of rationals whose denominators give a divergent sum (like the primes), we find that this total travel is infinite. The function is of unbounded variation; it is infinitely "spiky".
From a simple rule—value is zero or one over the denominator—emerges a world of complexity. Thomae's function is not just a mathematical curiosity. It is a teacher. It forces us to be precise in our definitions of continuity and integration. It reveals deeper truths about the nature of derivatives. It shows us that the world of functions is far richer and more surprising than we might first imagine, and in understanding such "monsters", we gain a far deeper appreciation for the beautiful and unified structure of analysis.
After our journey through the looking-glass world of Thomae's function, one might be tempted to dismiss it as a mere curiosity. It’s a function that’s continuous at every irrational number but discontinuous at every rational one—a strange beast, to be sure. Is it just a "monster," as mathematicians of the past might have called such counter-intuitive objects, designed to challenge students and fill the pages of textbooks with esoteric examples? Or does it serve a higher purpose? The delightful answer is that this function is not a monster at all; it is a masterful teaching tool, a perfectly crafted instrument for probing the very foundations of mathematical analysis. Its peculiar properties make it an ideal specimen for testing the limits of our concepts of continuity, integration, and even the abstract machinery of modern mathematics.
At its core, analysis is the science of limits and continuity. Thomae's function, which we will denote as , provides a wonderfully clear window into these ideas. We learned that its continuity hinges on its value approaching zero, which it only equals at the irrational numbers. What happens if we play with it a little? Suppose we shift the function, creating a new one like for some constant . If is a rational number, like , then is rational if and only if is rational. The entire landscape of rational and irrational points is simply shifted, but their fundamental nature is unchanged. Consequently, the continuity profile of the function remains exactly the same—continuous on the irrationals, discontinuous on the rationals. This simple exercise reinforces a deep truth: the continuity of Thomae's function is intrinsically tied not to the location of a point, but to its fundamental character as a rational or irrational number.
But we can do more than just shift the function; we can actively try to "tame" its wild discontinuities. Imagine we construct a new function by multiplying by a carefully chosen factor, for instance, , where is some non-zero rational number. At , jumps up to a value of , creating a discontinuity. However, our new function has a clever built-in feature: the term becomes zero precisely at the point of the troublesome spike. As gets closer and closer to , the factor shrinks, effectively "squeezing" the value of down to zero, regardless of the jumps of . The result? The discontinuity is healed! The new function becomes continuous at . This is a beautiful, tangible demonstration of a powerful analytical technique and the squeeze theorem, showing how discontinuities can be "repaired" or smoothed over.
Having seen how to tame the function, a curious mind might ask: what if we do the opposite? What if we amplify its strangeness? A fascinating way to do this is to compose the function with itself, creating . At first glance, the outcome is far from obvious. But a moment's thought reveals a remarkable outcome. If is irrational, , so . If is rational, , so . The resulting function, , is 1 for all irrationals and for all rationals . This function is discontinuous everywhere. At any irrational number, the function value is 1, but it is surrounded by rationals where the function's value approaches 0. At any rational number, the function is surrounded by irrationals where the value is 1. Thus, no point can satisfy the definition of continuity. The astonishing result is that this new composite function, built from a function that was continuous almost everywhere, is now continuous nowhere. By turning the function back on itself, we've created a landscape of pure, unadulterated discontinuity.
One of the great triumphs of calculus is its ability to measure area. So, what is the area under the "curve" of Thomae's function on an interval like ? This question forces us to confront the very meaning of an integral. The graph consists of a dense "dusting" of points, with spikes at every rational number.
The Riemann integral, which you first learn in calculus, thinks by slicing the area into thin vertical rectangles. For Thomae's function, any slice, no matter how thin, will contain irrational numbers where . So the "lower sum," the sum of the areas of rectangles that fit entirely underneath the graph, is always zero. The difficulty is with the "upper sum," which must account for the spikes. Here, a beautiful idea emerges. The function's values are mostly very small. The spikes with large values, say for some tiny , are few and far between. Specifically, if , then the denominator must be less than . For any given , there is only a finite number of such denominators, and thus only a finite number of "problematic" rational points in our interval. We can trap each of these few, large spikes inside incredibly thin rectangles whose total area is as small as we wish. The rest of the infinitely many spikes are already smaller than . By making our rectangles thin enough, we can make the total upper sum arbitrarily close to zero. Since the integral must lie between the lower sum (0) and the upper sum (arbitrarily close to 0), the Riemann integral of Thomae's function must be exactly 0.
This is a remarkable result, but the story gets even better with the Lebesgue integral, a more modern and powerful concept. The Lebesgue approach doesn't slice the x-axis; it slices the y-axis. It asks, "For a given value , how large is the set of points where the function has that value?" For Thomae's function, the answer is profound. The function is non-zero only on the set of rational numbers. In the language of measure theory, the set of rational numbers is "countable" and has a "measure" (a generalized notion of length) of zero. This means that Thomae's function is equal to the zero function almost everywhere. From the powerful perspective of Lebesgue integration, if two functions are the same almost everywhere, their integrals are identical. Since the integral of the zero function is 0, the Lebesgue integral of Thomae's function must also be 0. This gives us a stunningly swift and elegant confirmation of the Riemann result, and it highlights a fundamental philosophical shift: Lebesgue integration focuses on the overall structure of a function, ignoring behavior on negligibly small sets. The area under the graph of Thomae's function is zero.
The utility of Thomae's function does not end with 19th-century analysis. It continues to provide insight and clarity in surprisingly diverse and modern fields of mathematics, demonstrating the beautiful unity of the subject.
Consider Fourier analysis, the art of decomposing a function into a sum of simple sine and cosine waves, much like decomposing a musical chord into its constituent notes. The set of coefficients in this sum—the Fourier series—tells us the "strength" of each frequency in the function. To find these coefficients, we must integrate the function multiplied by a sine or cosine. But as we just learned, the integral of Thomae's function, or Thomae's function multiplied by any bounded function, is zero. This leads to a startling conclusion: all of the Fourier coefficients for Thomae's function are zero. Its Fourier series is simply for all . Think about what this means. The function is not the zero function; it has spikes all over the place. Yet, its Fourier representation is completely flat. This illustrates a crucial feature of Fourier analysis: the series represents the "almost everywhere" behavior of the function. The isolated spikes at the rational numbers, being a set of measure zero, are completely invisible to the Fourier transform. You cannot "hear" the rationals.
This theme of ignoring sets of measure zero finds another powerful expression in the theory of partial differential equations and functional analysis. Many equations from physics and engineering have solutions that are not smooth or "well-behaved." To handle them, mathematicians developed the idea of a "weak derivative." It's a way of defining a derivative for non-smooth functions by looking at how they behave on average, by integrating them against very smooth "test" functions. So, what is the weak derivative of the spiky Thomae's function? If we use the definition, we again find that the crucial integral term vanishes because almost everywhere. This implies that the weak derivative of Thomae's function is nothing other than the zero function. Intuitively, if you were to "blur" your vision (the mathematical equivalent of integrating against a smooth function), the infinitely thin spikes of Thomae's function would simply disappear, leaving you with a flat line at zero.
As a final, spectacular example of the function's explanatory power, consider its interaction with another famous mathematical "monster": the Cantor function, . The Cantor function is a continuous, non-decreasing function that manages to climb from 0 to 1 while having a derivative that is zero almost everywhere. The associated measure generated by this function, , lives entirely on the Cantor set—a strange, fractal "dust" of irrational numbers. Now, what happens if we try to integrate Thomae's function with respect to this Cantor measure, to compute ? We are measuring a function that "lives" on the rationals using a ruler that "lives" on the Cantor set of irrationals. The two sets are completely disjoint. Thomae's function is zero everywhere the Cantor measure is non-zero, and the Cantor measure is zero everywhere Thomae's function is non-zero. They are like ghosts from different dimensions, passing through each other without interaction. The result, inevitably, is that the integral is zero. This elegant result is not just a computational trick; it is a profound demonstration of how the structure of functions and measures can interlock in beautiful and unexpected ways.
From a simple rule about fractions, Thomae's function blossoms into a rich and multifaceted object. It is no monster, but a guide. It patiently teaches us the subtleties of continuity, reveals the philosophical differences between our theories of integration, and resonates through the halls of modern analysis. It shows us that in mathematics, even the strangest-looking objects can be sources of deep insight and unifying beauty.