Semidoc    About    Archive

Combinatorics of continued fractions

Hello, the first post of this new academic year is by Pablo Rotondo who gave a talk at the seminar a few months ago. As there is more to say about the subject, this post will probably have a follow-up later.


In this post we discuss continued fraction expansions, and their statistics.

Introduction

Continued fractions are rather ubiquitous, they pop up in various contexts such as: the Euclidean Algorithm, Pell’s equation (see here and here) and Diophantine approximation, the approximation of reals by rationals.

Relation to the Euclidean algorithm and definitions.

Let us briefly see their relation to the Euclidean algorithm as an introduction.

The Euclidean algorithm allows us to calculate the greatest common divisor ($\gcd$) of a pair of positive integers $(x,y)$, by performing successive divisions. Supposing $x\geq y$, the algorithm proceeds by applying $(x,y)\mapsto (y,x\bmod y)$ until the smallest entry $y$ is $0$ and the result is then $x$. Its correctness is seen from the fact that $x\bmod y = x - y \, \lfloor x/y\rfloor$, and therefore $\gcd(x,y)=\gcd(y,x\bmod y)$.

Let us get to the continued fractions. Given a pair of positive integers $(x,y)$ with $x\geq y$ we may write

and then continue the procedure with $\cfrac{x\bmod y}{y}$ provided that $x\bmod y \neq 0$. This is exactly the Euclidean algorithm, and observe that the quotients $\lfloor x/y\rfloor$ that we discard in the algorithm here appear as coefficients.

Thus the Euclidean produces a continued fraction expansion

where the positive integers $m_1,\ldots,m_k$ are the successive quotients in the algorithm.

More generally, we call any such expansion a continued fraction expansion and even given infinitely many coefficients $m_1,\ldots,m_k,\ldots$ we define

whose convergence we do not prove here, but you can find a proof in Kinchin’s book (see the reference at the end of the post).

Rational numbers have exactly two expansions:

while irrational numbers $\alpha\in (0,1)$ have a unique (infinite) expansion, which can be found applying the same Euclidean algorithm (!) to the pair $(1/\alpha,1)$.

Some remarkable examples (for a proof see this arXiv note or this)

the last one being made up from the concatenation of the trios $1,2n,1$ for $n=1,2,\ldots$.

Notations

Given an irrational number $\alpha \in (0,1)$ with continued fraction expansion

the coefficients $m_1,m_2,\ldots \geq 1$ are called partial quotients or digits, while the partial expansions

with , are known as convergents. By convention we define $p_0=0$ and $q_0=1$ for every irrational $\alpha\in (0,1)$. The denominators $(q_k(\alpha))_{k\in \mathbb{N}}$ of the convergents are known as the continuants of $\alpha$.

Of course, all of these definition can be extended to rational numbers by considering only the meaningful part ($k\leq$ length of the expansion). See here for a particularly interesting application to a game of guessing a rational number!

Number of steps in the Euclidean algorithm.

The depth of the continued fraction expansion of a rational number $x/y$ is exactly the number of steps $\ell:=\ell(x,y)$ performed by the Euclidean algorithm on $(x,y)$. To bound $\ell$, we remark that the denominators satisfy the following recurrence relation

This is proved by induction, along with the analogous (up to the initial condition) recurrence relation for the numerators $p_k$. It is evident from the recurrence relation that $q_k$ is strictly increasing, furthermore

so that $q_k \geq 2^{\frac{k-1}{2}}$.

Picking $k=\ell(x,y)$, the previous inequality reads $y\geq 2^{\frac{\ell-1}{2}}$ so that

Classical Continued Fraction Statistics

We have just seen that convergents $q_k(\alpha)$ grow at least exponentially

we briefly mention that much more precise results are known when we allow $\alpha$ to be almost any irrational in $(0,1)$.

Theorem [Lévy] For almost every $\alpha\in (0,1)$ (w.r.t the Lebesgue -uniform- measure) we have

This result is proved by using Ergodic Theory. Continued fractions are naturally associated to the so called Euclidean Dynamical System arising from the Gauss map

where ${x}:=x-\lfloor x\rfloor$ is the fractional part of $x$.

Interestingly, it is also true that the frequency of $m_j=k$ tends to $\log_2\left(1+\frac{1}{k(k+2)}\right)$ almost surely as we take more and more quotients. For more on this read the notes here or in Khinchin’s book.

Best approximations

Convergents are particularly important due to the fact that they provide the ``best’’ approximations to numbers in the following sense

Definition [Best approximations of the second kind] Let $\alpha \in (0,1)$ be a real number. Then the fraction $\tfrac{p}{q}$ with $q>0$ is said to be a best approximation of the second kind for $\alpha$ if and only if

for any other fraction $\tfrac{p^\prime}{q^\prime}$ with $0< q \prime \leq q$.

Remark that so that this ``objective function’’ can be thought of as the error of approximating $\alpha$ by $p/q$, relative to the size of the denominator $q$. We are ready to state the relation with continued fractions

Theorem [See Khinchin 97] Best approximations of the second kind are necessarily convergents, and conversely, every convergent is a best approximation of the second kind, with exception of the trivial case of

Concretely, this means that if we may choose from the set of fractions whose denominators are at most $n$, the best approximation is given by $\frac{p_k(\alpha)}{q_k(\alpha)}$ with $k:= k(\alpha,n)$ is the only index $k$ for which $q_k(\alpha)\leq n < q_{k+1}(\alpha)$.

We remark that it is the continuants under the condition $q_k(\alpha)\leq n < q_{k+1}(\alpha)$ and $n\to \infty$ that will eventually interest us, rather than the classical fixed depth $k\to \infty$.

References.