Diophantine Equations

Pythagorean triples, Pell's equation, and Fermat's Last Theorem.


A Diophantine equation is a polynomial equation, in one or more unknowns, for which we seek integer — or sometimes rational — solutions. Named after the Alexandrian mathematician Diophantus of Alexandria, who compiled his landmark Arithmetica around 250 CE, this field sits at the intersection of elementary arithmetic and deep modern theory. The pursuit of integer solutions to polynomial equations drives some of the most celebrated results and most stubbornly open problems in all of mathematics, from the ancient Pythagorean triples to Andrew Wiles’s twentieth-century proof of Fermat’s Last Theorem.

Linear Diophantine Equations

The simplest Diophantine equations are linear, and they already reveal how the structure of the integers constrains what kinds of solutions are possible. A linear Diophantine equation in two variables has the form ax+by=cax + by = c, where aa, bb, and cc are fixed integers and we seek integer pairs (x,y)(x, y).

The key fact governing solvability is Bézout’s identity, a cornerstone of elementary number theory: the equation ax+by=cax + by = c has an integer solution if and only if gcd(a,b)\gcd(a, b) divides cc. When the divisibility condition fails — say, we ask for 6x+4y=56x + 4y = 5 — no integer solution can exist, since every value of 6x+4y6x + 4y is even, yet the right-hand side is odd. When the condition holds, solutions not only exist but come in infinite families.

Suppose d=gcd(a,b)d = \gcd(a, b) divides cc. We can find one particular solution (x0,y0)(x_0, y_0) using the extended Euclidean algorithm, which computes integers ss and tt such that as+bt=das + bt = d. Multiplying through by c/dc/d gives a particular solution. From there, the general solution takes the form

x=x0+bdt,y=y0adt,tZ.x = x_0 + \frac{b}{d}\,t, \qquad y = y_0 - \frac{a}{d}\,t, \qquad t \in \mathbb{Z}.

The parameter tt ranges over all integers, generating an infinite arithmetic progression of solutions. Notice that consecutive solutions differ by the step sizes b/db/d and a/d-a/d, which are coprime to each other — a reflection of the fact that the solution lattice has a very regular structure.

Systems of linear Diophantine equations are handled via the Chinese Remainder Theorem and its generalizations. The theorem, attributed to the Chinese mathematician Sun Tzu around the 3rd century CE, states that a system of congruences xai(modmi)x \equiv a_i \pmod{m_i} for pairwise coprime moduli mim_i has a unique solution modulo m1m2mkm_1 m_2 \cdots m_k. This is the Diophantine analogue of solving a linear system over a field, and it has applications ranging from ancient calendar calculations to modern cryptography.

Linear Diophantine equations in three or more variables follow the same philosophy. The equation a1x1+a2x2++anxn=ca_1 x_1 + a_2 x_2 + \cdots + a_n x_n = c is solvable in integers if and only if gcd(a1,,an)\gcd(a_1, \ldots, a_n) divides cc, and when solvable, the solution space forms a lattice — a discrete, periodically-spaced set of points in Zn\mathbb{Z}^n. The study of such lattices, and of shortest or most natural lattice vectors, connects linear Diophantine problems to modern lattice-based cryptography and to the geometry of numbers pioneered by Hermann Minkowski around 1896.

Quadratic Forms and Sums of Squares

Moving from linear to quadratic equations opens a much richer landscape, and the central objects are quadratic forms — homogeneous degree-2 polynomials in several variables. A binary quadratic form is an expression f(x,y)=ax2+bxy+cy2f(x, y) = ax^2 + bxy + cy^2 with integer coefficients, and the central question is: which integers nn can be represented as f(x,y)f(x, y) for some integers xx and yy?

The discriminant of ff is D=b24acD = b^2 - 4ac. Forms with the same discriminant are grouped together, and two forms ff and gg are equivalent if one can be transformed into the other by an invertible integer change of variables — such a transformation preserves which integers are represented. The collection of equivalence classes of forms with a fixed discriminant forms a finite group called the class group, whose order is the class number h(D)h(D).

