Folioby Interconnected
Log InSign Up

Continued Fractions and Diophantine Approximation — The Theory of Rational Approximation

We define finite and infinite continued fractions, prove convergence, and rigorously establish the properties of convergents. We develop the theory of best rational approximations, solve the Pell equation x^2 - Dy^2 = 1 via continued fractions, and discuss the Stern--Brocot tree.

FO
Folio Official
March 1, 2026

1 Definition of Continued Fractions

Definition 1 (Finite continued fraction).
For a0​∈Z and a1​,a2​,…,an​∈Z>0​, the expression
[a0​;a1​,a2​,…,an​]=a0​+a1​+a2​+⋱+an​1​1​1​1​
is called a finite continued fraction. The ai​ are called the partial quotients.
Theorem 2.
Every rational number can be expressed as a finite continued fraction, and the computation corresponds to the Euclidean algorithm.
Proof.
Given r=p/q with q>0, the division algorithm gives p=a0​q+r1​ with 0≤r1​<q. If r1​=0, then r=a0​. If r1​>0, then r=a0​+r1​/q=a0​+1/(q/r1​), and we repeat the process with q/r1​. Since the Euclidean algorithm terminates in finitely many steps, so does this procedure, yielding a finite continued fraction. □

2 Convergents

Definition 3 (Convergent).
The k-th convergent of [a0​;a1​,…,an​,…] is Ck​=pk​/qk​=[a0​;a1​,…,ak​], where pk​ and qk​ are defined by the recurrence
pk​=ak​pk−1​+pk−2​,qk​=ak​qk−1​+qk−2​
with initial values p−1​=1, p−2​=0, q−1​=0, q−2​=1.
Theorem 4 (Fundamental properties of convergents).
  1. pk​qk−1​−pk−1​qk​=(−1)k−1 for all k≥0.

  2. gcd(pk​,qk​)=1.

  3. C0​<C2​<C4​<⋯<α<⋯<C5​<C3​<C1​, where α is the value of the infinite continued fraction.

Proof.
(1) By induction on k. For k=0: p0​q−1​−p−1​q0​=a0​⋅0−1⋅1=−1=(−1)−1. Inductive step: pk​qk−1​−pk−1​qk​=(ak​pk−1​+pk−2​)qk−1​−pk−1​(ak​qk−1​+qk−2​)=−(pk−1​qk−2​−pk−2​qk−1​)=−(−1)k−2=(−1)k−1.

(2) From (1), pk​qk−1​−pk−1​qk​=±1, so gcd(pk​,qk​)∣1.

(3) Since Ck​−Ck−1​=(pk​qk−1​−pk−1​qk​)/(qk​qk−1​)=(−1)k−1/(qk​qk−1​), even-indexed convergents increase and odd-indexed ones decrease. One also verifies that Ck​−Ck−2​=(−1)k−1ak​/(qk​qk−2​), confirming that the even subsequence is strictly increasing and the odd subsequence is strictly decreasing. □

3 Convergence of Infinite Continued Fractions

Theorem 5.
For a0​∈Z and ai​∈Z>0​ (i≥1), the limit limk→∞​Ck​ exists.
Proof.
Since qk​≥qk−1​+qk−2​, the sequence (qk​) is strictly increasing with qk​→∞. Thus ∣Ck​−Ck−1​∣=1/(qk​qk−1​)→0. By the monotone convergence theorem, the even and odd subsequences each converge, and since the gap between consecutive convergents tends to zero, both limits must coincide. □

4 Best Rational Approximation

Theorem 6.
The convergent pk​/qk​ provides the best rational approximation in the following sense: for any rational number p/q with 1≤q≤qk​ and p/q=pk​/qk​, we have ∣qk​α−pk​∣<∣qα−p∣.
Proof.
Let p/q=pk​/qk​ with 1≤q≤qk​. We express p/q as an integer linear combination of pk​/qk​ and pk−1​/qk−1​. Since pk​qk−1​−pk−1​qk​=(−1)k−1, the matrix (qk​pk​​qk−1​pk−1​​) has determinant ±1, so there exist integers s,t with q=sqk​+tqk−1​ and p=spk​+tpk−1​.

