Stern-Brocot tree
If we start with irreducible fractions representing zero and infinity,
and then between adjacent fractions mnmn\frac{m}{n} and m′n′superscriptmnormal-′superscriptnnormal-′\frac{m^{{\prime}}}{n^{{\prime}}} we insert fraction m+m′n+n′msuperscriptmnormal-′nsuperscriptnnormal-′\frac{m+m^{{\prime}}}{n+n^{{\prime}}}, then we obtain
Repeating the process, we get
and then
and so forth. It can be proven that every irreducible fraction appears at some iteration and no fraction ever appears twice [1]. The process can be represented graphically by means of so-called Stern-Brocot tree, named after its discoverers, Moritz Stern and Achille Brocot.
If we specify position of a fraction in the tree as a path consisting of L(eft) an R(ight) moves along the tree starting from the top (fraction 1111\frac{1}{1}), and also define matrices
then product of the matrices corresponding to the path is matrix [nn′mm′]nn′mm′\left[\begin{smallmatrix}n&n^{{\prime}}\\ m&m^{{\prime}}\end{smallmatrix}\right] whose entries are numerators and denominators of parent fractions. For example, the path leading to fraction 3535\frac{3}{5} is LRL. The corresponding matrix product is
and the parents of 3535\frac{3}{5} are 1212\frac{1}{2} and 2323\frac{2}{3}.
Continued fractions and Stern-Brocot tree are closely related. A continued fraction ⟨a0;a1,a2,…⟩subscripta0subscripta1subscripta2normal-…\langle a_{0};a_{1},a_{2},\ldots\rangle corresponds to fraction whose path from the top is Ra0La1Ra2⋯superscriptRsubscripta0superscriptLsubscripta1superscriptRsubscripta2normal-⋯R^{{a_{0}}}L^{{a_{1}}}R^{{a_{2}}}\cdots with the last element removed. For example,
The irrational numbers correspond to the infinite paths in the Stern-Brocot tree. For example, the golden mean ϕ=⟨1;1,1,1,…⟩ϕ1111normal-…\phi=\langle 1;1,1,1,\ldots\rangle corresponds to the infinite path RLRLR⋯RLRLRnormal-⋯RLRLR\cdots. In particular, the denominator of the fraction corresponding to the string RLR⋯RLRnormal-⋯RLR\cdots of length nnn is the nnn’th Fibonacci number.