Stern-Brocot Tree Calculator

Stern-Brocot Tree Preview

Understanding the Stern-Brocot Tree

What is a Stern-Brocot Tree?

The Stern-Brocot tree is a mathematical structure that represents all positive rational numbers uniquely as fractions in lowest terms. It's named after Moritz Stern and Achille Brocot, who independently discovered it in the 19th century.

Construction of the Stern-Brocot Tree

The tree is constructed as follows:

  1. Start with the fractions \(\frac{0}{1}\) and \(\frac{1}{1}\) at the first level.
  2. For each pair of adjacent fractions \(\frac{a}{b}\) and \(\frac{c}{d}\), insert their mediant \(\frac{a+c}{b+d}\) between them.
  3. Repeat step 2 indefinitely.

Formula for the Mediant

The mediant of two fractions \(\frac{a}{b}\) and \(\frac{c}{d}\) is defined as:

\[ \text{Mediant} = \frac{a+c}{b+d} \]

Example Calculation

Let's construct the first few levels of the Stern-Brocot tree:

  1. Level 1: \(\frac{0}{1}, \frac{1}{1}\)
  2. Level 2: \(\frac{0}{1}, \frac{1}{2}, \frac{1}{1}\)
  3. Level 3: \(\frac{0}{1}, \frac{1}{3}, \frac{1}{2}, \frac{2}{3}, \frac{1}{1}\)

Visual Representation

1/1 1/2 2/1 1/3 2/3 3/2 3/1

This diagram shows the first three levels of the Stern-Brocot tree.