Billiards on pythagorean triples and their Minkowski functions

It has long been known that the set of primitive pythagorean triples can be enumerated by descending certain ternary trees. We unify these treatments by considering hyperbolic billiard tables in the Poincare disk model. Our tables have m>=3 ideal vertices, and are subject to the restriction that reflections in the table walls are induced by matrices in the triangle group PSU^\pm_{1,1}\Zbb[i]. The resulting billiard map \tilde B acts on the de Sitter space x_1^2+x_2^2-x_3^2=1, and has a natural factor B on the unit circle, the pythagorean triples appearing as the B-preimages of fixed points. We compute the invariant densities of these maps, and prove the Lagrange and Galois theorems: A complex number of unit modulus has a preperiodic (purely periodic) B-orbit precisely when it is quadratic (and isolated from its conjugate by a billiard wall) over Q(i). Each B as above is a (m-1)-to-1 orientation-reversing covering map of the circle, a property shared by the group character T(z)=z^{-(m-1)}. We prove that there exists a homeomorphism Phi, unique up to postcomposition with elements in a dihedral group, that conjugates B with T; in particular Phi -- whose prototype is the classical Minkowski question mark function -- establishes a bijection between the set of points of degree<=2 over Q(i) and the torsion subgroup of the circle. We provide an explicit formula for Phi, and prove that Phi is singular and Holder continuous with exponent log(m-1) divided by the maximal periodic mean free path in the associated billiard table.


Introduction
Rational points in the real projective line P 1 R involve two integers, a numerator and a denominator; we can enumerate them by reversing the euclidean algorithm or -equivalently-taking inverse branches of continued fraction maps. Rational points in the unit circle S 1 involve three integers, the two legs and the hypotenuse of a pythagorean triangle. As the line and the circle can be mutually parametrized with preservation of rational points, the complexity of the enumeration is the same, and there is a line of work (starting from [6], and running through [4], [11], [3], [33], [15] and references therein) describing how pythagorean triples can be generated by descending trees.
Ascending the same trees amounts to iterating continued fraction maps, and in [42] Romik analyzes one such map, relating it to the geodesic flow on the threepunctured sphere. It turns out that Romik's map can also be seen as the Gauss map of even continued fractions; see [2, §4], [15, §5], [7, §2] for various developments.
Although there is a birational bijection with rational coefficients between the line and the circle, continued fraction maps on the two spaces are not exactly the same thing. Indeed, the rational symmetry group of the projective line is the extended modular group PSL ± 2 Z, while that of the circle is SO 2,1 Z, the stabilizer of the Lorentz form inside SL 3 Z. When embedded in a larger ambient group -say PSL ± 2 R-they appear as the (2, 3, ∞) and the (2, 4, ∞) extended triangle groups, and neither is a subgroup of the other (of course, they are commensurable).
In this paper we develop continued fraction maps (of the "slow" type, that is with parabolic fixed points) directly on the circle, as factors of billiard maps determined by ideal polygons in the hyperbolic plane. We summarize our main results as follows: • Let D be a polygon in the Poincaré disk having m ≥ 3 vertices, all at the boundary at infinity S 1 . Let B : S 1 → S 1 be the map that sends the interval between two vertices to the union of the remaining intervals via reflection in the corresponding polygon side. Let T be the group character z → z −(m−1) . Then B and T are conjugate by an essentially unique homeomorphism Φ, which provides a bijection between the set of points of degree at most 2 over Q(i) and the torsion subgroup of S 1 . The homeomorphism Φ is singular and Hölder continuous, of exponent log(m − 1) divided by the maximal mean free path (see Definition 10.3) of periodic trajectories in the hyperbolic billiard determined by D.
The route leading to the above statement is somehow long; we offer two justifications.
(1) The end result is a flexible and applicable tool. Indeed, the maximal mean free path referred to above equals twice the logarithm of the joint spectral radius of the set Σ of matrices expressing reflections in the billiard walls. When the vertices of D determine a unimodular partition of S 1 (an arithmetical condition explained in §5), this joint spectral radius can often be explicitly computed; see Example 10.6. (2) Along that route we encounter fair landscapes.
We describe our route: in §2 we determine finite sets of reflections generating the orthogonal group O 2,1 Z and its subgroups SO 2,1 Z and O ↑ 2,1 Z, the latter being the stabilizer of the upper sheet of the hyperboloid x 2 1 + x 2 2 − x 2 3 = −1. Then, as a warmup, in §3 we review the construction of the Romik map using our formalism. In §4 we provide explicit PSL ± 2 R-equivariant bijections between the homogeneous space PSL 2 R/{diagonal matrices}, the de Sitter space x 2 1 + x 2 2 − x 2 3 = 1, the space of oriented geodesics in the hyperbolic plane, and that of quadratic forms of discriminant 1. These correspondences are known, but since they appear scattered in the literature and some care is required to extend the acting group from the usual PSL 2 R to the full PSL ± 2 R, our brief self-contained treatment in Theorem 4.1 may have some value. In §5 we treat unimodular partitions of the circle; a reader not interested in arithmetical issues may safely skip Theorems 5.3 and 5.5.
The preliminaries being over, we introduce in §6 our continued fraction maps B as factors of billiard maps B associated to ideal polygons whose vertices form a unimodular partition of the circle. Reflections in the table walls are expressed by elements of PSU ± 1,1 Z[i] -which we naturally take as matrices-in the Poincaré model, and by matrices in O ↑ 2,1 Z in the Klein model. Here the de Sitter space plays a twofold rôle, as the phase space of B as well as the space of shrinking intervals, this double nature being reflected in a double action of PSL ± 2 R; see Remark 5.2.
In §7 we use the bijections in §4 to characterize the natural extension and the absolutely continuous invariant measure of B. In §8 we show that the map B and the extended fuchsian group generated by Σ are orbit-equivalent, and prove the following statement, which combines the classical Lagrange and Galois theorems. A complex number of unit modulus is quadratic over Q(i) if and only if its B-orbit is eventually periodic; moreover, if this is the case, then the conjugate point has the reverse period, and the two points are purely periodic precisely when they are separated by a billiard wall. In §9 we introduce the conjugacy alluded to above. It is a natural conjugacy; indeed, B is an (m−1)-to-1 orientation-reversing covering map of the circle, a topological property shared by precisely one group character, namely T (z) = z −(m−1) . We thus have a "linearized" version of a continued fraction map, precisely as the tent map on [0, 1] is a linearized version of the Farey map. It turns out (Lemma 9.3) that the natural symbolic coding of points via B, as well as the analogous coding via T , characterizes the ternary betweenness relation on the circle. Since the latter relation determines the circle topology, we obtain in Theorem 9.2 that B and T are conjugate by a homeomorphism Φ, unique up to postcomposition with elements of the dihedral group with 2m elements. This homeomorphism is the analogue of the classical Minkowski question mark function [19], [43], [27], which conjugates the Farey map with the tent map. We provide in Theorem 9.4 an explicit expression for Φ analogous to the Denjoy-Salem formula [43, p. 436] for the question mark function, and show in Examples 8.4 and 9.5 how the arithmetic properties of B and T are intertwined by Φ. In Theorem 10.1 we provide an ergodic-theoretic proof of the fact that Φ has zero derivative at Lebesgue-all points.
In the final Theorem 10.5 we complete the proof of the connection sketched above between the joint spectral radius of Σ and the Hölder exponent of Φ. In all instances we examined the Lagarias-Wang finiteness conjecture ( [31], see §10) turned out to be true for Σ, and a maximizing periodic billiard trajectory was easily guessed and verified. It is plausible that the conjecture holds for all billiard tables determined by unimodular partitions of the circle, and we leave this as an interesting open problem.

