 # Thomae's function and continuity

Thomae’s function is similar to the Dirichlet function. But, while the Dirichlet function is nowhere continuous, Thomae’s function is continuous at the irrational numbers.

The thing is, I just can’t figure out how this is possible. Dirichlet’s function is nowhere continuous because it has different values for rational and irrational numbers, and there is always a rational between any two irrationals and an irrational between any two rationals. How, then, is Thomae’s function continuous at the irrationals when there is always a rational in between?

The key here is, of course, that you need a rigorous definition of continuity. You can look up the rigorous definition yourself, but it’d probably make a non-mathematician fall asleep. So I’ll re-cast it, as a game.

We have a function, y = f(x). And in any interval of x values of that function, there’s going to be some range of y values. We can specify those ranges as x ± Δx (that is, all of the x values within Δx of x), and y ± Δy (that is, all of the y values lie within at most Δy from y).

So, the game goes like this: You specify some maximum acceptable Δy (greater than zero), as a challenge. And then I have to meet that challenge, by specifying some Δx, such that I can always meet that challenge. If I can’t meet the challenge, then you win: You’ve proven that the function is discontinuous. If I can meet the challenge, then you’re allowed to issue another, more difficult challenge, with a smaller Δy. If, no matter what (greater than 0) Δy you pick, I’m always able to answer your challenge, then I win, and I’ve proven the function continuous.

Let’s see some simple examples. Suppose that our function is a nice simple y=x. Well, that’s an easy one for me: When you pick a Δy, I answer your challenge with the same number as my Δx. Since I can always answer your challenge, I win, and f(x) = x is continuous.

Another obvious one, the Heaviside function y = {0 if x <0, 1 if x ≥ 0 }. If our x value is 0, then you can win easily by picking any Δy less than 1 (say, 1/2): No matter how small I make my Δx, I’m going to include some negative numbers, for which f(x) = 1, so the Δy will always be 1. Since I can’t meet your challenge, you win, and prove that Heaviside is discontinuous.

OK, so now let’s look back to Thomae’s function. If we’re looking at it at some rational value of x, that is, x = p/q, then f(x) = 1/q. So all you have to do for your challenge is to pick some number smaller than 1/q. No matter how small I make my Δx, there will always be some irrational numbers in my interval (for which the function is zero), so my Δy will always be 1/q, which is larger than your challenge. I can’t meet your challenge, so you win, and so Thomae’s function is discontinuous at every irrational.

But now suppose that we’re playing at some irrational value. You set your challenge at some number, let’s call it epsilon. It’s a small number, but it’s not zero, and so 1/epsilon is finite. There are a finite number of positive integers q smaller than 1/epsilon, and so a finite number of fractions p/q (with q smaller than 1/epsilon) near our x. Since there are a finite number of such fractions, one of them must be the closest one to our x: It might be very close indeed, but it can’t be right on top of x, because we picked an x that was irrational. So I can certainly find some Δx small enough to exclude that fraction (and hence, all of the more distant ones as well). So all of the numbers within Δx of x will be less than epsilon, and so I can meet your challenge. And since I can always meet your challenge, I win, and I prove that Thomae’s function is continuous at every irrational value of x.

You need rational numbers with an increasingly large denominator to approximate an irrational number. For example you cannot do better than to expand your number into an infinite continued fraction. More refinedly than rational vs irrational, how well a number can be approximated by fractions of a given-sized denominator determines its degree of irrationality, so rational numbers have measure of irrationality 1 while most numbers have irrationality measure 2 (the error scales like the square of the denominator of the approximants), and on the other hand there are Liouville numbers which can be so closely approximated by rationals that they have infinite irrationality measure.

Think of it like this. If you take a tiny interval around an irrational number, then every rational number in that interval will have a large denominator and hence the value of that function will be very small.

That is a qualitative description of what happens. Plug in the formal definition of continuity and it becomes quantitative. The crucial fact is that there are (relatively) few rationals with small denominator.

Whoops! As soon as you bring epsilon into the picture, it’s suddenly all Greek!

Might as well just go whole-hog Greek and tell us that:

limx→c f(x) → L
means:
∀ ε>0, ∃ δ>0 : 0 < | x−c | < δ ⇒ | f(x)−L | < ε

That will make non-mathematicians and mathematicians alike fall asleep ever-so-much more efficiently!

If you click on the link in the OP, it goes quite explicitly through all that. More importantly, besides explaining how such a function can be continuous only at irrational numbers, as summarized in this thread, it explains why there is no function continuous at rational numbers but discontinuous at irrationals, for instance.

Perhaps a simpler example: Take the Dirlichet function, and multiply it by some nice simple continuous function, like f(x) = x. That’ll give you a function that’s continuous nowhere except at the places where your continuous function has roots (i.e., for x*Dirlichet(x), at x=0). That’s because at any point x near 0, f(x) will be close to f(0).

Wow, I know that function, but didn’t know it had a name; I simply described it by its behavior. I came across it in grad school while studying superconductor arrays in a magnetic field. Because of the quantization of the magnetic flux, several bulk properties (like current and voltage) would be proportional to Thomae’s function over the appropriately normalized field strength.

It was one of those fun science things where you find something unexpected in your data (spikes in an otherwise smooth curve) and then figure out what was happening (magnetic flux quanta).

Could you expand on that a little? It’s hard for me to comprehend a real, physical entity having properties that differ at rational points vs. irrational points. It seems to me that quantization would obscure any way to distinguish a point with rational coordinates from a point with irrational coordinates.

The intensity of the magnetic field through a superconducting loop is quantized, because phase of the super-conducting charge carriers in that loop must be continuous. (This is similar to why electronic orbitals are quantized.)

Now take a tiled array of superconducting loops and apply a low magnetic field to it. Each individual loop will either have one or none flux quanta through it, but the average flux over the entire array will match the field. If that average is a multiple of the flux quantum, then a stable flux lattice will form. If it’s not a multiple, then the flux stays disordered.

To visualize, imagine a checkerboard where each square is a superconducting loop and each checker is a flux quantum. If you set the magnetic field to zero, the stable solution is no checkers. If you set it to one, the solution is a checker on every square. If you set it to one-half, you put a checker on every space of the same color (there’s superposition of states going on, but let’s ignore that). The repeatable pattern is a two-square by two-square box with two checkers (2/4 = 1/2).

If we set the magnetic field to one-third, the repeatable pattern will be a three-square by three-square box (3/9 = 1/3). The pattern size is the same for a two-thirds field (6/9 = 2/3). For a field of rational strength p/q, the pattern is a q-by-q box. For a field of irrational strength, there is no stable pattern that satisfies the conditions.

Many of the bulk properties of the array depend on the size of that box; that is, how many loops need to stay locally coherent in order to match the magnetic field condition. A small size is more stable because the fewer loops are involved, and a large size is less stable because more loops have to stay “synchronized”. In fact, the stability is proportional to 1/q. Irrational fields have 0 stability.

Too long, didn’t read: the rational vs irrational comes from the array preferring to have a fraction (with a smaller denominator) of its loops with a flux quantum.

(Apologies; this is from research I did last century and haven’t revisited. Note that this behavior is different than bulk superconductors.)

Another way to think about it, is that the Thoma function is almost all zero or very close to zero. For any arbitrarily small number there are only a finite number of points that are larger than that. So you can always find gaps between those points where the function is very flat.