The prototypical example is the form x2+y2x^2 + y^2, which represents sums of two squares. A fundamental theorem, conjectured by Albert Girard in 1625 and proven by Pierre de Fermat (though Fermat, characteristically, left no written proof), states that an odd prime pp is a sum of two squares if and only if p1(mod4)p \equiv 1 \pmod{4}. In other words, p=x2+y2p = x^2 + y^2 has an integer solution precisely when pp is one more than a multiple of four. The prime 5=12+225 = 1^2 + 2^2 qualifies; the prime 33 does not. The full characterization of which integers nn are representable as x2+y2x^2 + y^2 follows: nn is a sum of two squares if and only if in the prime factorization of nn, every prime of the form 4k+34k + 3 appears to an even power.

The elegant proof of Fermat’s two-squares theorem uses the Gaussian integers Z[i]={a+bi:a,bZ}\mathbb{Z}[i] = \{a + bi : a, b \in \mathbb{Z}\}, where i2=1i^2 = -1. In this ring, the norm of a+bia + bi is a2+b2a^2 + b^2, and the question of writing an integer as a sum of two squares becomes a question of factoring in Z[i]\mathbb{Z}[i]. The Gaussian integers form a unique factorization domain, and a prime p1(mod4)p \equiv 1 \pmod{4} factors in Z[i]\mathbb{Z}[i] as p=ππˉp = \pi \bar{\pi} where π\pi and πˉ\bar{\pi} are conjugate Gaussian primes — giving p=Re(π)2+Im(π)2p = \text{Re}(\pi)^2 + \text{Im}(\pi)^2 directly.

Lagrange’s four-square theorem, proven in 1770 by Joseph-Louis Lagrange, goes further: every positive integer is the sum of four perfect squares. No fewer than four squares suffice in general, since integers of the form 4a(8b+7)4^a(8b + 7) cannot be written as a sum of three squares — a result also due to Legendre and Gauss. The form x2+y2+z2+w2x^2 + y^2 + z^2 + w^2 has discriminant 4-4 and represents every positive integer without exception, making it the simplest universal quadratic form. The number of representations r4(n)r_4(n) of nn as a sum of four squares is given by the beautiful formula

r4(n)=8dn4dd,r_4(n) = 8 \sum_{\substack{d \mid n \\ 4 \nmid d}} d,

a result connecting quadratic forms to divisibility sums and, ultimately, to modular forms — a thread we will pick up in the final section.

Pell’s Equation and Continued Fractions

Pell’s equation x2Dy2=1x^2 - Dy^2 = 1, where DD is a positive non-square integer, is perhaps the most celebrated Diophantine equation with infinitely many solutions. Despite its name, the equation was solved centuries before John Pell (1611–1685), who merely had his name attached to it through a historical misattribution by Leonhard Euler. The correct credit belongs to Indian mathematicians: the chakravala (cyclic) method for solving Pell’s equation was developed by Brahmagupta in the 7th century and perfected by Bhaskara II around 1150 CE. European mathematicians, including William Brouncker and Fermat (who posed the problem as a challenge), rediscovered solutions in the 17th century.

The equation always has a nontrivial solution when DD is not a perfect square. The smallest positive solution (x1,y1)(x_1, y_1), called the fundamental solution, generates all other solutions. If (x1,y1)(x_1, y_1) is the fundamental solution, then all solutions are given by

(xn+ynD)=(x1+y1D)n,n=1,2,3,(x_n + y_n \sqrt{D}) = (x_1 + y_1 \sqrt{D})^n, \qquad n = 1, 2, 3, \ldots

This multiplicative structure — solutions forming a free cyclic group under the operation of multiplication in Z[D]\mathbb{Z}[\sqrt{D}] — is one of the most elegant facts in elementary number theory.

The connection to continued fractions is indispensable for actually finding the fundamental solution. The continued fraction expansion of D\sqrt{D} is eventually periodic: it has the form D=[a0;a1,a2,,ak]\sqrt{D} = [a_0; \overline{a_1, a_2, \ldots, a_k}]. The convergents pn/qnp_n/q_n of this continued fraction provide the best rational approximations to D\sqrt{D}, and the fundamental solution to Pell’s equation is found among these convergents. Specifically, if kk is the period length of the continued fraction, then (x1,y1)=(pk1,qk1)(x_1, y_1) = (p_{k-1}, q_{k-1}) when kk is even, and (p2k1,q2k1)(p_{2k-1}, q_{2k-1}) when kk is odd.

