The function that sends fractions to binary
Worth reading first: Every rational in one sequence · The arcs a line crosses on its way to a number.
The Stern–Brocot tree between nought and one starts at , splits each interval at its mediant, and lists every fraction once. There is another tree of exactly the same shape that nobody would call surprising: start at and split each interval at its midpoint. That tree lists every binary fraction — every number with a finite binary expansion — once.
Two trees of the same shape can be laid on top of each other, node on node. Doing that defines a function.
The function that matches the Stern–Brocot tree to the binary tree is continuous and increasing, and it rises from nought to one while having slope nought at almost every point. Hermann Minkowski introduced it in 1904 and wrote it . It looks, in the figure, like a slightly wavering version of the diagonal. What it actually is, the rest of this page measures.
Two trees laid on top of each other
At depth one both trees have the single node . At depth two the Stern–Brocot tree adds and , the mediants of with and of with ; the binary tree adds and . At depth three there are four new nodes in each, and so on — nodes down to depth in both.
The function sends the $k$th Stern–Brocot node, in left-to-right order, to the $k$th binary node. So , , , . Because both trees list their nodes in increasing order, the matching preserves order, and because both sets of nodes are dense in the interval, the matching extends in exactly one way to a continuous increasing function on all of .
The figure does not compute the function by placing nodes. It computes from ’s continued fraction by a formula, at every one of the 1,023 nodes, and requires the result to equal exactly the binary fraction in that node’s position. The formula and the positions share nothing but the node, and they agree to the last bit at all of them.
From a continued fraction to binary digits
The formula comes from reading the descent’s word in two languages.
A number between nought and one has a continued fraction , and the line down to it through the Farey arcs turns left times, then right times, then left times, and so on. In the binary tree the same sequence of turns is a sequence of binary digits: left is a nought and right is a one. So the binary expansion of is noughts after the point’s first one, then ones, then noughts, alternating. Written as a sum,
For that is . For it is . The function replaces a continued fraction’s quotients by run lengths of binary digits — the same information, laid out in a different base of counting.
One fraction followed both ways makes the formula concrete. , so the formula gives . In the Stern–Brocot tree, is reached by a left turn — its first mediant is too big — then a right turn, since is too small, and then the next mediant is itself. Writing left as nought and right as one, and marking the arrival with a final one, the path reads , and in binary is . In the list of the seven nodes to depth three — — is third, and is the third binary fraction with denominator eight. Three computations, one by the continued fraction, one by the path and one by position, give the same number.
Why it is continuous and why it never stalls
The matching is defined only on the tree’s nodes, and the reason it extends to a continuous increasing function is a comparison of gaps.
At depth , two neighbouring Stern–Brocot nodes and are apart, and their images are neighbouring binary fractions exactly apart. Both gaps shrink to nought as the depth grows — the binary gaps because they halve at every level, the Stern–Brocot gaps because and both grow. So between any two nodes the function has only a small range of values it could take, and that range shrinks to a point as the nodes close in: the function is continuous.
It never stalls, either. Every interval of the unit interval, however short, contains a node of the tree, and every pair of distinct nodes is sent to distinct binary fractions. So the function takes different values at any two different points, and it is strictly increasing — it never has a flat stretch of positive length, even though, as the next sections show, it is flat in a different and much stranger sense almost everywhere.
The same comparison of gaps says where the function is steep and where it is gentle. Near a fraction with a small denominator, like , the tree’s intervals are long for their depth, so a long stretch of is squeezed into a short range of values. Deep inside a fan — near a fraction the descent reaches only after a long run of identical turns — the intervals are tiny while their images are still , and the function climbs steeply there.
Periodic in, rational out
That reading explains the strangest property of on sight.
A number has an eventually periodic binary expansion exactly when it is a fraction. A number has an eventually periodic continued fraction exactly when it is a quadratic irrational — a root of a quadratic equation with whole-number coefficients — which is Lagrange’s theorem. Since turns quotients into runs of binary digits, it turns every quadratic irrational into a fraction, and every fraction into a binary fraction.
The two examples in the figure are the simplest. has every run of length one, so its image is in binary, which is . has its image , which is . Minkowski’s reason for defining the function was exactly this: it converts one kind of number that repeats — in its continued fraction — into another kind that repeats, in its digits.
The figures compute those two values in a way that separates the two claims inside them. A double-precision number carries only about thirty-eight of ’s quotients before they turn to noise, and reading straight off the double missed by — a statement about rounding rather than about . So the figure checks on the doubles that the first twenty quotients are all ones or all twos, and evaluates on the exact periodic expansions, where it gives and to fifteen places.
The same graph inside itself
The function has two symmetries, and each is a symmetry of both trees at once.
Reflecting the Stern–Brocot tree left to right sends to ; reflecting the binary tree sends to . So . And the left half of the Stern–Brocot tree, the part below , is the whole tree carried by , while the left half of the binary tree is the whole tree carried by . So .
The two symmetries are the tree’s two ways of being made of copies of itself, one for each tree, and is the function that turns the first kind of copying into the second. The horizontal squeeze is not a linear map: it squeezes the part of the interval near nought much less than the part near one. The vertical squeeze is a plain halving. That mismatch — a curved copy on one side, a straight copy on the other — is what makes the graph waver instead of being a straight line.
A map of the interval turned into the tent
The two symmetries combine into something with dynamics in it. The Farey map sends to on the left half of the interval and to on the right half: it undoes one step of the descent, sending each node of the tree to its parent. The tent map sends to on the left half and to on the right: it undoes one step of the binary tree.
The question-mark function turns one into the other. Applying the Farey map and then gives the same result as applying and then the tent map, which follows from the two identities checked in the figures. So every orbit of the Farey map is carried by onto an orbit of the tent map, and the tent map’s orbits are read off binary digits in the way the doubling map’s orbit is its binary expansion.
That makes a dictionary between two dynamical systems that behave, as sequences of left and right, identically — and it says something sharp about how different their measurements can be. The tent map spreads the ordinary length of the interval evenly as it runs; the Farey map, measured by ordinary length, does not. The function that matches their orbits is forced to distort length at every scale, and the next section is about how far the distortion goes.
Increasing, and flat almost everywhere
The function is continuous and increasing, so it is differentiable at almost every point — every increasing function is. Raphaël Salem proved in 1943 that at almost every point its derivative is nought. A function that rises from nought to one doing all of its rising where its slope is not nought does all of it on a set of total length nought.
That is the kind of object that a lopsided mass was: a measure spread over the whole interval, in the sense that no subinterval gets nothing, and concentrated on almost none of it. The rise of over an interval is exactly such a measure, and the figure measures its concentration directly.
The pieces at depth are the intervals between neighbouring nodes, of length for neighbours and , and the figure checks that their lengths add to one. Every piece carries the same rise, but their lengths are wildly unequal — the pieces near fractions with small denominators are long, and the pieces deep inside fans of long runs are very short. Half the rise sits on the short pieces, and the short pieces get shorter faster than they get more numerous.
The fall is slow, and a picture drawn at any depth still shows a function that seems to have slopes everywhere. That is the honest limit of the evidence: the figure shows the half-rise length falling across fifteen levels of the tree, and the theorem that it tends to nought — which is what singularity means — is Salem’s.
Why the slope is nought
The reason has a rough form that explains which numbers are flat and which are steep.
Around a typical number, the interval the descent confines it to after quotients has length roughly , where is the $n$th convergent’s denominator, and Paul Lévy showed that grows geometrically for almost every number — its $n$th root settles at a fixed constant. So the interval shrinks exponentially in . The rise of over that interval is , and for almost every number the quotients have no finite average: large quotients keep appearing often enough that grows faster than any multiple of . The rise shrinks faster than any exponential in while the interval shrinks only exponentially, so the slope over those intervals falls to nought.
The numbers where is steep are the ones whose quotients stay small — , with every quotient one, is the steepest kind. Those are exactly the badly approximable numbers, the ones the descent approaches slowly, and they form a set of length nought. rises where approximation is hard and stays flat where it is easy, and since almost every number has occasional huge quotients, almost everywhere is flat.
That is also the contrast with a curve with a corner at every point. Weierstrass’s function has no slope anywhere; has a slope almost everywhere, and the slope is nought. Both are continuous, both are built from a self-similar rule, and they fail to be ordinary in opposite directions.
Where it needs care
The function is defined on the unit interval. It extends to all the reals by the same matching applied to the whole Stern–Brocot tree, and the extension is also increasing and singular; the figures draw only .
The graph is drawn from the tree’s nodes. The polyline passes through the 1,025 points at depth ten and the two ends, and between them the true function wavers in ways the line does not show. Its monotonicity is checked separately, at 400 real numbers sampled independently of the tree.
Almost everywhere is a statement about length. The derivative is not nought at every point — at points like the difference quotients grow without bound — and the set of such points, while it has length nought, is uncountable and dense.
And the concentration figures are finite. They show the half-rise length falling across the depths drawn; that it tends to nought is the theorem, not the measurement.
The flatness is finer than any drawing
The flatness cannot be seen. At the resolution of any drawing the graph of looks like a wavering diagonal with slopes everywhere, because the intervals on which it is flat are interleaved with the ones on which it rises at every scale down to the pixel. The half-rise measurement is the nearest a figure can come to showing the set where the rise happens: it cannot draw that set, but it can say how little room the rise is squeezed into.
Nor do the pictures show the matching of the two trees. The graph is the result of the matching, and the trees themselves — the Stern–Brocot tree and the binary tree — are drawn elsewhere or not at all.
Still open: a closed form for how thin the rise is
The rise of is a measure on the interval that lives on a set of length nought, and the natural question about such a measure is its dimension — how many boxes of size its mass essentially needs, in the sense of the dimension of a measure rather than of a set. John Kinney showed in 1960 that the answer is strictly less than one, and it has since been computed numerically to be about .
No closed form for that number is known. It is determined by the growth of continued-fraction quotients against the halving of the binary tree, and it can be written as a ratio of two integrals involving the distribution of quotients, but no expression for it in terms of familiar constants has been found, and none is known to exist. The measure is completely explicit and its most basic numerical invariant is known only by computation.
Matching two things of the same shape
The habit is about what a correspondence between shapes can carry.
The Stern–Brocot tree and the binary tree were built for different purposes — one to list fractions, the other to list binary numbers — and they turn out to be the same tree with different labels. Matching the labels node for node produces a function, and the function inherits everything each labelling knew: from the binary side, that repeating digits mean a fraction; from the continued-fraction side, that repeating quotients mean a quadratic irrational. The function’s surprising properties were not added; they were already present in the two labellings, and the matching lined them up.
When two structures have the same shape, the map between their labels is worth constructing even when it looks like a formality. It is a dictionary between two ways of describing the same thing, and a dictionary between languages is where a statement that is hard in one becomes obvious in the other.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Almost none of it left, and still uncountably many — both name bijection, measure, self-similarity
- A carpet with two dimensions — both name measure, self-similarity
- A staircase with no steps — both name measure, self-similarity
- A tree that holds every triple — both name bijection, stern brocot tree
- Eight rules and a triangle — both name binary, self-similarity
- Infinite on one side and nought on the other — both name measure, self-similarity
Named objects
A dashed tag is an object no other essay names yet.
BijectionBinaryContinued fractionsMeasureSelf-similarityStern brocot tree