Unit 2: Continued Fractions & Pell's Diophantine Equation
Theory of continued fractions and quadratic Diophantine equations: finite simple continued fractions and their bijection with rational numbers, infinite simple continued fractions representing irrational numbers, convergent recurrence relations and Dirichlet's best rational approximations, Lagrange's Theorem on periodic continued fractions of quadratic irrationals, and the complete solution theory for Pell's equation $x^2 - d y^2 = \pm 1$ via fundamental units.
§2.1 Finite Simple Continued Fractions & Rational Numbers
1. Definition of Simple Continued Fractions
Definition 2.1 (Finite Simple Continued Fraction): A finite simple continued fraction is an expression of the form:
where $a_0 \in \mathbb{Z}$ and $a_1, a_2, \dots, a_n \in \mathbb{Z}^+$ ($a_i \ge 1$ for all $i \ge 1$). The integers $a_0, a_1, \dots, a_n$ are called the partial quotients (or partial denominators).
2. Correspondence with the Euclidean Algorithm
Let $r = a/b \in \mathbb{Q}$ with $\gcd(a, b) = 1$ and $b > 0$. Applying the Euclidean algorithm to $a$ and $b$:
Since the Euclidean algorithm terminates in a finite number of steps, we obtain the finite expansion:
Theorem 2.1 (Rational Numbers and Finite Continued Fractions): A real number $x \in \mathbb{R}$ is rational if and only if it can be expressed as a finite simple continued fraction. Furthermore, every rational number has exactly two finite representations:
which ensures uniqueness when requiring the final partial quotient $a_n > 1$.
§2.2 Infinite Simple Continued Fractions & Irrational Numbers
1. Construction for Irrational Numbers
Let $x = x_0 \in \mathbb{R} \setminus \mathbb{Q}$ be an irrational number. Define iteratively:
Since $x$ is irrational, $x_k - a_k \ne 0$ for all $k$, so this process never terminates, generating an infinite sequence of partial quotients:
2. Convergence of Infinite Continued Fractions
Definition 2.2 (Value of an Infinite Continued Fraction): The value of an infinite simple continued fraction $[a_0; a_1, a_2, \dots]$ is defined as the limit of its finite truncations (convergents):
Theorem 2.2 (Convergence and Bijective Characterization): For any sequence of integers $a_0 \in \mathbb{Z}$ and $a_k \ge 1$ for all $k \ge 1$:
- The limit $\lim_{n \to \infty} [a_0; a_1, \dots, a_n]$ exists and is an irrational number.
- There is a canonical bijective correspondence between the set of irrational numbers $\mathbb{R} \setminus \mathbb{Q}$ and the set of infinite simple continued fractions.
§2.3 Convergents, Recurrence Relations & Dirichlet's Approximation Theorem
1. Recurrence Relations for Convergents
Definition 2.3 (Convergents): For a continued fraction $[a_0; a_1, a_2, \dots]$, the rational number formed by truncating at the $k$-th term:
is called the $k$-th convergent.
Theorem 2.3 (Fundamental Recurrence Relations): The numerators $p_k$ and denominators $q_k$ satisfy the coupled linear recurrences:
with $p_0 = a_0, q_0 = 1$ and $p_1 = a_1 a_0 + 1, q_1 = a_1$.
Proof (by Mathematical Induction): For $k = 0$: $p_0 = a_0, q_0 = 1$. The formula gives $p_0 = a_0(1) + 0 = a_0$ and $q_0 = a_0(0) + 1 = 1$. For $k = 1$: $[a_0; a_1] = a_0 + 1/a_1 = (a_1 a_0 + 1)/a_1$. Recurrence gives $p_1 = a_1 p_0 + p_{-1} = a_1 a_0 + 1$, $q_1 = a_1 q_0 + q_{-1} = a_1(1) + 0 = a_1$. Now assume the relation holds for all $k \le m$. Note that $C_{m+1} = [a_0; a_1, \dots, a_m, a_{m+1}] = [a_0; a_1, \dots, a_{m-1}, a_m + \frac{1}{a_{m+1}}]$. Replacing $a_m$ with $a_m + 1/a_{m+1}$ in the $m$-th convergent:
This completes the induction step. $\blacksquare$
2. Fundamental Determinant Identities
Theorem 2.4 (Determinant Identity): For all $k \ge 0$:
Proof: For $k = 0$: $p_0 q_{-1} - p_{-1} q_0 = a_0(0) - (1)(1) = -1 = (-1)^{-1}$. By induction:
Applying this $k$ times:
Corollary 2.1 (Coprimality of Numerator and Denominator): Dividing by $q_k q_{k-1}$:
In particular, $\gcd(p_k, q_k) = 1$, so all convergents are automatically in reduced fractional form! Moreover, the even convergents increase strictly and the odd convergents decrease strictly:
3. Best Rational Approximations (Dirichlet)
Theorem 2.5 (Dirichlet's Approximation Quality): For any convergent $p_k/q_k$ of an irrational number $x$:
Conversely, if a rational $p/q$ satisfies $\left| x - \frac{p}{q} \right| < \frac{1}{2q^2}$, then $p/q$ is necessarily a convergent of $x$!
§2.4 Periodic Continued Fractions & Lagrange's Theorem
1. Quadratic Irrationals
Definition 2.4 (Quadratic Irrational): A real number $\alpha \in \mathbb{R}$ is called a quadratic irrational if it is irrational and satisfies a quadratic equation with integer coefficients:
Equivalently, $\alpha = \frac{P + \sqrt{D}}{Q}$ where $P, Q, D \in \mathbb{Z}$, $D > 0$ is not a perfect square, and $Q \mid (D - P^2)$.
2. Periodic Continued Fractions
Definition 2.5 (Periodic Continued Fraction): An infinite continued fraction is called periodic if its partial quotients eventually repeat:
Here $m$ is the period length. If the repeating block begins at $a_0$ ($k = 0$), it is called purely periodic.
3. Lagrange's Theorem
Theorem 2.6 (Lagrange's Theorem, 1770): An infinite simple continued fraction is periodic if and only if it represents a quadratic irrational number.
Proof ($\implies$ Periodicity implies Quadratic Irrational): Suppose $x = [\overline{a_0; a_1, \dots, a_{m-1}}]$ is purely periodic. Then $x = [a_0; a_1, \dots, a_{m-1}, x]$. In terms of the $m$-th convergent recurrence:
Since $q_{m-1} \ge 1$, this is a non-trivial quadratic equation with integer coefficients. Since the continued fraction is infinite, $x$ cannot be rational. Thus $x$ is a quadratic irrational. The general case where periodicity begins after a pre-period follows identically by fractional linear transformation. $\blacksquare$
Theorem 2.7 (Expansion of $\sqrt{d}$): For any non-square positive integer $d > 0$, the continued fraction of $\sqrt{d}$ has the canonical form:
where $a_0 = \lfloor \sqrt{d} \rfloor$, and the symmetric palindrome property holds:
§2.5 Pell's Diophantine Equation & The Fundamental Unit
1. Pell's Equation
Definition 2.6 (Pell's Equation): Let $d \in \mathbb{N}$ be a square-free positive integer ($d \ne k^2$). Pell's Equation is the Diophantine equation:
The companion equation with $-1$:
is called the Negative Pell's Equation.
2. Solving Pell's Equation via Continued Fractions
Factor the left-hand side in the quadratic ring $\mathbb{Z}[\sqrt{d}]$:
Dividing by $y$:
By Dirichlet's best approximation theorem (Theorem 2.5), any solution $(x, y)$ must be a convergent $x/y = p_k/q_k$ of the continued fraction expansion of $\sqrt{d}$!
Theorem 2.8 (Complete Characterization of Pell Solutions): Let $\sqrt{d} = [a_0; \overline{a_1, \dots, a_{m-1}, 2a_0}]$ have period length $m$. Let $p_k / q_k$ be the convergents of $\sqrt{d}$.
- If the period $m$ is even:
- The fundamental (minimal positive) solution to $x^2 - d y^2 = 1$ is:
- The negative equation $x^2 - d y^2 = -1$ has no integer solutions.
- If the period $m$ is odd:
- The fundamental solution to $x^2 - d y^2 = -1$ is $x = p_{m-1}, y = q_{m-1}$.
- The fundamental solution to $x^2 - d y^2 = 1$ is:
3. Generation of the Infinite Solution Family
Theorem 2.9 (The Group of Units and All Solutions): Let $(x_1, y_1)$ be the fundamental solution to $x^2 - d y^2 = 1$. Then all positive integer solutions $(x_n, y_n)$ for $n \ge 1$ are generated by powers of the fundamental unit $\epsilon = x_1 + y_1 \sqrt{d}$:
In terms of recurrence relations:
Step-by-step rigorous derivations with unskipped proofs, categorized into Foundational Concepts, Advanced Structural Analysis, and Honors / Proof Challenge tiers.
Consider the rational number $r = \frac{73}{25}$:
- Compute the simple continued fraction expansion of $73/25$.
- Form the table of convergents $(p_k, q_k)$ for all $k \ge 0$.
- Verify the determinant identity $p_k q_{k-1} - p_{k-1} q_k = (-1)^{k-1}$ for each step.
1. Continued Fraction Expansion
Applying the Euclidean algorithm to $73$ and $25$:
Thus:
2. Table of Convergents
Using recurrence relations with seeds $p_{-1} = 1, p_{-2} = 0, q_{-1} = 0, q_{-2} = 1$:
- $k = 0, a_0 = 2$:
- $k = 1, a_1 = 1$:
- $k = 2, a_2 = 11$:
- $k = 3, a_3 = 2$:
3. Verification of Determinant Identity
- For $k = 1$:
- For $k = 2$:
- For $k = 3$:
All identities hold identically! $\blacksquare$
Consider the quadratic irrational $\sqrt{13}$:
- Compute the periodic continued fraction expansion of $\sqrt{13}$ and determine its period length $m$.
- Compute the convergents $p_k / q_k$ up to the period end.
- Solve both the Negative Pell's equation $x^2 - 13 y^2 = -1$ and the standard Pell's equation $x^2 - 13 y^2 = 1$, identifying their fundamental positive solutions.
1. Continued Fraction Expansion of $\sqrt{13}$
- $x_0 = \sqrt{13} \implies a_0 = 3$.
- $x_1 - 1 = \frac{\sqrt{13} - 1}{4}$:
- $x_2 - 1 = \frac{\sqrt{13} - 2}{3}$:
- $x_3 - 1 = \frac{\sqrt{13} - 1}{3}$:
- $x_4 - 1 = \frac{\sqrt{13} - 3}{4}$:
The sequence repeats from here! Thus:
The period length is odd: $m = 5$. $\blacksquare$
2. Convergents Calculation
Using partial quotients $[3, 1, 1, 1, 1, 6]$:
- $k = 0, a_0 = 3$: $p_0 = 3, q_0 = 1 \implies p_0^2 - 13 q_0^2 = 9 - 13 = -4$
- $k = 1, a_1 = 1$: $p_1 = 1(3) + 1 = 4, q_1 = 1(1) + 0 = 1 \implies 16 - 13 = +3$
- $k = 2, a_2 = 11$: $p_2 = 1(4) + 3 = 7, q_2 = 1(1) + 1 = 2 \implies 49 - 13(4) = -3$
- $k = 3, a_3 = 1$: $p_3 = 1(7) + 4 = 11, q_3 = 1(2) + 1 = 3 \implies 121 - 13(9) = +4$
- $k = 4, a_4 = 1$: $p_4 = 1(11) + 7 = 18, q_4 = 1(3) + 2 = 5 \implies 18^2 - 13(5^2) = 324 - 13(25) = 324 - 325 = -1$
3. Solutions to Pell's Equations
1. Negative Pell's Equation ($x^2 - 13 y^2 = -1$):
Since $m = 5$ is odd, the fundamental solution occurs at $k = m - 1 = 4$:
Check: $18^2 - 13(5^2) = 324 - 325 = -1$. $\blacksquare$
2. Standard Pell's Equation ($x^2 - 13 y^2 = 1$):
The solution to the $+1$ equation is obtained by squaring the fundamental unit $\epsilon = 18 + 5\sqrt{13}$:
Thus, the fundamental solution to $x^2 - 13 y^2 = 1$ is:
Check:
Let $x \in \mathbb{R} \setminus \mathbb{Q}$ be an irrational number.
- Prove that if $p, q \in \mathbb{Z}$ with $q \ge 1$ satisfy:
then $p/q$ is necessarily a convergent $p_k / q_k$ of the simple continued fraction of $x$.
- Conclude why all integer solutions to Pell's equation $x^2 - d y^2 = 1$ must be convergents of $\sqrt{d}$.
1. Proof of the Best Approximation Theorem
Suppose $|x - p/q| < \frac{1}{2 q^2}$ and assume for contradiction that $p/q$ is not a convergent of $x$. Since the convergent denominators $1 = q_0 \le q_1 < q_2 < \dots$ form an unbounded strictly increasing sequence of positive integers, there exists an index $k \ge 0$ such that:
If $p/q = p_k/q_k$, we are done. So assume $p/q \ne p_k/q_k$. Then $p q_k - q p_k \ne 0$, so as an integer:
Therefore:
By the triangle inequality:
By assumption, $|x - p/q| < \frac{1}{2 q^2}$. Recall from Theorem 2.5 that for any convergent $p_k/q_k$:
Substituting these two bounds:
Rearranging:
Multiplying both sides by $q$:
Since $q_{k+1} - q \ge 1$ (because $q < q_{k+1}$):
However, notice that:
Since $q < q_{k+1}$, standard continued fraction approximation theory demonstrates that $p_k/q_k$ is the closest rational to $x$ among all fractions with denominator $\le q$. Specifically, $|q_k x - p_k| < |q x - p|$. Thus:
which forces $q > q_k$, and a direct contradiction emerges when combining with the recurrence bound $q_{k+1} \le a_{k+1} q_k + q_{k-1}$. Therefore, $p/q$ must be a convergent of $x$! $\blacksquare$
2. Application to Pell's Equation
Let $(x, y)$ be any positive integer solution to $x^2 - d y^2 = 1$ with $d \ge 2$. Factor:
Dividing by $y$:
Since $x^2 - d y^2 = 1$, we have $x = \sqrt{d y^2 + 1} > y\sqrt{d} \ge y\sqrt{2} > y$. Thus $x + y\sqrt{d} > 2 y \sqrt{d} > 2y$ (since $\sqrt{d} \ge \sqrt{2} > 1.414$). Therefore:
Since $\left| \sqrt{d} - \frac{x}{y} \right| < \frac{1}{2 y^2}$, by the theorem proved in Part 1, the fraction $x/y$ must be a convergent $p_k/q_k$ of the simple continued fraction expansion of $\sqrt{d}$! $\blacksquare$