As a concrete example, consider D=2D = 2. The continued fraction is 2=[1;2]\sqrt{2} = [1; \overline{2}] with period 11. The convergents begin 1/1,3/2,7/5,17/12,1/1, 3/2, 7/5, 17/12, \ldots. Indeed, 32222=98=13^2 - 2 \cdot 2^2 = 9 - 8 = 1, so (3,2)(3, 2) is the fundamental solution. The sequence of solutions grows exponentially: (3,2),(17,12),(99,70),(577,408),(3, 2), (17, 12), (99, 70), (577, 408), \ldots, where each pair satisfies xn22yn2=1x_n^2 - 2y_n^2 = 1.

The generalized Pell equation x2Dy2=Nx^2 - Dy^2 = N for N1N \neq 1 is more subtle. It may have no solutions, finitely many, or infinitely many depending on NN and DD. Solutions to the generalized equation can be found by combining a particular solution with the solutions to the homogeneous equation x2Dy2=1x^2 - Dy^2 = 1.

Pell’s equation is not merely a curiosity of elementary number theory. In the language of algebraic number theory, solving x2Dy2=1x^2 - Dy^2 = 1 is equivalent to finding the units of the ring of integers Z[D]\mathbb{Z}[\sqrt{D}]. Dirichlet’s unit theorem, proven in 1846, generalizes this: the units of the ring of integers of any number field form a finitely generated abelian group, and for real quadratic fields Q(D)\mathbb{Q}(\sqrt{D}), there is exactly one fundamental unit, just as Pell’s equation has a fundamental solution generating all others. This connection elevates Pell’s equation from an elementary puzzle to a gateway into algebraic number theory.

Exponential Diophantine Equations

When the exponents themselves become unknowns, equations grow dramatically more difficult. Exponential Diophantine equations involve variables appearing as exponents, and they are typically studied case by case, with each family requiring its own bespoke techniques.

The equation xpyq=1x^p - y^q = 1 with x,y,p,q>1x, y, p, q > 1 asks for consecutive perfect powers. Except for 8=238 = 2^3 and 9=329 = 3^2, are there any? This question, known as Catalan’s conjecture, was posed by the Belgian mathematician Eugène Catalan in 1844. It remained open for over 150 years until Preda Mihailescu proved in 2002 that 88 and 99 are indeed the only consecutive perfect powers, confirming Catalan’s conjecture. Mihailescu’s proof uses the theory of cyclotomic fields — number fields generated by roots of unity — and shows that any solution to xpyq=1x^p - y^q = 1 would force a vast array of arithmetic constraints that turn out to be mutually contradictory.

Zsygmondy’s theorem (also attributed to Birkhoff and Vandiver) gives a powerful general tool for exponential problems. It states that for integers a>b1a > b \geq 1 with gcd(a,b)=1\gcd(a, b) = 1 and n3n \geq 3, the number anbna^n - b^n has at least one prime factor that does not divide akbka^k - b^k for any positive k<nk < n — a so-called primitive prime divisor — with only finitely many exceptions. This means that exponential sequences anbna^n - b^n grow by acquiring genuinely new prime factors, ruling out many potential solutions to exponential equations by divisibility arguments.

Pillai’s conjecture asks whether for each fixed positive integer kk, the equation axby=ka^x - b^y = k has only finitely many solutions in positive integers a,b,x,ya, b, x, y with min(x,y)>1\min(x, y) > 1. This remains open in general and represents the “next level” beyond Catalan’s theorem. Special cases are known — for instance, axby=1a^x - b^y = 1 (Catalan’s case k=1k = 1) is now settled — but the general conjecture requires tools not yet available.

The Lifting the Exponent Lemma (LTE) is an elementary but powerful tool for exponential Diophantine problems. For an odd prime pp with pabp \mid a - b and pap \nmid a, pbp \nmid b, the lemma states

vp(anbn)=vp(ab)+vp(n),v_p(a^n - b^n) = v_p(a - b) + v_p(n),

where vp(m)v_p(m) denotes the largest power of pp dividing mm. This gives precise control over the pp-adic valuation of differences of powers and is a standard ingredient in competition mathematics as well as in more advanced research.

Divisibility sequences provide another unifying framework. A sequence (un)(u_n) of integers is a divisibility sequence if mnm \mid n implies umunu_m \mid u_n. The Fibonacci sequence and Lucas sequences are classic examples. Many exponential Diophantine problems reduce to questions about which terms of a divisibility sequence can be perfect powers or have unusually small prime factors, and Zsygmondy-type theorems give the sharpest available answers.

