notesonly.in

One notebook for every subject — open it anywhere.

Log in

Continued Fractions: Concepts, Formulas and Examples

A continued fraction is a way of writing a number as a tower of fractions: a0 + 1/(a1 + 1/(a2 + …)), where the ai are integers. It is written compactly as [a0; a1, a2, …, an]. For example, 415/93 works out to [4; 2, 6, 7], meaning 4 + 1/(2 + 1/(6 + 1/7)). Every rational number has a finite continued fraction, and every irrational number has an infinite one — the golden ratio φ is [1; 1, 1, 1, …], an endless tower of ones.

Continued fractions matter because their partial cut-offs, called convergents, give the best possible rational approximations of a number. Engineers use them to design gear ratios, musicians to tune scales, and computer scientists to approximate irrationals with small denominators. They also reveal hidden structure: periodic continued fractions characterise exactly the square roots of integers.

Key Concepts

  • Partial quotients: the integers a0, a1, a2, … in [a0; a1, a2, …]; a0 may be any integer, the rest are positive.
  • Convergent: the fraction obtained by stopping the tower after ak, written pk/qk; each convergent approximates the number.
  • Recurrence: pk = ak·p(k−1) + p(k−2) and qk = ak·q(k−1) + q(k−2), with p(−2) = 0, p(−1) = 1, q(−2) = 1, q(−1) = 0.
  • Euclidean algorithm link: the partial quotients of a rational number are exactly the quotients produced by the Euclidean algorithm.
  • Best approximations: each convergent pk/qk is closer to the number than any fraction with denominator ≤ qk.
  • Periodic continued fractions: an eventually repeating tower represents exactly the quadratic irrationals, like square roots.

Formulas

  • Notation: x = [a0; a1, a2, …, an] = a0 + 1/(a1 + 1/(a2 + … + 1/an)).
  • Convergent recurrence: pk = ak·p(k−1) + p(k−2), qk = ak·q(k−1) + q(k−2), with seeds p(−2) = 0, p(−1) = 1, q(−2) = 1, q(−1) = 0.
  • Determinant identity: pk·q(k−1) − p(k−1)·qk = (−1)^k−1, so each convergent is in lowest terms.
  • Error bound: |x − pk/qk| < 1/(qk·q(k+1)), which shows convergents converge fast.
  • Golden ratio: φ = (1 + √5)/2 = [1; 1, 1, 1, …]; its convergents are ratios of consecutive Fibonacci numbers.

Worked Example

Find the continued fraction of 415/93 and its convergents. Step 1: run the Euclidean algorithm, recording quotients: 415 = 4·93 + 43, so a0 = 4; 93 = 2·43 + 7, so a1 = 2; 43 = 6·7 + 1, so a2 = 6; 7 = 7·1 + 0, so a3 = 7. Hence 415/93 = [4; 2, 6, 7]. Step 2: build the convergents with the recurrence (seeds p(−2) = 0, p(−1) = 1, q(−2) = 1, q(−1) = 0): k = 0: p0 = 4·1 + 0 = 4, q0 = 4·0 + 1 = 1; k = 1: p1 = 2·4 + 1 = 9, q1 = 2·1 + 0 = 2; k = 2: p2 = 6·9 + 4 = 58, q2 = 6·2 + 1 = 13; k = 3: p3 = 7·58 + 9 = 415, q3 = 7·13 + 2 = 93. Step 3: the convergents are 4/1, 9/2, 58/13, 415/93, and the last one is exactly the original fraction, as it must be. Verification: 415/93 ≈ 4.46237 and 58/13 ≈ 4.46154 — the third convergent already agrees to two decimal places with a denominator of only 13.

Common Misconceptions

  • "The continued fraction of a rational number is unique." Almost: [a0; a1, …, an] and [a0; a1, …, an − 1, 1] describe the same number, e.g. [4; 2, 6, 7] = [4; 2, 6, 6, 1]. The Euclidean-algorithm form (last term > 1) is the canonical one.
  • "Convergents get closer in a boring steady way." They alternate: odd convergents sit below the number and even ones above (or vice versa), trapping it between successive approximations.
  • "Any infinite continued fraction is a square root." Only periodic ones are. Non-repeating towers like [1; 2, 3, 4, …] represent other irrationals such as e.

Real-World Applications

  • Gear ratios: clockmakers approximate a required ratio like 1.618 by convergents of the continued fraction, picking tooth counts such as 34 and 55.
  • Calendar design: the leap-year rule approximates the solar year 365.2422 days using convergents of its fractional part.
  • Music tuning: equal-temperament scales approximate just intervals; the convergents explain why 12 notes per octave work well.
  • Diophantine approximation: algorithms that find small integer relations between real numbers (used in cryptography attacks) are built on continued fractions.

Continued fractions turn any number into a tower of integers, and their convergents are the sharpest rational approximations available for each denominator size. The Euclidean algorithm hands you the partial quotients of any fraction for free, and the pk/qk recurrence builds every convergent mechanically. From gear teeth to musical scales, whenever a real number must be squeezed into a small fraction, continued fractions show the way.