Stern-Brocot tree

If we start with irreducible fractions representing zero and infinity,


and then between adjacent fractions mn and mn we insert fraction m+mn+n, 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 treeMathworldPlanetmath, 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 11), and also define matrices


then product of the matrices corresponding to the path is matrix [nnmm] whose entries are numerators and denominators of parent fractions. For example, the path leading to fraction 35 is LRL. The corresponding matrix productMathworldPlanetmath is


and the parents of 35 are 12 and 23.

Continued fractionsDlmfMathworldPlanetmath and Stern-Brocot tree are closely related. A continued fraction a0;a1,a2, corresponds to fraction whose path from the top is Ra0La1Ra2 with the last element removed. For example,

53 =1+11+12=1;1,2=R1L1R2-1=RLR,
411 =0+12+11+13=0;2,1,3=R0L2R1L3-1=LLRLL.

The irrational numbers correspond to the infinite paths in the Stern-Brocot tree. For example, the golden mean ϕ=1;1,1,1, corresponds to the infinite path RLRLR. In particular, the denominator of the fraction corresponding to the string RLR of length n is the n’th Fibonacci numberDlmfMathworldPlanetmath.


  • 1 Ronald L. Graham, Donald E. Knuth, and Oren Patashnik. Concrete Mathematics. Addison-Wesley, 1998. 0836.00001.
Title Stern-Brocot tree