Fermat’s Last Theorem and Modern Methods

Fermat’s Last Theorem states that the equation xn+yn=znx^n + y^n = z^n has no solution in positive integers x,y,zx, y, z for any exponent n3n \geq 3. Pierre de Fermat famously claimed in 1637 — in a marginal note in his copy of Diophantus’s Arithmetica — that he had found a marvelous proof, but that the margin was too small to contain it. This tantalizing comment set off over three and a half centuries of mathematical effort before the theorem was finally proven by Andrew Wiles in 1994, with a corrected argument completed in 1995 with Richard Taylor.

The case n=4n = 4 was settled by Fermat himself using infinite descent — his most powerful and original technique. The idea is to show that any supposed solution leads to a strictly smaller solution, contradicting the fact that positive integers are bounded below by zero. Specifically, Fermat proved there are no pythagorean triples (a,b,c)(a, b, c) with cc a perfect square, which handles n=4n = 4. The case n=3n = 3 was settled by Leonhard Euler in 1770, though his proof had a gap filled later. By the time of Wiles, the cases n=5n = 5 (Legendre, 1825) and n=7n = 7 (Lamé, 1839) were also known. Since it suffices to prove the theorem for prime exponents p5p \geq 5 (any composite nn reduces to a smaller case), the remaining obstacle was a vast family of infinitely many prime exponents.

The modern proof proceeds through the Modularity Theorem (formerly the Taniyama-Shimura-Weil conjecture). The key steps are as follows. Suppose for contradiction that ap+bp=cpa^p + b^p = c^p for some prime p5p \geq 5. Gerhard Frey observed in 1985 that one could construct from such a solution an elliptic curve

E:y2=x(xap)(x+bp),E: y^2 = x(x - a^p)(x + b^p),

now called the Frey curve. Frey conjectured that this curve would be too “weird” to be modular — that is, it could not correspond to any modular form. Jean-Pierre Serre formalized this intuition, and Kenneth Ribet proved in 1986 that the Frey curve cannot be modular, assuming the epsilon conjecture (now Ribet’s theorem). Wiles then proved the crucial remaining piece: every semistable elliptic curve over Q\mathbb{Q} is modular. Since the Frey curve is semistable, this gives a contradiction, proving there can be no solution.

The Modularity Theorem, in its full form proven by Christophe Breuil, Brian Conrad, Fred Diamond, and Richard Taylor in 2001, states that every elliptic curve over Q\mathbb{Q} is modular — that is, its L-function coincides with the L-function of a modular form of weight 2. This is a manifestation of the Langlands program, the vast web of conjectural and proven correspondences between arithmetic objects (Galois representations, elliptic curves, algebraic varieties) and analytic objects (automorphic forms, L-functions) that has dominated number theory since the 1960s.

The proof of Fermat’s Last Theorem did not resolve Diophantine questions — it opened them. The techniques developed by Wiles and collaborators immediately found applications to other exponential Diophantine equations. For instance, the generalized Fermat equation xp+yq=zrx^p + y^q = z^r with 1/p+1/q+1/r<11/p + 1/q + 1/r < 1 is conjectured (by Beal, with a prize offered) to have no coprime positive integer solutions, but this remains open. The ABC conjecture, proposed by Joseph Oesterlé and David Masser in 1985, is a single sweeping inequality that, if true, would imply Fermat’s Last Theorem, Catalan’s conjecture, and much more with a uniform argument; Shinichi Mochizuki claimed a proof in 2012 using his “Inter-universal Teichmüller theory,” but the mathematical community has not yet reached a consensus on its validity.

The thread connecting Pythagorean triples to Fermat’s Last Theorem illustrates how Diophantine equations remain the sharpest lens through which number theorists examine the deep structure of the integers. The parametrization of Pythagorean triples as (m2n2,2mn,m2+n2)(m^2 - n^2, 2mn, m^2 + n^2) — already known to the Babylonians and systematized by the Greeks — is at heart a statement about rational points on the unit circle X2+Y2=1X^2 + Y^2 = 1. The jump from degree 2 to degree 3 in the exponents transforms a completely solvable equation into an empty one, mediated by the full machinery of modern algebraic geometry. As we pass to higher dimensions and more general varieties, the interplay between algebraic structure and arithmetic solutions — the heart of what Diophantus began — continues to generate the deepest and most fertile questions in mathematics.