A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Pell's Equation

Graduate Depth 77 in the knowledge graph ☐ I know this ☆ Set as goal
4topics build on this
358prerequisites beneath it
See this on the map →
Continued Fractions→→Lagrange's Four-Square Theorem
diophantine pell continued-fractions

Core Idea

Pell's equation x² − Dy² = 1, where D is a non-square positive integer, always has infinitely many positive integer solutions. Solutions arise via the periodic continued fraction expansion of √D, and the fundamental solution generates all others via multiplication in ℚ(√D).

Explainer

Pell's equation x² - Dy² = 1 asks for integer points on a hyperbola that are in an extraordinarily precise sense "close to √D." To see why, rewrite the equation as x/y ≈ √D: if (x, y) is a solution, then (x/y)² ≈ D, so x/y is a rational approximation to √D with error |x/y - √D| ≈ 1/(2y²√D). Your prerequisite — continued fractions — provides exactly the tool for finding such best-rational-approximations systematically.

The continued fraction expansion of √D is eventually periodic for any non-square positive integer D. For example, √2 = [1; 2, 2, 2, ...] and √3 = [1; 1, 2, 1, 2, ...]. The convergents p_n/q_n of this expansion are the best rational approximations to √D: no fraction with a smaller denominator gets closer. The connection to Pell's equation is that the convergents at the end of each complete period satisfy p_n² - Dq_n² = ±1 exactly — and among those, every other period gives +1. The fundamental solution (x₁, y₁) is the smallest positive solution, always found at the first period completion.

A concrete example: for D = 2, the continued fraction is [1; 2, 2, ...] with period 1, and the first convergent is p₁/q₁ = 3/2. Check: 3² - 2·2² = 9 - 8 = 1. ✓ For D = 3, the period is [1; 1, 2], so the first convergent at period-end is 2/1, but 4 - 3 = 1, giving (2, 1). Check: 4 - 3·1 = 1. ✓ The algorithm is completely mechanical once you can compute the periodic continued fraction.

Once you have the fundamental solution (x₁, y₁), all others are generated by a remarkable algebraic structure. Think of ε₁ = x₁ + y₁√D as an element of the algebraic number system ℚ(√D). The equation x² - Dy² = 1 is equivalent to (x + y√D)(x - y√D) = 1, meaning these elements have norm 1. Multiplying two norm-1 elements gives another norm-1 element: ε₁ⁿ = xₙ + yₙ√D yields the n-th solution (xₙ, yₙ). For D = 2: ε₁ = 3 + 2√2, so ε₁² = 17 + 12√2, giving (17, 12). Check: 17² - 2·12² = 289 - 288 = 1. ✓ The continued fraction finds the seed; the algebraic structure of ℚ(√D) generates the infinite family.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Set Operations: Union, Intersection, and Complement → Proof by Cases → Proving by Cases and Exhaustion → Vacuous Truth and Trivial Cases → Proof by Cases (Proof by Exhaustion) → Mathematical Induction → Divisibility and Greatest Common Divisor → The Euclidean Algorithm → Continued Fractions → Pell's Equation

Longest path: 78 steps · 358 total prerequisite topics

Prerequisites (1)

Leads To (1)