[Math] Determine convergents for square root

continued-fractionsconvergence-divergence

All square roots can be represented as a continued fraction.
The fraction can be calculated to $n$ terms (e.g. $\sqrt{2}$ is $[1; 2, 2, 2, 2…]$)

So the continued fraction for $\sqrt{2}$ to $3$ terms would be
$$1 + \frac{1}{2 + \frac{1}{2 + \frac{1}{2 + 1}}} = \frac{17}{12}.$$

Additionally, the next convergent for square root of $2$ can be calculated with the formula $$\frac{numerator + 2 * denominator}{numerator + denominator}$$
How would I find the simplified continued fraction to $Y$ terms for the square root of $N$? So $f(2, 3)$ would be $\frac{17}{12}$.

If a similar formula to calculating the next convergent of $\sqrt{2}$ exists for all square roots, please include that formula.

Best Answer

This tutorial site on continued fractions presents a generalized means of calculating the successive convergents for a continued fraction from left to right, each in terms of the numerator and denominators of the previous convergent:

If our continued fraction is [a0; a1, a2, ..., ] then the successive convergents are available (defining N-1 ≡ 1 and D-1 ≡ 0) as:

  1. C0 ≡ N0 / D0 = a0 / 1 = a0;

  2. C1 ≡ N1 / D1 = (a1⋅N0 + N-1) / (a1⋅D0 + D-1) = (a1⋅a0 + 1) / (a1⋅c + 0)

    :

    n. Cn ≡ Nn / Dn = (an⋅Nn-1 + Nn-2) / (an⋅Dn-1 + Dn-2)

For your example of $$\sqrt{2} = [1; (2)]$$ one obtains in succession:

  1. a0=1; C0 ≡ 1 / 1 = 1;

  2. a1=2; C1 ≡ (2.1 + 1) / (2.1 + 0) = 3 / 2;

  3. a2=2; C2 ≡ (2.3 + 1) / (2.2 + 1) = 7 / 5;

  4. a3=2; C3 ≡ (2.7 + 3) / (2.5 + 2) = 17 / 12;

  5. a4=2; C4 ≡ (2.17 + 7) / (2.12 + 5) = 41 / 29.

Likewise for $$\sqrt{15} = [3; (1, 6)]$$

  1. a0=3; C0 ≡ 3 / 1 = 3;

  2. a1=1; C1 ≡ (1.3 + 1) / (1.1 + 0) = 4 / 1;

  3. a2=6; C2 ≡ (6.4 + 3) / (6.1 + 1) = 27 / 7;

  4. a3=1; C3 ≡ (1.27 + 4) / (1.7 + 1) = 31 / 8;

  5. a4=6; C4 ≡ (6.31 + 27) / (6.8 + 7) = 213 / 55.

Related Question