Distance formula for continued fractions In the book Neverending fractions from Borwein, van der Poorten, Shallit and Zudilin, there is the so called distance formula (Theorem 2.45, p. 43) stated:
$$\alpha_1\alpha_2\cdot...\cdot\alpha_n=\frac{(-1)^n}{p_{n-1}-q_{n-1}\alpha}$$
for $n\geq 0$ with $p_{-1}=1$ and $q_{-1}=0$, where $$\alpha=[a_0;a_1,...,a_{j-1},\alpha_j]$$ ($\alpha_j$ being the tail of the continued fraction development of $\alpha$) and, as usual, $$\frac{p_n}{q_n}=[a_0;a_1,...,a_{n}]$$
In the book, the authors explain the name with

It turns out that one may usefully think of $\left|\log(\left|p_{n-1}-q_{n-1}\alpha\right|)\right|$ as measuring the weighted distance that the continued fraction has traversed in moving from $\alpha$ to $\alpha_n$

My questions are:

*

*Does this distance formula only hold for quadratic irrationals?

*Where can I find additional literature / information on this formula? (I couldn't find any other references for it so far)

 A: *

*This formula is valid for any continued fraction. But for quadratic irrationals it is especially useful because it allows to express fundamental unit of corresponding field in terms of continued fraction expansion of $\sqrt{n}$. For a reduced quadratic irrational $\omega=[0;\overline{a_1,\ldots,a_n}]$ with period $n=\mathrm{per}(\omega)$ we write
$$
  {\mathrm{per}}_e(\omega)=\begin{cases}
    n, &\text{if $n={\mathrm{per}}(\omega)$ is even;} \\
    2n,&\text{if $n={\mathrm{per}}(\omega)$ is odd.}
                         \end{cases}
$$
In this case, the fundamental unit can be found using Smith’s formula
$$
  \varepsilon_0^{-1}(\omega)=\omega T(\omega)T^2(\omega)\ldots
  T^{\mathrm{per}_e(\omega)-1}(\omega),
$$
where  $T(\alpha)$ stands for the Gauss map:
$T(\alpha)=\left\{{1}/{\alpha}\right\}$.


*The Smiths article (Smith H. J. S. Note on the Theory of the Pellian
Equation and of Binary Quadratic Forms of a Positive
Determinant. Proc. London Math. Soc., 1875, s1-7,
196-208.) is here.
A good book about this topic is B. A. Venkov, Elementary number theory, ONTI, Moscow 1931; English transl.,
Wolters-Noordhoff Publ., Groningen 1970. (see zbmath for review, and chapter 2 for continued fractions).
Applications to quadratic irrationals (Gauss-Kuz'min statistica and distribution of lengths) can be found in Spin chains and Arnold's problem on the Gauss-Kuz'min statistics for quadratic irrationals.