Notation and preliminaries
Since we treat various spaces of matrices, we will distinguish them notationally, by using boldface for 3 × 3 matrices and lightface for 2 × 2 ones. Points in R 3 are written in boldface and are always column vectors, although we may write x = (x 1 , x 2 , x 3 ) for typographical reasons. We will use square or round brackets for vectors and matrices, according whether we are in a projective setting (that is, up to multiplication by nonzero scalars) or in a linear-algebra one. Zero entries in matrices are replaced by blank spaces. Let  2 3 }, and the Poincaré disk D = {z ∈ C : |z| < 1}; we refer the reader to [10] for an enjoyable introduction to hyperbolic geometry. We need explicit bijections between these models, so we introduce a fifth auxiliary model, namely the upper hemisphere • µ is the stereographic projection through (0, 1, 0) to the halfplane {x 2 = 0, x 3 > 0}, followed by the obvious identification of the latter with H, • τ is the stereographic projection through (0, 0, −1) to the disk {x 2 1 + x 2 2 < 1, x 3 = 0}, followed by the obvious identification of the latter with D, ∈ PSL 2 C (as customary, we blur the distinction between matrices and the maps they induce). These correspondences extend to the respective ideal boundaries.
Proof. The proof reduces to a commentary on the figure on page 70 of [10]. The upper-left triangle commutes because υ • π sends x = (x 1 , The lower-right triangle commutes because, given y ∈ J , The fact that these correspondences extend to the ideal boundaries is obvious as soon as the boundary ∂L of L and the maps π, τ 0 , η on it are properly defined. We see ∂L as the intersection of the projective closure of L ∪ (−L) (i.e., the variety with the plane at infinity x 4 = 0, and we set We can then view [x 1 , x 2 , x 3 , 0] ∈ ∂L as the limit (in the euclidean metric of an appropriate local chart) of x(t) = t x 1 , x 2 , (x 2 1 + x 2 2 + 1/t 2 ) 1/2 ∈ L, for t → +∞.
It is well known that the orthogonal group O 2,1 R of the Lorentz form has four connected components, namely the component of the identity (which is a normal subgroup) and its cosets with respect to the diagonal matrices having diagonal entries (−1, 1, 1), (1, 1, −1), (−1, 1, −1). The union of the component of the identity with its (−1, 1, −1)-coset is the special orthogonal group SO 2,1 R, while its union with the (−1, 1, 1)-coset is the group O ↑ 2,1 R of all matrices that preserve L; We construct an isomorphic representation PSL ± 2 R → O ↑ 2,1 R by identifying the vector w = (w 1 , w 2 , w 3 ) ∈ R 3 with the matrix This is a well defined action, independent from the lift of A to SL ± 2 R, linear, and preserving the form w, w = − det W . Computing the images of the 1-parameter subgroups in the Iwasawa decomposition of PSL 2 R provides a geometric picture of the representation, namely (2.2) Convention 2.2. In order to simplify notation we adopt the convention that, whenever a matrix in PSL ± 2 R is denoted by a certain capital letter, then its image under the above representation, and its C-conjugate, are denoted by the same capital letter in bold and in calligraphic fonts, respectively. With this understanding, we give names to a few matrices that will recur throughout this paper.
Explicit computation -which we omit-shows that η • A = A • η on L, for every A in the above 1-parameter subgroups, and also for A = J; therefore the identity η • A = A • η holds for every A ∈ PSL ± 2 R. The action of O ↑ 2,1 R on R 3 descends to a projective action on P 2 R that fixes the Klein model K and its boundary ∂K. These observations, together with Lemma 2.1, imply that for every commutes. The analogous diagram involving the ideal boundaries of K, D, H commutes as well, and actually simplifies. Indeed, the nontrivial bijection τ • υ reduces on ∂K to the obvious identification [ . We will thus switch freely between ∂K and ∂D, using S 1 as a neutral name for both. Let D be a polygon in H, bounded by m ≥ 3 geodesics l 0 , . . . , l m−1 , and having angles at vertices π/e 0 , . . . , π/e m−1 , with e 0 , . . . , e m−1 integers ≥ 2 or ∞ (if the corresponding vertex lies in ∂H); the Gauss-Bonnet formula forces m−2 > a e −1 a . The extended Coxeter group associated to D is the subgroup Γ ± of PSL ± 2 R generated by the reflections in the sides of D. It has the presentation with the understanding that relators (x a x a+1 ) ∞ do not appear), and D is a fundamental domain for it. Its index-2 subgroup of orientation-preserving elements Γ = Γ ± ∩ PSL 2 R is a fuchsian group of finite covolume; see [28], [32]. When D is a triangle we write ∆(e 0 , e 1 , e 2 ) and ∆ ± (e 0 , e 1 , e 2 ) for Γ and Γ ± , referring to them as a triangle group and an extended triangle group, respectively (the adjective extended stresses the fact that orientation-reversing isometries are allowed; in both cases, the action on H is properly discontinuous). Note that the numbers e 0 , e 1 , e 2 determine the triangle up to isometry, and hence the groups up to conjugation. We will freely use all of the above terminology when working in other models of the hyperbolic plane.
Let us return to the Lorentz form -, -. We recall that, given a nonisotropic vector w, the reflection R w is the unique linear involution of R 3 that fixes pointwise the polar hyperplane {x : w, x = 0} and exchanges w with −w. An easy computation (of course, all of this is well known) shows that: (i) (ii) R w preserves -, -, (iii) in terms of matrices, The four matrices J , F , P , G in (2.3) are in O ↑ 2,1 Z; in particular they are of the form R w , for w equal to (1, 0, 0), (0, 1, 0), (1, 1, 1), (−1, 1, 0), respectively. In [35] it is proved that the five reflections J , F , R (0,0,1) = diag(1, 1, −1), R (1,1,0) = J GJ , P generate O 2,1 Z (see [17] for an elementary proof which avoids the theory of Kac-Moody Lie algebras); we give an independent and expanded version in the following theorem.
Theorem 2.4. We have O ↑ 2,1 Z = F , P , G , which is isomorphic to the extended triangle group ∆ ± (2, 4, ∞); adding R (0,0,1) as a further generator we obtain the full group O 2,1 Z. The group F , P , J is an index-2 subgroup of O ↑ 2,1 Z, and equals Proof. We work in H. Let Γ = {A ∈ PSL 2 R : A ∈ SO ↑ 2,1 Z}; then, by definition, Γ is an arithmetic fuchsian group. We observe that F, P, G + is the triangle group ∆(2, 4, ∞). Indeed F, P, G are the reflections in the three geodesics • l 0 , whose endpoints are 1 and −1; • l 1 , whose endpoints are ∞ and 1; • l 2 , whose endpoints are 1 − √ 2 and 1 + √ 2. These geodesics determine a triangle D in H with vertices at 1 + i √ 2 with angle π/2, at i with angle π/4, and at the ideal point 1 with angle 0.
Clearly F, P, G + is a subgroup of Γ, and it is well-known that a fuchsian group containing a triangle group must itself be a triangle group [44, §6]. The partially ordered set of all nine non-cocompact arithmetic triangle groups has been determined by Takeuchi in [46], and ∆(2, 4, ∞) is maximal in it; therefore Γ = F, P, G + . Adding F as a further generator to F, P, G + we obtain F, P, G = {A ∈ PSL ± 2 R : A ∈ O ↑ 2,1 Z}, as claimed.
For the second statement, observe that replacing the generator G with J means replacing l 2 with the geodesic l 2 whose endpoints are 0 and ∞. The polygon determined by l 0 , l 1 , l 2 is the triangle D = D ∪ G[D], with angles π/2 at i, and 0 at 1 and at ∞; hence F, P, J is the extended triangle group ∆ ± (2, ∞, ∞). Clearly F , P, J ≤ PSU ± 1,1 Z[i], and by computing Taking into account the respective fundamental domains, it is easy to check that F, P, J has index 3 in PSL ± 2 Z; therefore C −1 PSU ± 1,1 Z[i] C equals either F, P, J or the full PSL ± 2 Z. However, this second possibility is ruled out by the fact that PSL ± 2 Z (which is the extended (2, 3, ∞) triangle group) contains elements of order 3, and hence of trace 1 (up to sign), while clearly no element of PSU ± 1,1 Z[i] may have trace 1.

Pythagorean triples and the Romik map
. Pythagorean triples correspond bijectively to rational points in the unit circle, which in turn correspond, via stereographic projection, to points in P 1 Q. These correspondences provide various techniques for enumerating triples, among which the one known to Euclid: given any reduced fraction a/b, the triple (a 2 −b 2 , 2ab, a 2 +b 2 )/ gcd(a 2 −b 2 , 2ab, a 2 +b 2 ) is pythagorean, and every pythagorean triple is uniquely obtainable in this way (the gcd in the denominator is 1 if 2 | ab, and 2 otherwise). As noted in the introduction, many techniques are cast in the form of the descent of a binary or ternary tree.
A remarkable connection with the theory of continued fractions is offered in [42]; as a warmup, we sketch it using our notation. We partition S 1 in four quarters I 0 , I 1 , I 2 , I 3 , with I a = {exp(2πti) : a/4 ≤ t ≤ (a + 1)/4}. Let A = R (1,−1,1) = F P F . Then A acts on S 1 (viewed as ∂K, see the diagram (2.4) and the resulting identifications) by exchanging x with the other point of intersection of S 1 with the line through x and [1, −1, 1]; the interval I 3 is thus bijectively mapped to the union of the other three intervals. We fold back I 0 ∪ I 1 ∪ I 2 to I 3 via the reflection F acting on I 0 , the rotation J F on I 1 , and the reflection J on I 2 ; see Figure 1. Conjugating this process via the stereographic projection through [0, 1, 1] we obtain the Romik map in Figure 2. By construction, it is a continuous piecewiseprojective selfmap of the real unit interval [0, 1]. It is composed of three pieces, each one mapping bijectively a subinterval of [0, 1] to the whole interval. The computation of these pieces is built-in in our formalism: indeed, since stereographic projection from [0, 1, 1] is C −1 • τ • υ on ∂K, computation amounts to switching from boldface to lightface. Thus, the first piece is induced by J(F P F ) = 1 We adopt another notational shorthand, by consistently writing t, θ (or s, σ, . . .) for pairs t = [t 1 , t 2 , t 3 ] ∈ ∂K, θ = (t 1 + t 2 i)/t 3 ∈ ∂D, identified as in the discussion following the diagram (2.4). We recall that the residue field of the point t = [t 1 , t 2 , t 3 ] in the projective variety {x 2 1 + x 2 2 − x 2 3 = 0} = ∂K is Q(t) = Q(t 1 /t 3 , t 2 /t 3 ). If Q(t) = Q we say that t is a rational point; in this case t has  a canonical presentation as a pythagorean triple. The corresponding θ ∈ Q(i) has a canonical presentation as well, but a subtler one. For each prime integer p ≡ 1 (mod 4), write uniquely p = a 2 + b 2 , for integers a > b > 0, and let θ p = (a+bi)/(a−bi) (corresponding, as in Euclid's setting, to t p = [a 2 −b 2 , 2ab, a 2 +b 2 ]). It is well known -and easy to prove [20]-that every θ ∈ S 1 ∩Q(i) factors uniquely in Q(i) as a product of a unit in Z[i] and finitely many numbers θ p and their inverses. This implies that the set of primitive pythagorean triples forms a multiplicative group, isomorphic to the direct sum of the cyclic group of order 4 with countably many copies of the infinite cyclic group. We thus obtain our second canonical presentation: every θ ∈ S 1 ∩ Q(i) can be uniquely expressed as θ = κµ/μ, with κ ∈ {1, i, −1, −i} and µ ∈ Z[i] having prime decomposition of the form with a j > |b j | > 0, e j > 0 for every j, and the pairs (a 1 , |b 1 |), . . . , (a q , |b q |) all distinct.

The de Sitter space
The de Sitter space is the one-sheeted hyperboloid S = {x ∈ R 3 : x, x = 1}; it is a lorentzian manifold of constant positive curvature [37], [36]. The de Sitter space is in natural bijection with various spaces of interest to us: these bijections are well known, albeit a bit scattered in the literature. We collect the relevant facts in Theorem 4.1, whose nonstandard feature is the rôle of PSL ± 2 R as the acting group, instead of the usual PSL 2 R.
We recall from §2 that A → A is a group isomorphism from PSL ± 2 R to O ↑ 2,1 R. We define now another isomorphism Λ : In the following theorem we let e : {1, −1} → {0, 1} have value 0 on 1, and 1 on −1; also, we denote any group action by a star. (S1) The de Sitter space S, with base point (1, 0, 0) and action Each space carries a PSL ± 2 R-invariant infinite measure, which is the quotient Haar measure in (S2), and is induced by the form (ω − α) −2 dω dα in (S3). In (S1), the measure of a Borel subset B of S is the euclidean volume of the cone {tx : t ∈ [0, 1], x ∈ B}, and analogously for (S6).
Let q be a form as in (S6), associated to the symmetric matrix of determinant −1/4. We obtain a pair (ω, α) as in (S3) by labeling the two roots of q(x, 1) as follows: (a) if q 1 = 0 and q 2 = 1, then ω = ∞ and α = q 3 ; (b) if q 1 = 0 and q 2 = −1, then ω = −q 3 and α = ∞; (c) if q 1 = 0, then Given a pair (ω, α) as in (S3), we set thus defining a coset EA as in (S2). Finally, any EA in (S2) determines a symmetric matrix Q of determinant −1/4 via note that Q is well defined, i.e., independent from the choice of a representative in EA and from the lift of this representative to SL 2 R. It is clear that each of these constructions preserves the base points and is equivariant with respect to the listed actions. Therefore, the claimed correspondence between (S2), (S3), (S6) follows as soon as we prove that the final Q equals the starting Q. We check case (c), leaving the simpler cases (a) and (b) to the reader. By definition, so that which is the initial Q; note the use of the identity J ±1 1 The bijection between (S1) and (S6) is a simple change of variables, namely This change of variables transforms the matrix Q in (4.1) to W/2, where W is the matrix in (2.1). This implies that the bijection is equivariant with respect to the actions listed in (S1) and (S6); see also Remark 5.2.
For future reference we list here the form q and the point w ∈ S as a function of (ω, α):

Circle intervals
The unit circle S 1 is cyclically ordered by the ternary betweenness relation t ≺ x ≺ t , which reads "t, t , x are pairwise distinct, and traveling from t to t counterclockwise we meet x". Every pair of distinct points t, t determines two Given w in the de Sitter space, the set I w = {x ∈ S 1 : x 3 w, x ≥ 0} is an interval as well (the factor x 3 , i.e., the third coordinate of x, makes the definition independent from the choice of a representative for x). Let us denote the ordinary cross product of two vectors in R 3 by x × y.
the right-hand side being independent from the chosen lifts of t, t to R 3 \{0}. Then the following statements hold.
be the pair corresponding to w according to Theorem 4.1. Then we have and only if both t and t are rational points.
(v) The arclength of [t, t ] and the third coordinate w 3 of w are related by arclength([t, t ]) = 2 arccot(w 3 ). (vi) If t and t do not lie on the same diameter (i.e., by (v), if w 3 = 0), then the unique circle in R 2 perpendicular to S 1 and passing through t, t has center (w 1 /w 3 , w 2 /w 3 ) and curvature |w 3 |. (vii) Assume that I w0 ⊇ I w1 ⊇ I w2 ⊇ · · · , with arclength tending to 0 (i.e., lim t→∞ w t,3 = ∞). Then , and analogously for α. Our statement amounts then to the verification that the vector resulting from (5.1) equals the vector w given by (4.4). This is a straightforward computation.
(iii) Let x be a point in S 1 , and choose a representative for it with positive third coordinate. Then, for every The second statement follows from the first and the remark that The right-to-left implication follows from the definition of w. Conversely, if w ∈ Q 3 then the proof of the equivalence between (S1) and (S6) in Theorem 4.1 yields that the form q corresponding to w has rational coefficients. Since q has discriminant 1, the roots of q(x, 1) (given by (a), (b), (c) in the proof of the same Theorem 4.1) are rational numbers. By (ii), t and t are the reverse stereographic projections through [0, 1, 1] of these roots, and thus are rational points.
(v) As in (i), we assume t = [1, 0, 1] and t = [cos r, sin r, 1]. Then, as computed in (i), w 3 = (sin r) (1 − cos r) = cot(r/2), and our statement follows. (vi) Looking at w as a point in P 2 R, the identities w, t = w, t = 0 mean that w is the intersection point of the two lines tangent to S 1 at t and t ; thus the described circle has center (w 1 /w 3 , w 2 /w 3 ). Upon applying the rotation in the proof of (i), the statement about the curvature follows by direct inspection. (vii) This is clear.
Remark 5.2. Since, as it is easily seen, the map w → I w is a bijection between S and the space of closed circle intervals, it is tempting to add a seventh item to the list in Theorem 4.1. However this would not be correct, since the action in Lemma 5.1(iii) does not agree with the one in Theorem 4.1(S1). In other words, PSL ± 2 R acts on the space of intervals via the "bold" isomorphism A → A, while it acts on the de Sitter space via Λ. The following commuting diagram may clarify the situation In (5.2), the rightmost vertical arrow is the involutive automorphism A → (det A)(sgn A 3,3 )A of O 2,1 R, which restricts to the isomorphisms Λ • bold −1 and bold •Λ −1 . Since these isomorphisms obviously preserve the fact that a matrix has integer entries, Theorem 2.4 implies that SO 2, When working with continued fractions algorithms one naturally deals with unimodular intervals in P 1 R, namely intervals [p/q, p /q ] with rational endpoints and such that det p p q q = −1; for example, the intervals [1/(a + 1), 1/a] of continuity for the Gauss map x → 1/x − 1/x are unimodular. It is a trivial -but keyfact that the modular group PSL 2 Z acts simply transitively on such intervals. The situation for intervals on the circle is more involved.
Theorem 5.3. The set S ∩ Z 3 is partitioned in two orbits, corresponding to the parity of w 3 , by the action of SO ↑ 2,1 Z. On each orbit the action is simply transitive. Replacing SO ↑ 2,1 Z with its index-2 subgroup Λ F, P, J + each orbit is further split in two.
Proof. It is easy to check that each of −F , −P , −G preserves the parity of w 3 ; hence there are at least two orbits.
Simple transitivity follows from the fact that both (∞, 0) and (∞, 1) have trivial stabilizer in F, P, G + (because an element of a fuchsian group that fixes two distinct cusps must be the identity).
We can now define unimodularity for circle intervals.
Definition 5.4. Let t, t be distinct rational points in S 1 , and let w ∈ S ∩ Q 3 be the point corresponding to [t, t ] according to Lemma 5.1. If w ∈ Z 3 and w 3 is even (odd), then we say that [t, t ] is an even (odd) unimodular interval.
Theorem 5.5. Let t, t , w be as in Definition 5.4; then the following conditions are equivalent.
In every pythagorean triple one of the legs must be even, and the other leg and the hypotenuse both odd. The condition t 1 t 1 + t 2 t 2 − t 3 t 3 = −2 forces t 1 , t 1 to be both even and t 2 , t 2 both odd (or conversely). Since t 3 , t 3 are surely both odd, all the entries in Lt × Lt must be even; thus w ∈ Z 3 .
The stated characterization of [t, t ] being even/odd is clear from the previous proof.
By Theorem 5.3, w is in the F , P , J + -orbit of one of (1, 0, 0), (1, 1, 1), (0, 1, 0), Finally, let S be the matrix in (5.3). By direct computation which has the form α β βᾱ , as can easily be checked; hence S ∈ PSU ± 1,1 C. If we can prove that S has entries in Z[i], then necessarily S = R w . Indeed, the matrix S −1 R w would then belong to the fuchsian group PSU 1,1 Z[i], and would fix the two cusps θ, θ ; hence, it must be the identity matrix.

Billiard maps
Having arranged our tools in working order, we proceed to our core objects.
Definition 6.1. A unimodular partition of the unit circle S 1 is a counterclockwise cyclically ordered m-uple t 0 , t 1 , . . . , t m−1 of pythagorean triples, of cardinality at least 3, such that each interval [t a , t a+1 ] is unimodular (including [t m−1 , t 0 ]; here and in the following we are writing indices modulo m). We will write w a = (Lt a+1 × Lt a )/ t a+1 , t a ∈ S for the points defined by Lemma 5.1.
According to our conventions, and without further notice, we will often switch to a complex-numbers setting, thus writing θ a for t a .
For every a, let l a be the geodesic in D of ideal endpoints θ a and θ a+1 ; of the two halfplanes determined by l a , let D a be the one containing all other l b , for b = a. Then D = {D a : a = 0, . . . , m − 1} is a polygon with sides l 0 , . . . , l m−1 and ideal vertices θ 0 , . . . , θ m−1 , on which we can play billiards in the usual way. Namely, any unit velocity vector attached to an infinitesimal ball in the interior of D determines an oriented geodesic g starting from an ideal point ρ and ending at σ. The ball travels along g at unit speed, until it hits the side l a determined by the half-open interval [θ a , θ a+1 ) to which σ belongs (unless σ is one of the vertices, in which case the ball is lost at infinity). When hitting l a , the ball rebounces with angle of reflection equal to the angle of incidence, and continues its trajectory along the geodesic g which is the image of g with respect to the reflection with mirror l a . This reflection is induced by the matrix R wa in (5.3) (with θ = θ a and θ = θ a+1 ), and thus has ideal initial and terminal points R wa * ρ and R wa * σ, respectively. All of this naturally suggests the following standard definition [18,Chapter 6], [16, §IV.1].
Definition 6.2. The billiard map determined by the unimodular partition where a is the index of the unique half-open interval I a = [θ a , θ a+1 ) containing σ, and A a = R wa . The map B is continuous, and determines a topological dynamical system. We denote by (S 1 , B) the factor system naturally induced by the projection (σ, ρ) → σ; in short, B(σ) = A a * σ for σ ∈ I a .
We will freely use Theorem 4.1 to conjugate B to a map acting on any of the spaces (S1)-(S6); we will still denote the conjugated map by B, slightly abusing notation. For ease of visualization (and crucially in §9 and §10) we will also conjugate B and B to maps on [0, 1) 2 \ (diagonal) and [0, 1), respectively; these last conjugations are realized through the normalized (i.e., the image is divided by 2π) argument function arg : ∂D → [0, 1). Example 6.3. The ordered 6-uple is a unimodular partition, whose corresponding billiard table is shown in Figure 3 (left). The matrices A 0 , . . . , The graph of the arg-conjugate of B is shown in Figure 3 (right); it requires caution in two respects. First, B is a continuous map on S 1 and, second, it is piecewise-defined via six pieces, whose endpoints are given by the six B-fixed points (0 = 1 included). We plot in Figure 4 Figure 5. Note that B is not injective: the points (θ 0 , A 0 * θ 2 ) and (A 2 * θ 0 , θ 2 ) are different, but both get mapped to (θ 0 , θ 2 ) (see however Theorem 7.1(i)).
We let Γ ± B be the group generated by A 0 , . . . , A m−1 , and Γ B = Γ ± B ∩ PSU 1,1 Z[i] the associated fuchsian group. By conjugating with an appropriate element of PSU 1,1 Z[i] we always assume, without loss of generality, that θ 0 = 1. As noted in §2, Γ ± B admits the presentation x 0 , . . . , x m−1 | x 2 0 = x 2 1 = · · · = x 2 m−1 = 1 , and hence is isomorphic to the free product of m copies of the group of order two. Equivalently stated, each element of Γ ± B can be uniquely written as a word in the generators A 0 , . . . , A m−1 , subject to the only condition that the same generator does not appear in two consecutive positions. Since D has finite hyperbolic area,  Proof of Lemma 6.5. Each A a is an involution, and exchanges I a with b =a I b , the bar denoting topological closure. However, in this proof we carefully distinguish B (which maps bijectively I a to b =b I b ) from A a (which is one of the branches of B −1 , the one that maps bijectively b =a I b to I a ). We do so in order to prepare the ground for the proof of Theorem 9.2, where the argument we are going to provide will be adapted to another (m − 1)-to-1 covering map of S 1 . Conversely, we fix a satisfying (i) and (ii) and show that there exists a unique point having a as B-symbolic sequence. We need a preliminary remark: suppose we know that σ is the unique point having B-symbolic sequence b. Then, by direct inspection, we have: (a) if σ is in the interior of I b0 and b = b 0 , then A b * σ is in the interior of I b and is the unique point having B-symbolic sequence bb; (b) the same conclusion holds if σ = θ b0 , provided that b / ∈ {b 0 , b 0 − 1}. Case 1. The sequence a has tail a, say from time t on. If t = 0, then there exists a unique point having B-symbolic sequence a, namely θ a . If t > 0, then the previous remark and induction show that A a0 · · · A at−1 * θ a is the only point having B-symbolic sequence a. Case 2. The sequence a does not have tail a, for any a. Since a t = a t+1 for every t, we have strict inclusions I at ⊃ A at [I at+1 ] for every t, and hence a strictly decreasing sequence of nested intervals (6.1) We claim that this sequence shrinks to a singleton. Indeed, each set in (6.1) is a unimodular interval, strictly containing the following one. By Lemma 5.1(v) the third coordinates of the corresponding points w a0 , A a0 w a1 , A a0 A a1 w a2 , . . . on the de Sitter space form a strictly increasing sequence. Since we are dealing with unimodular intervals, these third coordinates are integer numbers, and a strictly increasing sequence of integers must go to infinity. Therefore the arclengths of the intervals go to 0, and the intersection of the sequence in (6.1) contains at least one point -by compactness-but no more than one. Let σ be the shrinking point of (6.1) and let ϕ(σ) = b; we prove a = b by induction (note that, clearly, no point other than σ may have B-symbolic sequence a). We have σ ∈ I a0 ∩I b0 ; if a 0 were different from b 0 , then necessarily σ = θ b0 and b 0 = a 0 +1. Therefore, for every t ≥ 1 we have σ = B t (σ) ∈ B t [A a0 · · · A at−1 I at ] = I at , and thus σ belongs to I at . This implies a = a 0 (a 0 + 1), which contradicts (ii); hence a 0 = b 0 . For the inductive step, assume a r = b r for 0 ≤ r < t. Then B t (σ) has B-symbolic sequence b t b t+1 . . . and is the unique shrinking point of the chain Applying the base step above to B t (σ) we get a t = b t .

Natural extension and invariant measures
If ϕ(σ) has constant tail a for some a ∈ {0, . . . , m − 1}, i.e., B h (σ) = θ a for some h, we say that σ is B-terminating. If ϕ(σ) has periodic tail a h · · · a h+p−1 with minimal preperiod h and period p ≥ 2, we say that σ is B-periodic or B-preperiodic, according whether h is 0 or greater than 0.
We will push the identification of the de Sitter space with (S 1 × S 1 ) \ (diagonal) a bit further by using the symbol S for both; this is unambiguous since writing w ∈ S or (σ, ρ) ∈ S clearly distinguishes the two uses. With this understanding, we denote by S B the set of all pairs (σ, ρ) such that: (i) both σ and ρ are B-nonterminating; (ii) σ and ρ belong to different intervals.
For the map B of Example 6.3, the orbit in Figure 4 is dense in S B .
Theorem 7.1. The following facts hold.
(i) B S B is a bijection on S B . (ii) If (σ, ρ) ∈ S is such that both σ and ρ are B-nonterminating, then B t (σ, ρ) ∈ S B for some t ≥ 0. (iii) Letμ be the PSU ± 1,1 C-invariant measure on (S 1 × S 1 ) \ (diagonal) given by Theorem 4.1. Then (S B ,μ, B) is a measure-preserving system, and so is its factor (S 1 , µ, B), where µ = π * μ is the pushforward measure induced by the projection π(σ, ρ) = σ. (iv) The invertible system (S B ,μ, B) is the natural extension of (S 1 , µ, B). (iv) The set {σ ∈ S 1 : σ is B-terminating} is clearly B-invariant and has µmeasure 0; modulo this nullset and its π-counterimage, we have the commuting square By the very definition of the natural extension [41, p. 22], the metric system (S B ,μ, B) is the natural extension of its factor (S 1 , µ, B) if the supremum of the family of measurable partitions is -modulo nullsets-the partition of S B in singletons. This condition amounts to the request that if (σ, ρ) = (σ , ρ ), then there exists t ≥ 0 such that π B −t (σ, ρ) = π B −t (σ , ρ ) . This request is clearly satisfied: if σ = σ we take t = 0, while if σ = σ we take t = h + 1, there h is the least nonnegative integer such that B t (ρ) and B t (ρ ) lie in different intervals.
As usual in the context of Gauss-like maps, once a model of the natural extension has been determined the computation of the (unique) absolutely continuous Binvariant measure is easy; we state the result for the arg-conjugates of B and B. h a (x) = π tan(π(x − x a )) − π tan(π(x − x a+1 )) on (x a , x a+1 ), and having value 0 elsewhere. Then the following facts hold.
(i) The unique (up to constants) B-invariant measure on X absolutely continuous with respect to the Lebesgue measure is dμ = π 2 sin(π(x − y)) −2 dx dy. Proof. (i) This is just a change of variables, easily performed in two steps. Let F 1 , F 2 : R 2 → R 2 be defined by F 1 (x, y) = π(x − y), π(x + y) = (x , y ), Then Then h a (x) is the integral xa 0 π 2 dy sin 2 (π(x − y)) + We draw in Figure 5 the invariant density a h a for the map B of Example 6.3. We note that, in case m = 3, a direct geometric proof of Theorem 7.2(ii) was given by Ko lodziej and Misiurewicz, using Ptolemy's theorem on quadrilaterals inscribed in a circle [30], [34].

The Lagrange theorem
Our next result is a version of Serret's theorem (two real numbers have the same tail in their continued fraction expansion precisely when they are PSL ± 2 Zequivalent [24, §10.11], [39]) in modern language.
Theorem 8.1. The map B and the group Γ ± B are orbit equivalent. More precisely, given σ, σ ∈ S 1 , there exists A ∈ Γ ± B such that σ = A * σ if and only if there exist h, k ≥ 0 such that B h (σ) = B k (σ ). In particular, if σ belongs to Q(i) then it is B-terminating, its orbit landing in the unique vertex of D which is Γ B -equivalent to σ.
Proof. We begin proving the last assertion, for which the ∂K setting is expedient. Let then s be a rational point, and let (w 0 ) 3 , . . . , (w m−1 ) 3 ∈ Z be the third coordinates of the points w 0 , . . . w m−1 of Definition 6.1. We need a preliminary step. Claim. By conjugating B by an appropriate element of SO ↑ 2,1 Z, we may assume that (w 0 ) 3 , . . . , (w m−1 ) 3 are all greater than 0, with at most one exception that may equal 0. Proof of Claim. By Lemma 5.1(v), the greater is the arclength of I a , the smaller is (w a ) 3 , with (w a ) 3 = 0 corresponding to arclength π. This implies that no more than one of the above third coordinates may be negative or 0. Say that (w a ) 3 < 0. If I a is even, then by Theorem 5.3 we may conjugate B by the matrix in SO ↑ 2,1 Z that sends w a to (0, 1, 0), and we are through. If I a is odd, than we conjugate by the matrix that sends w a to (1, 1, 1); the image of I a will then have arclength π/2. One of the new third coordinates may now have value 0, but none may have value −1 or less, since value −1 already corresponds to an arclength of 3π/2, and the sum of the arclengths would exceed 2π.
Having proved our claim we perform, if needed, this preliminary conjugation, which does not affect the validity of our statement; renaming indices, we assume (w 0 ) 3 ≥ 0 and (w 1 ) 3 , . . . , (w m−1 ) 3 > 0. If s is one of t 0 , . . . , t m−1 , we are through. Otherwise, s is in the interior of precisely one interval, say I a ; let s = B(s). Then, lifting s and s to their canonical representatives (i.e., to pythagorean triples), we have the identity in Z 3 Now, w a , w a = 1 since w a ∈ S, and w a , s > 0 since s is in the interior of I a . This implies that the third coordinate of s is strictly less than the third coordinate of s, unless a = 0 and (w 0 ) 3 = 0, in which case we have equality. But the third coordinates of s and s are positive integers, and the exceptional case of equality is always preceded and followed by nonexceptional cases. Hence the process must stop, and this may happen only when the B-orbit of s lands in one of the interval endpoints t 0 , . . . , t m−1 .
The bijection between ∂D ∩ Q(i) and rational points in ∂K extends to higher degrees. If Q(ω)/Q is Galois totally real, then the Galois groups Gal(Q(ω)/Q) and Gal(Q(i)(σ)/Q(i)) are naturally isomorphic. In particular, assume that σ is quadratic over Q(i) and let σ be its Galois conjugate. Then σ ∈ ∂D and ω = C −1 * σ is the Galois conjugate of ω with respect to the quadratic extension Q(ω)/Q.
Proof. Since the stereographic projection through [0, 1, 1] is a rational map with rational coefficients, the identity Q(s) = Q(ω) holds (with the convention that Q(∞) = Q). All statements follow from elementary Galois theory, as soon as one realizes that Q(i, σ) = Q(i, s 1 /s 3 , s 2 /s 3 ). In this identity the left-to-right containment is obvious, and the other one follows from s 1 /s 3 = (σ + σ −1 )/2.
The question of the validity of Lagrange's theorem (preperiodic points correspond to quadratic irrationals) for the Romik map is left open in [42, §5.1]. It can be settled in the affirmative by the result in [38]; see also [14] for this issue, and [13] for diophantine approximation aspects of the Romik map. Here we provide a different proof, valid not only for the Romik map but for all maps based on unimodular partitions. Note that our proof covers not only Lagrange's, but Galois's theorem [40,Chapter III]: periodic points correspond to reduced irrationals. In particular, the preperiodic σ is periodic iff so is σ iff (σ, σ ) ∈ S B .
Proof. Let σ be B-preperiodic. Clearly, for every A ∈ PSU ± 1,1 Z[i], we have Q(i)(A * σ) = Q(i)(σ); we can then assume that σ is B-periodic, with B-symbolic sequence a 0 a 1 . . . a p−1 . Let B = A a0 A a1 · · · A ap−1 . By looking at the decreasing sequence (6.1) in the proof of Lemma 6.5, we obtain Since B * σ is also in the above intersection, it equals σ, and this yields a quadratic polynomial with coefficients in Q(i) and having σ as root. This polynomial is not the zero polynomial, as B is not the identity matrix, and is irreducible over Q(i) because σ is B-nonterminating and Theorem 8.1 applies.
Conversely, let σ ∈ S 1 be quadratic over Q(i). By Lemma 8.2 the conjugate σ is in S 1 as well. For t ≥ 0, let B t (σ, σ ) = (σ t , σ t ), and let g t be the oriented geodesic of origin σ t and endpoint σ t . By Theorem 7.1 there exists h ≥ 0 such that, for 0 ≤ t < h, the points σ t and σ t belong to the same interval (so that g t does not cut the billiard table D), while g t cuts D for every t ≥ h. In particular, the B-symbolic sequences of σ and σ agree up to time h − 1 included, and disagree at time h. Let ω = C −1 * σ h , ω = C −1 * σ h ; since σ t and σ t are still conjugate in Q(i)(σ)/Q(i), by Lemma 8.
C is an index-3 subgroup of PSL ± 2 Z (see the end of the proof of Theorem 2.4), and Γ ± B is a finite-index subgroup of PSU ± 1,1 Z[i] (see §6). Hence, replacing H with an appropriate power, we obtain a matrix H l = CH l C −1 ∈ Γ ± B which induces on D either a hyperbolic translation of axis g h (if det H l = 1), or a glide reflection, again of axis g h (if det H l = 1). As noted in §6, H l can be uniquely written as H l = A b0 · · · A bq−1 for certain b 0 , . . . , b q−1 ∈ {0, . . . , m − 1}. We claim that b 0 · · · b q−1 and b q−1 · · · b 0 are the Bsymbolic sequences of σ h and σ h , respectively (q might be a proper multiple of the minimal period p); this will conclude the proof of Theorem 8.3.
We must have b 0 = b q−1 . Indeed, if not, then H l would factor as for some k ≥ 2, with t = (q − k)/2 and b t = b t+k−1 . Hence g h would be the (A b0 · · · A bt−1 )-image of the geodesic stabilized by (A bt · · · A b t+k−1 ), which has endpoints in the two distinct intervals I bt and I b t+k−1 . Since b t and b t+k−1 are different from b t−1 , the endpoints of g h would both lie in I b0 , which is impossible since g h cuts D; therefore b 0 = b q−1 . The sequence b 0 · · · b q−1 satisfies (i) in Lemma 6.5 (because b 0 = b q−1 ), as well as (ii) (because otherwise H l would be a power of some A a A a+1 and thus would be parabolic, which is not possible because any power of the matrix in (8.2) has trace of absolute value greater than 2). Therefore, b 0 · · · b q−1 is the B-symbolic sequence of a unique point of S 1 , and this point is necessarily σ h , because σ h is the ideal endpoint of g h , and thus the shrinking point of The same argument, applied to H −1 = A bq−1 · · · A b0 , shows that σ h has Bsymbolic sequence b q−1 · · · b 0 . Example 8.4. Consider the unimodular partition given by the pythagorean triples in Figure 6 we draw the corresponding billiard table by thick geodesics.
Let q(x, y) = 4091x 2 + 1302xy + 101y 2 , which has discriminant D = 42440. The roots of q(x, 1) are We work directly on the de Sitter space; by (4.3), q corresponds to Since we may safely multiply by a constant, and we prefer working with integer vectors, we multiply by √ D/2 and define v = 1 2 Figure 6. A periodic orbit in a billiard table By the equivariance between (S1) and (S5) in Theorem 4.1, the billiard map B on [any dilated copy of] S is piecewise defined by the following matrices in SO 2,1 Z: In order to apply B we must determine the pair (s, r) ∈ (S 1 × S 1 ) \ (diagonal) associated to v, and the interval I a to which s belongs. The intervals I 0 , . . . , I 5 correspond as in Definition 6.1 to the points in S A straightforward computation along the lines of the proof of Theorem 4.1 shows that s, r are given, as a function of v ∈ ( √ D/2)S, by and that the 3rd coordinates s 3 , r 3 displayed above are always strictly positive. This implies that all values w 0 , s , . . . , w 5 , s are strictly negative, with precisely one strictly positive exception. The index a of that exception is the index of the interval I a to which s belongs, and thus the index of the matrix −A a to be applied. The B-symbolic sequence of ω 0 is thus 4535420, and that of α 0 is 4502453. We draw in Figure 6 the resulting billiard trajectory, along with the two geodesics corresponding to the preperiodic points v 0 and v 1 .

Minkowski functions
Let B : S 1 → S 1 be the factor of some fixed billiard map as in Definition 6.2. Clearly B is an orientation-reversing (m − 1)-to-1 covering map of S 1 onto itself. The same properties are shared by precisely one continuous group homomorphism T : S 1 → S 1 , namely T (z) = z −(m−1) . In this section we prove that there exists a self-homeomorphism Φ of S 1 that conjugates B with T . We provide an explicit expression for Φ, and prove that Φ is unique up to postcomposition with the elements of the dihedral group of order 2m. In the final section we will show that Φ is purely singular with respect to the Lebesgue measure on S 1 , and Hölder continuous with exponent equal to log(m − 1) divided by the maximal periodic mean free path in the hyperbolic billiard associated to B.
In order to state the next result, we recall that the torsion subgroup S 1 tor of S 1 is the internal direct sum of the Prüfer groups S 1 p-tor = {σ ∈ S 1 : ord(σ) is a power of p}, for p ranging over the primes. We let ζ = exp(2πi/(m−1)). S 1 ∩ Q(i) corresponding to the direct sum of the subgroup ζ generated by ζ and the finitely many S 1 p-tor , for p | m − 1. Before proving Theorem 9.2 we need some preliminaries. We already encountered the ternary betweenness relation on S 1 in §5, and we now introduce the same relation on the index set {0, . . . , m − 1}, cyclically ordered in the natural way. The powers of ζ determine a partition of S 1 in the half-open intervals J a = {ζ a } ∪ {x : ζ a ≺ x ≺ ζ a+1 } = [ζ a , ζ a+1 ). We define a binary relation < B on S 1 as follows: σ < B σ if and only if σ and σ lie in the same interval I a , for some a ∈ {0, . . . , m−1}, and arg(σ) < arg(σ ). The relation < T is defined in the analogous way, using the intervals J a . Precisely as in Definition 6.4, but using the intervals J a , we introduce the T -symbolic-sequence map ψ : S 1 → {0, . . . , m − 1} ω . Lemma 9.3. All statements in Lemma 6.5 hold for ψ; in particular ϕ and ψ have identical range X ⊂ {0, . . . , m − 1} ω , which is described by (i) and (ii) in that lemma. The betweenness and the < B relations on S 1 are characterized in terms of B-symbolic sequences and the betweenness relation on {0, . . . , m − 1} as follows: let ϕ(σ) = a, ϕ(σ ) = a , ϕ(σ ) = a . Then: (1) σ < B σ if and only if there exists t ≥ 0 such that: 3) one of the following mutually exclusive conditions holds: (1.3.1) t is even and (a t+1 = a t or a t+1 ≺ a t ≺ a t+1 ), (1.3.2) t is odd and (a t+1 = a t or a t+1 ≺ a t ≺ a t+1 ); (2) σ ≺ σ ≺ σ if and only if one of the following mutually exclusive conditions holds: 2) a 0 = a 0 = a 0 and σ < B σ , (2.3) a 0 = a 0 = a 0 and σ < B σ , (2.4) a 0 = a 0 = a 0 and σ < B σ and σ < B σ .
We have an analogous characterization of betweenness and < T in terms of Tsymbolic sequences.
Proof. The proof of Lemma 6.4 easily extends to the case of the map T . Apart from the obvious modifications (use J a for I a , and ζ a for θ a ), one has to replace the occurrences of B with occurrences of T , and those of A a with T −1 a , the latter being the ath inverse branch of T , i.e., the map that associates to σ ∈ b =a J b its unique −(m−1)th root lying in J a . The fact that no T -symbolic sequence has tail a(a + 1) is easy; indeed, any point having that symbolic sequence should jump forever from J a to J a+1 . But at each jump its arclength distance from the fixed point ζ a+1 increases by a factor m − 1, so the point will eventually escape from J a ∪ J a+1 . Finally, the analogue of the sequence (6.1) surely shrinks to a singleton, because at each step the arclengths shrink by a factor m − 1. With these modifications, the proof carries through verbatim.
We prove statement (1). Suppose σ and σ are different, but lie in the same interval I a0 . Then there exists t ≥ 0 such that for t steps the successive B-images of σ and σ keep on lying in the same interval, while B t+1 (σ) and B t+1 (σ ) lie in the different intervals I at+1 and I a t+1 , respectively. Since B is orientation-reversing, σ < B σ if and only if either t is even and B t (σ) < B B t (σ ), or t is odd and B t (σ ) < B B t (σ). We can then assume without loss of generality t = 0, and observe that σ < B σ holds if and only if σ = θ a0 (which is equivalent to a 1 = a 0 ), or B(σ) ≺ θ a0 ≺ B(σ ) (which is equivalent to a 1 ≺ a 0 ≺ a 1 , since now B(σ) and B(σ ) lie in different intervals, both different from I a0 ).
Statement (2) is clear, as is the fact that all of the proof applies to the map T .
Proof of Theorem 9.2. Let S be the shift on X = ϕ[S 1 ] = ψ[S 1 ], and define Φ = ψ −1 • ϕ. Then the inner squares in commute, so the outer rectangle commutes as well. Let σ, σ , σ be distinct points of S 1 . Then σ ≺ σ ≺ σ holds if and only if the conditions of Lemma 9.3 apply to ϕ(σ), ϕ(σ ), ϕ(σ ). By construction, ϕ(σ) = ψ Φ(σ) and analogously for σ and σ ; therefore σ is between σ and σ if and only if Φ(σ ) is between Φ(σ) and Φ(σ ). Since the topology of S 1 is definable in terms of betweenness, Φ is a homeomorphism. Let Φ 1 be any homeomorphism that makes the outer rectangle in (9.1) commute. For every h ∈ {0, . . . , m−1} and every e ∈ {1, −1}, the map Q(z) = ζ h z e commutes with T , so that Q • Φ 1 too makes the outer rectangle commute. We therefore assume that Φ 1 is orientation-preserving and fixes 1, and prove Φ 1 = Φ. As Φ 1 and Φ are homeomorphisms and the set of B-terminating points is dense in S 1 , it is enough to show that Φ 1 agrees with Φ on this set; in other words, that if σ has B-symbolic sequence a 0 . . . a t−1 a t with a t−1 = a t , then Φ 1 (σ) has T -symbolic sequence a 0 . . . a t−1 a t .
By Theorems 8.1 and 8.3 the set of points in S 1 of degree 1 (respectively, 2) over Q(i) is the set of B-terminating (respectively, B-preperiodic) points. Their Φimages are then the T -terminating (respectively, T -preperiodic) points. It is easily seen the every T -terminating or T -preperiodic point must have the form exp(2πiq) for some rational number q, i.e., must lie in S 1 tor . We have the decomposition S 1 tor = H 1 · H 2 , where H 1 (respectively, H 2 ) is the inner sum of all Prüfer groups S 1 p-tor with p m − 1 (respectively, p | m − 1). Now, given σ ∈ S 1 tor , repeated applications of T kill the H 2 part, and as soon as this happens the periodicity starts. More precisely, let h ≥ 0 be minimum such that T h (σ) ∈ H 1 . Then T h (σ) is T -periodic, because raising to the −(m − 1)th power is an automorphism of H 1 of finite order. In particular, σ is T -terminating if and only if T h (σ) is a fixed point, i.e., a power of ζ. Thus, σ is T -terminating precisely when it belongs to ζ ·H 2 .
We note as an aside that the pushforward probability measure Φ −1 * λ, where λ is the Lebesgue measure on the circle, is B-invariant, and is the measure of maximal entropy for B.
For the rest of this paper we consider B, T , Φ as selfmaps of [0, 1), as in Figure 7. This improves visualization, and makes Φ = ψ −1 • ϕ the unique homeomorphism of [0, 1) (with the topology inherited from R, not from S 1 ) that conjugates B with T . Accordingly, < will now denote the standard non-circular orders on [0, 1) and on {0, . . . , m − 1}. We will abuse language by writing I a and J a for the arg-images in [0, 1) of the intervals I a and J a of S 1 .
In the next Theorem 9.4 we provide an explicit formula for Φ(x), analogous to the Denjoy-Salem formula for the classical case [19], [43, pp. 435-436] Proof. The statement amounts to saying that ψ −1 (a) equals the value of the absolutely convergent series on the right-hand side of (9.2). By construction, where T −1 at is the a t th inverse branch of T discussed in the proof of Lemma 9.3 (instead of 0, any point in [0, 1) would do). We recall that, by definition, T −1 a is that inverse branch of T that sends b =a J b onto J a . Here a picture may help: rotate the graph of T in Figure 7 (left) along the diagonal, and look at its m = 4 inverse branches, the first two being Applying induction to the above formula one easily proves that (where we set a n = 0), and the statement follows by letting n tend to infinity. If x is B-preperiodic, (9.2) yields a finite expression for Φ(x). Indeed, writing for short d t = d(a t , a t+1 ) and d = d 0 d 1 . . ., we have that the map a → d is shiftinvariant; in particular, it sends preperiodic sequences to preperiodic ones. Hence, for a = ϕ(x) and and obtain by a straightforward computation Multiplying successively by −(m − 1) = −5, and working in Q/Z S 1 tor , the summand 1/3 is fixed (because −5 ≡ 1 modulo 3), and 11/25 gets killed in two steps. So it only remains the summand 27/521, which yields a periodic orbit of length 5 (because −5 has order 5 modulo 521), as expected.
The Galois conjugate α 0 of ω 0 has B-symbolic sequence a = 4502453 and with identical dynamical behaviour. The appearance of the same primes at the denominators is not surprising. Indeed, given a periodic orbit of length p, a simple computation shows that the only primes whose powers may appear as denominators of summands are those dividing (m − 1) p + (−1) p+1 , in our case 2, 3, 521.

Singularity and Hölder exponent
We maintain the setting described before Theorem 9.4. Since Φ is a monotonically increasing homeomorphism of [0, 1), it is differentiable λ-a.e. (λ referring to the Lebesgue measure) with finite derivative.
We need a preliminary lemma, for which we refer to the notation introduced in Definition 6.1.
Lemma 10.2. For every a, we have w a−1 + w a = q a t a for some q a ∈ Z >0 . Moreover, the identities hold.
Proof. It is easy to show that w a−1 , w a = −1; for example, applying an appropriate element of SO ↑ 2,1 R we may assume t a−1 = [0, −1, 1], t a = [1, 0, 1], t a+1 = [0, 1, 1], and compute directly. As a consequence, w a−1 +w a , w a−1 +w a = 1 − 2 + 1 = 0, and w a−1 + w a lies on the isotropic cone of the Lorentz form. By the formula (5.1), the plane tangent to this cone at t a contains both w a−1 and w a ; hence w a−1 +w a must be an integer multiple of t a . We thus have w a−1 +w a = q a t a for some q a ∈ Z, and must prove q a > 0. Now, we can surely construct a parabolic transformation P ∈ SO ↑ 2,1 R that fixes t a and is such that I P wa−1 and I P wa have both arclength strictly less than π. By Lemma 5.1(v), P w a−1 and P w a have both strictly positive third coordinate. Since P w a−1 + P w a = q a t a and t a has positive third coordinate too, q a must be strictly positive.
For the second statement we observe that t a is a fixed point of A a−1 = R wa−1 , as well as of A a = R wa . We thus compute A a−1 w a = A a−1 (−w a−1 + q a t a ) = w a−1 + q a t a , and analogously for the other identity in (10.1). Let x ∈ [0, 1) have B-symbolic sequence a. If, for some t ≥ 0, we have a t = a t+2 while a t+1 ∈ {a t − 1, a t + 1}, then we say that x moves parabolically at time t.
Proof of Theorem 10.1. Let µ be the infinite measure induced by the density a h a of Theorem 7.2(ii). Since ([0, 1), µ, B) is ergodic and conservative, by the Halmos version of the Poincaré recurrence theorem the set P of points that move parabolically at infinitely many times has full µ-measure. As a h a is bounded from below by some positive constant, µ(P c ) = 0 implies λ(P c ) = 0. In particular, the set P of points x that move parabolically at infinitely many times, and are such that Φ (x) exists finite, has full Lebesgue measure. We claim that Φ (x) = 0 for every x ∈ P .
Fix such an x, and let a be its B-symbolic sequence. Then, for each t ≥ 0, x belongs to the cylinder B −1 a0 · · · B −1 at−1 [I at ], whose closure is the arg-image of A a0 · · · A at−1 [I wa t ]. To be fully precise we clarify that, according to Definition 6.2, I a is the half-open interval [t a , t a+1 ) (or, here, its arg-image), while I wa is, as defined in §5, the closed interval [t a , t a+1 ]. However, our fixed x is surely not B-terminating, so interval endpoints are of no concern here. It is easy to show that .
Suppose by contradiction that the above limit is different from 0. Then, taking the quotient of two consecutive terms and multiplying by m − 1, we obtain Up to a factor of 2π, the length of B −1 a0 · · · B −1 at [I at+1 ] equals the arclength of A a0 · · · A at [I wa t+1 ] which, by Lemma 5.1(vii), is asymptotic to the inverse of (A a0 · · · A at w at+1 ) 3 , the index 3 referring to the 3rd coordinate. Therefore, writing A a0 · · · A at−1 = C t−1 for short, we have Assume now that t is a parabolic time and write a t = a t+2 = a; without loss of generality a t+1 = a − 1. Using Lemma 10.2 and observing that A a t a = t a , we compute Since (C t−1 w a ) 3 is eventually positive (actually, it goes to infinity for t → ∞), the last term in the above chain of equalities is less than 2 for all sufficiently large parabolic times. If m ≥ 4 this contradicts (10.2) and establishes Theorem 10.1. If m = 3 we need one more parabolic iteration. Namely, we redefine a parabolic time as a time t at which the B-symbolic sequence of x has the form either a(a − 1)a(a − 1)a or a(a + 1)a(a + 1)a. Then the chain of equalities in (10.3) starts with and ends up with which is eventually less than 4/3, again contradicting (10.2).
; then A 2 has positive determinant and is conjugate to a matrix either of the form exp(t/2) exp(−t/2) or of the form 1 t 1 (Γ B does not contain elliptic elements). The formulas in (2.2) show immediately that the spectral radius ρ(A 2 ) of A 2 is the square of the spectral radius of A 2 ; taking square roots we obtain ρ(A) = ρ(A) 2 .
The finiteness conjecture [31, p. 19] states the following: • For every finite set of matrices Π there exists k ≥ 1 and A ∈ Π k such that ρ(Π) = ρ(A) 1/k . Although the conjecture has been refuted in [9], counterexamples are difficult to construct, and are widely believed to be rare; see [26] for a detailed discussion and references to the literature. We do not know if the sets Σ = {A 0 , . . . , A m−1 } defining our billiard maps always satisfy the conjecture. However, for any specific example we examined it was easy to guess an appropriate k and A ∈ Σ k , and the guess was proved correct by explicitly constructing an appropriate matrix norm; see Example 10.6. provided that the limit exists (it surely does ifγ is periodic).
Theorem 10.4. Forμ-every (σ, ρ), the mean free path ofγ equals 0. The supremum of the family of mean free paths of periodic trajectories equals 2 log(ρ(Σ)), and this supremum is a maximum if and only if the finiteness conjecture holds for Σ.
Proof. Let f : S B → R >0 be defined by f (σ, ρ) = sup{t > 0 : γ(t) ∈ D}, where γ depends on (σ, ρ) as in Definition 10.3. Then the integral of f with respect toμ is finite, since it equals one half of the volume of the unit tangent bundle of Γ B \D.
As the limit above is precisely the free mean path ofγ, our first statement follows. Let M = sup{mfp(γ) :γ is a periodic billiard trajectory}. Given k ≥ 3, let A have maximum spectral radius in Σ k . Surely A 2 cannot be parabolic and, by the unique factorization of A as a product of elements in Σ, we see that there exists B = A b0 · · · A b h−1 ∈ Σ h such that 2 ≤ h ≤ k, b 0 = b h−1 , and A is conjugate to B. Define γ : R → D by γ(t) = CB * exp(ti), where C is the Cayley matrix. Then γ descends to a h-bounces periodic billiard trajectoryγ on D, which we claim to have length 2 log(ρ(B)). Indeed, if h is even then B is hyperbolic; thus, by the proof of [12, Proposition 1],γ has length 2 arccosh(|tr B|/2), which is indeed 2 log(ρ(B)). If h is odd, then we replace B with B 2 and obtain thatγ has length log(ρ(B 2 )), which again equals 2 log(ρ(B)). Asγ involves h bounces, we have mfp(γ) = 2 log(ρ(B) 1/h ); we conclude that 2 log(ρ(A) 1/k ) ≤ 2 log(ρ(B) 1/h ) = mfp(γ), and thus 2 log(ρ(Σ)) ≤ M .
Conversely, any periodic trajectoryγ involving k bounces can be lifted (nonuniquely) to a unit speed geodesic path γ : R → D. The B-symbolic sequence a of γ(+∞) = σ ∈ S 1 is periodic of period k and the argument above, applied to A = A a0 · · · A a k−1 , shows thatγ has mean free path 2 log(ρ(A) 1/k ); therefore M ≤ 2 log(ρ(Σ)).
If the finiteness conjecture holds for Σ, then α is the best Hölder exponent (i.e., Φ is not Hölder continuous of exponent β, for any β > α).
Fix now ε > 0. Then there exists k 1 ≥ k 0 such that, for every k ≥ k 1 and every matrix A a0 · · · A a k−1 ∈ Σ k , we have ρ(Σ) + ε > A a0 · · · A a k−1 1/k . Let 0 ≤ x < x < 1 be such that x − x ≤ l 1 = min{l : l is the length of a cylinder of level k 1 }.
Since E does not depend on ε, we let ε tend to 0 and obtain the Hölder condition Φx − Φx ≤ E(x − x) α , valid for x − x ≤ l 1 (remember that ρ(Σ) = ρ(Σ) 2 ). Replacing E with max{E, l −α 1 }, the condition holds for every pair x < x . Assume now that the finiteness conjecture holds for Σ, and let A = A a0 · · · A a k−1 ∈ Σ k be a maximizing matrix (i.e., ρ(Σ) = ρ(A) 1/k ). We must have a 0 = a k−1 , since otherwise A would be conjugate to a matrix B in Σ k−2 and we would have ρ(B) 1/(k−2) > ρ(A) 1/k = ρ(Σ), which is impossible. The eigenvalues of A are (−1) k , ρ(A), and ρ(A) −1 ; let v 1 , v 2 , v 3 be the corresponding eigenvectors. The vector w a0 cannot lie in the subspace spanned by v 1 and v 3 , because A n w a0 → ∞ for n → ∞. This easily implies that the length of the cylinder (B −1 a0 · · · B −1 a k−1 ) n [I a0 ], of level kn and endpoints x n < x n , is asymptotic to Cρ(A) −n as n → ∞, for some constant C. But then, for any ε > 0, lim n→∞ Φx n − Φx n (x n − x n ) α+ε = lim   Figure 7 (right) results from the gluing of four identical pieces, the fourth piece corresponding to the interval [−i, 1] in S 1 . Since the foldings F , J F , J involved in the construction of the Romik map in §3 are isometries, it is not difficult to realize that this fourth piece is conjugate via stereographic projection from [0, 1, 1] to the Minkowski function Q E introduced in [7] for the Romik map. As the above stereographic projection is a Lipschitz bijection with Lipschitz inverse between [−i, 1] and [0, 1], the Hölder exponents of Φ and of Q E must agree.