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 FractionsLagrange'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 ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesSet Operations: Union, Intersection, and ComplementProof by CasesProving by Cases and ExhaustionVacuous Truth and Trivial CasesProof by Cases (Proof by Exhaustion)Mathematical InductionDivisibility and Greatest Common DivisorThe Euclidean AlgorithmContinued FractionsPell's Equation

Longest path: 78 steps · 358 total prerequisite topics

Prerequisites (1)

Leads To (1)