Since p/q=pk​/qk​, we have t=0. The constraints q≤qk​ and qk−1​≥1 restrict s and t (for instance, if s=0, then q=tqk−1​≤qk​ with t≥1).

Now qα−p=s(qk​α−pk​)+t(qk−1​α−pk−1​). By property (3) of convergents, the terms qk​α−pk​ and qk−1​α−pk−1​ have opposite signs. The condition q≥1 forces s(qk​α−pk​) and t(qk−1​α−pk−1​) to have the same sign (or one to vanish), so
∣qα−p∣=∣s∣⋅∣qk​α−pk​∣+∣t∣⋅∣qk−1​α−pk−1​∣≥∣qk−1​α−pk−1​∣>∣qk​α−pk​∣.
The last inequality follows from the precise estimate ∣qk​α−pk​∣=∣Ck​−α∣⋅qk​<1/qk+1​≤1/qk​ combined with ∣Ck−1​−α∣>∣Ck​−α∣ and qk−1​<qk​. □
Remark 7.
This theorem expresses the deep fact that the convergents of a continued fraction provide the best rational approximations to a real number, subject to a constraint on the size of the denominator.

5 The Pell Equation

Theorem 8.
Let D be a positive integer that is not a perfect square. The Pell equation x2−Dy2=1 has infinitely many positive integer solutions. The smallest solution (x1​,y1​) is obtained from the convergents of the continued fraction expansion of D​, and every solution is given by (xn​,yn​) where xn​+yn​D​=(x1​+y1​D​)n.
Proof.
The continued fraction expansion D​=[a0​;a1​,…,ar​​] is periodic. The convergent pr−1​/qr−1​ at the end of the first period satisfies pr−12​−Dqr−12​=(−1)r. If r is even, (pr−1​,qr−1​) is the smallest solution; if r is odd, (p2r−1​,q2r−1​) is the smallest solution. That all solutions arise as powers of (x1​+y1​D​) follows from the multiplicativity of the norm map on Z[D​]. □
Example 9.
Consider x2−2y2=1. Since 2​=[1;2], the convergents are C0​=1/1, C1​=3/2. Checking: 32−2⋅22=1, so the smallest solution is (3,2). The next solution: (3+22​)2=17+122​, giving (17,12).
Number TheoryAlgebraTextbookContinued FractionsPell Equation
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Number Theory TextbookPart 10 of 13
Previous
Arithmetic Functions and Multiplicative Functions — Functions on the Integers
Next
Chebyshev's Estimates: 0.92 x/ln x < π(x) < 1.11 x/ln x and the Prime Number Theorem

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

Introduction to Algebraic Integers — Extending the Notion of Integer

Using the Gaussian integers Z[i] and the Eisenstein integers Z[omega] as concrete examples, we introduce rings of algebraic integers. We demonstrate the failure of unique factorization in Z[sqrt(-5)] and show how ideals and prime ideal factorization restore uniqueness. We define the class number and discuss its significance.

Number TheoryAlgebraTextbook
2
Folio Official·March 1, 2026

Arithmetic Functions and Multiplicative Functions — Functions on the Integers

We systematically define the principal multiplicative functions (phi, sigma, mu, d), develop the ring structure of Dirichlet convolution, and give a rigorous proof of the Moebius inversion formula. We also clarify the connection to the inclusion-exclusion principle.

Number TheoryAlgebraTextbook
Folio Official·March 1, 2026

Primes and the Fundamental Theorem of Arithmetic — The Atomic Decomposition of Integers

We define prime numbers and establish their basic properties, including Euclid's proof of the infinitude of primes. We then give a rigorous proof of the fundamental theorem of arithmetic (existence and uniqueness of prime factorization), and discuss the sieve of Eratosthenes and the Miller--Rabin primality test.

Number TheoryAlgebraTextbook
Folio Official·March 1, 2026

Chebyshev's Estimates: 0.92 x/ln x < π(x) < 1.11 x/ln x and the Prime Number Theorem

Chebyshev proved that 0.92 x/ln x < π(x) < 1.11 x/ln x for sufficiently large x. This article gives a complete proof via binomial coefficients and the Chebyshev functions θ(x) and ψ(x), then traces the path to the prime number theorem π(x) ~ x/ln x.

Number TheoryAlgebraTextbook