# 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:

1. Does this distance formula only hold for quadratic irrationals?
2. Where can I find additional literature / information on this formula? (I couldn't find any other references for it so far)

1. 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\}$$.