Yesterday I talked about the function . If you recall (or rather, if you don’t… if you do recall, you can probably skip to the next paragraph), I defined this function by lining up two infinite binary trees. One tree was obtained by taking mediants, giving us the Stern-Brocot tree, while the other was obtained by taking midpoints, giving us a tree of “dyadic” fractions (denominators are powers of two). To evaluate , you find in the Stern-Brocot tree, and then is the value in the corresponding position of the dyadic tree.

Instead of thinking about infinite binary trees, let us think about cutting each tree off at some level, . The pictures from yesterday’s post are, if you ignore the vertical dots, the trees when . In the dyadic tree, we will obtain all fractions where is odd and . Said another way, we will get all of the values where (not necessarily odd anymore). If you think about it for a few moments, you’ll notice that these points are equally spaced in the interval, each being away from its neighbors. This is not the case for the Stern-Brocot tree.

In the truncated Stern-Brocot tree, points are scattered through the interval (0,1). We can see that they are scattered in a way that is symmetric around 1/2, but what else can we say? Think about choosing some number, , of buckets, call them . Let collect all of the points from the truncated Stern-Brocot tree whose value lies between and . Of course, I’m being a little loose with my endpoints, but hopefully the idea comes across. If you choose an appropriate number of buckets, depending on the depth of your truncated tree, you can arrange that no point is an endpoint of a bucket’s interval.

Anyway, when you’re done with that, count how many points are in each bucket. This defines a function from the interval to non-negative integers, where the value at all points in is the count of the number of Stern-Brocot points in the bucket . Here’s an example graph, obtained by taking the depth 10 Stern-Brocot tree, and putting points into 59 buckets (unless I coded something up wrong :)):

You could next scale this graph vertically by a constant so that the total area of all of the rectangles is 1. That is, you could make the graph that of a probability distribution. Of course, the distribution you get will depend on not ony the depth of the tree, but also how many buckets you choose. Since I’m only vaguely sure what I’m talking about, let me not say much more about that.

A less graphical way to think about all of this is that, for each , I define two random variables and . The first, picks a value from all of the nodes in the Stern-Brocot tree of depth , assuming each is equally likely. The second is basically the same, using the dyadic tree instead. I’m not particularly well-versed in probability, but I guess you are allowed to take the limit of these probability distributions, let’s say , and similarly . This defines two probability functions on the interval (well, I suppose technically it probably defines a probability function on the rationals there…).

How are the two distributions related? Well, basically the same way as the trees are related by . In particular, we have

Since is just the uniform distribution (the dyadic points are equally distributed, recall), the probability on the right is just . Let be the graph of the probability function for , so that the probability on the left is the integral . We have, then

This looks so much like the fundamental theorem of calculus that we want to say that . You could also read it as saying that is the cumulative distribution function of . Thinking back to my buckets from earlier, this means that if I define the value over the interval covered by to be the sum of the counts of all the values in all the buckets up to , then I should get a graph that looks like . You be the judge:

Of course, we probably aren’t exactly allowed to say . Consider the rational , and suppose that exists, i.e., that

exists. If this two sided limit exists, then we can calculate it by coming at it from either side. Let’s think about , that is, from the right. But let’s simplify some more, still. If the one-sided limit exists, then we can calculate it by calculating the limit of the difference quotient for any sequence of values converging to . The sequence of values, on the right of , that I want to consider are those neighbors, on the right, of , in the Stern-Brocot sequences.

Let’s say that the first neighbor is the right child of in the Stern-Brocot tree, and call it . Then all of the successive neighbors are the successive left children of . These points are all of the points , for positive values . If we let , these weighted mediants converge to .

So let’s consider the following:

.

Let’s start simplifying in the denominator. That fraction is , but since and are neighbors in some Farey sequence, this difference is 1. So the denominator is .

In the numerator, we are evaluating at weighted mediants of and . The corresponding values are then weighted averages. Playing with the formulas a little bit, you can determine that

.

Combining all of the formulas so far, and simplifying, it turns out that the limit we are after is just

Of course, that power of two wins the race to infinity, and so this limit is 0.

We have shown then, that if exists, then it is 0. Since isn’t a constant graph, we better have non-zero on the irrationals. Perhaps I’ll leave that to you.

I should, of course, mention that I learned about this reading the paper “On the Minkowski measure” by Linas Vepstas, available online here (along with a handful of other papers that look fun). Hopefully I haven’t mangled anything too badly.