Diophantine Equations
Diophantine Equations
Diophantine Equations
CMT: 2011-2012
Victor Wang
September 10, 2013
Loosely speaking, Diophantine equations (named after Diophantus of Alexandria) are equations over
the integers (or some subset of the integers), typically representing a rich mixture of algebraic and number
theoretic methods. Diophantine analysis can get very complicated1 , so we will restrict ourselves to the most
common elementary techniques in this handout.
Prime Factorization
Observing the exponents in the prime factorization of a number can yield much useful information. The
following examples illustrate this:
Example 1.1. Find the number of triples of integers (x, y, z) such that xyz = 720.
Solution. The prime factorization of 720 is 24 32 5. If we look only at the prime factors of x, y, z, we
see that the exponents of 2 in the factorizations of x, y, z must sum to 4, the exponents of 3 must sum to
2, and the exponents of 5 must sum to 0. The number of possible triples (a, b, c) that correspond to the
exponents of 2 in the prime factorizations of x, y, z is simply the number of number of nonnegative solutions
to a + b + c = 4, which is 15. Similarly, we find that the number of triples corresponding to the exponent
of 3 is 6, and the number of triples corresponding to the exponent of 5 is 3. Because the exponents of 2, 3,
and 5 are all independent of one another, the number of pairs (x, y, z) is simply 15 6 3 = 270.
Example 1.2. (Four numbers theorem) If ab = cd for positive integers a, b, c, d, show that there exist
positive integers x, y, z, w such that a = xy, b = zw, c = xz, and d = yw, where gcd(y, z) = 1.
Solution. As before, its enough to just consider the exponents of primes individually. For a fixed prime
p, we have vp (a) + vp (b) = vp (c) + vp (d), and we need to find x, y, z, w such that vp (x) + vp (y) = vp (a),
vp (z) + vp (w) = vp (b), vp (x) + vp (z) = vp (c), and vp (y) + vp (w) = vp (d), where min(vp (y), vp (z)) = 0. Now
its just a simple system of equations; see if you can finish the argument.
Theres also another perspective to this problem. Rewrite the equation as a/c = d/b = y/z, where
gcd(y, z) = 1 gives us the fraction a/c = d/b in reduced form. Then because its in reduced form, (a, c) =
(xy, xz) for some x (when we reduce a fraction, we take out the common divisors of the numerator and
denominator). Similarly, (d, b) = (wy, wz) for some integer w.
Example 1.3. If two numbers a and b are relatively prime, and ab is a perfect kth power, then a and b are
both perfect kth powes.
Solution. A number is a kth power if and only if each exponent in its prime factorization is divisible by k.
If the prime factors of a are entirely distinct from the prime factors of b, and the exponents of each of the
prime factors of ab are multiples of k, then the exponents of each of the prime factors of both a and b must
be multiples of k as well; thus, a and b are both perfect squares.
1 One well-known example is Fermats Last Theorem, which states that an + bn = cn has no solutions in positive integers
a, b, c for all integers n > 2. Although Pierre de Fermat claimed to have discovered a truly marvelous proof of this, which,
however, the margin is not large enough to contain, proof eluded the best of mathematicians for over three centuries until 1994,
when the British mathematician Andrew Wiles finally prevailed using the advanced machinery of elliptic curves and modular
forms.
Diophantine Equations
CMT: 2011-2012
Victor Wang
The following is an example of how the above can be applied:
Example 1.4. Solve y 2 = x3 x over the integers.
Solution. Factor x3 x as x(x2 1). Because x and x2 1 are relatively prime integers that multiply to a
square, they must both be squares. Thus, x2 1 must be a square, say, x2 1 = z 2 . Then (x z)(x + z) = 1,
which can only happen when x = 1 and y = 0.
Modular arithmetic
Sometimes, its difficult to analyze an equation just by algebraic manipulation, and we may need an extra
boost. In these cases, its often helpful to take it mod something, reducing our analysis down to a finite
number of possibilities, so sometimes, when only a few cases are possible, we can get a lot of information
(e.g. if we take an both sides of an equation modulo m, we may be able to place important restrictions on
the variables modulo m).
Example 2.1. Solve x2 + y 2 = 1003 over the positive integers.
Solution. Taking this equation mod 4, we have x2 + y 2 3 (mod 4). Since x2 and y 2 must be congruent
to either 0 or 1 mod 4, their sum must be congruent to either 0, 1, or 2 mod 4. In particular, it cannot be
congruent to 3 mod 4, so the equation has no solutions.
Here, we had squares (mod 4) (i.e. quadratic residues). In general, if you have squares, you should
consider modulo powers of 2 or primes, because there are relatively few quadratic residues and thus there
are fewer possibilities and more restrictions (e.g. only 2 possibilities modulo 4). For other dth powers in
general, it turns out that primes p congruent to 1 (mod d) work well. For instance, the only cubic residues
modulo 7 are 0, 1, 1. Keep in mind that sometimes (especially parity) mods will be only a small part of
the problem, but they can still make a big difference.
Example 2.2. Do there exist integers x1 , x2 , . . . , x2011 such that
x71 + x72 + + x72011 = 123
x1 + x2 + + x2011 = 321
Solution. There do not exist such integers. Suppose for the sake of contradiction that a solution exists. By
Fermats little theorem, x7i xi (mod 7). Thus, we have
321 = x1 + x2 + + x2011 x71 + x72 + + x72011 = 123
(mod 7),
which is false.
Algebraic Manipulation
Many times, Diophantine equations can be solved or simplified significantly through the use of algebraic
manipulation.
Example 3.1. Suppose that a 1 (mod p). Show that ap 1 (mod p2 ).
Solution. Let a = pk + 1. Then by the binomial theorem,
p 2 2
p
p
p
p
pk +
p k +
pk = p2 k 0
a 1 = (1 + pk) 1 =
1
2
1
as desired.
Example 3.2. Find all pairs of integers (x, y) with 0 < x < y and xy = y x .
(mod p2 ),
Diophantine Equations
CMT: 2011-2012
Victor Wang
Solution. There exists a solution to this using just number theory. We will not give it. Instead, we will use
calculus.
1
Rearrange this to x x = y y . Let f (x) = x x . We have f 0 (x) = x x 2 (ln x 1). Thus, f (x) is decreasing for
x > e and increasing for x < e. Thus, if f (x) = f (y) and x 6= y, we must have x < e < y. This means that
x = 1 or x = 2.
Consider the equation as xy = y x again. If x = 1, we must have y = 1 as well, which contradicts x < 1.
Thus, we need x = 2, so 2y = y 2 . We can show by induction that 2y > y 2 for y > 4, so either y = 3 or y = 4.
The solution y = 3 fails, so we must have y = 4. Thus, our only solution is (2, 4).
Example 3.3. Solve y 2 = x2 + y 3 x 1 over the positive integers.
Solution. This is a simple instance where the quadratic formula is the way to go, because it forces powerful
restrictions upon us. Fix y. Then we have a quadratic equation x2 + y 3 z (1 + y 2 ) = 0. We need the
discriminant to be a perfect square, or else by the quadratic formula, x is irrational. So
x = (y 3 )2 4(1)(1 y 2 ) = y 6 + 4y 2 + 4 = t2
for some positive integer t. Once again, we use the discreteness of the integers: its obvious that t > y 3 . But
were working with integers, so this means that t y 3 + 1, so
y 6 + 4y 2 + 4 = t2 (y 3 + 1)2 = y 6 + 2y 3 + 1.
Clearly, this inequality cannot hold for large y, because once we subtract y 6 from both sides, the RHS is
cubic in y and the LHS is quadratic in y. In fact, it holds only for y = 1 and y = 2 (prove this yourself!).
If y = 1, then we get x2 + x 2 = 0, and y = 2, then we get x2 + 8x 5 = 0. Only x2 + x 2 has integer
roots, so our only solution is (1, 1).
Pythagorean Triples
A Pythagoran triple is a triple of positive integers (a, b, c) such that a2 + b2 = c2 . For example, (3,4,5),
(6,8,10), (5,12,13), and (8,15,17) are Pythagorean triples. The Pythagorean triples can be classified as
follows:
Theorem 4.1. Suppose (a, b, c) is a Pythagorean triple. Then (a, b, c) = (k 2mn, k(m2 n2 ), k(m2 + n2 ))
or (k(m2 n2 ), k 2mn, k(m2 + n2 )) for some positive integer k and some relatively prime integers m, n.
Solution. If a, b, c share a common factor d > 1, then if (a, b, c) is a Pythagorean triple, (a/d, b/d, c/d) is
also a Pythagorean triple. Thus, we can assume that gcd(a, b, c) = 1. Taking the equation mod 4, we now
see that c has to be odd, and exactly one of a, b has to be even. Without loss of generality, let a be even.
We will show that (a, b, c) = (2mn, m2 n2 , m2 + n2 ) for some relatively prime integers (m, n), which will
complete the proof of this problem.
Let a = 2a0 . Rearrange a2 + b2 = c2 as 4a20 = c2 b2 = (c b)(c + b). If a prime p divides both
c b and c + b, it must divide (c b) + (c + b) = 2c and (c + b) (c b) = 2b. If p divides b and c, p
divides a2 = c2 b2 as well, meaning gcd(a, b, c) > 1, a contradiction. Thus, we would need p = 2. Since
c and b are both odd, c a and c + b are both even. Thus, (c b)/2 and (c + b)/2 are coprime. Since
a20 ((c b)/2)((c + b)/2), (c b)/2 and (c + b)/2 must both themselves be squares. Thus, c + b = 2m2 and
c b = 2n2 for some integers m, n. Solving, we have c = m2 + n2 , b = m2 n2 , and a = 2a0 = 2mn, as
desired.
Infinite Descent
The method of infinite descent is essentially an extremal argument: given a solution (sometimes we take it
to be minimal), we try to reduce it to either restrict the possible minimal solutions or show that there are
no (nontrivial) solutions in the first place.
3
Diophantine Equations
CMT: 2011-2012
Victor Wang
2 is irrational.
Solution. Suppose for the sake of contradiction that a/b = 2 for some positive integers a, b with a + b as
small as possible.
Then a2 = 2b2 , so by Euclids lemma 2 | a. But then letting c = a/2, we have 2c2 = b2 ,
Linear Diophantines
Problems
These are roughly ordered by difficulty (very roughly at the end). The problems in the beginning are more
computational (e.g. AMC/AIME style).
1. Solve the two equations x + 2y = 0 and x + 2y = 1 in integers x, y.
2. Solve the equation 6x + 10y 15z = 1 in integers x, y, z.
3. Find the number of ordered pairs (x, y) of nonnegative integers such that x + 2y = n, where n is a
fixed nonnegative integer.
4. Given an integer n and two relatively prime positive integers a, b, show that exactly one of n and
ab a b n is expressible in the form ax + by for some nonnegative integers x, y.
4
Diophantine Equations
CMT: 2011-2012
Victor Wang
5. (IMO?) Let a, b, c be pairwise relatively prime positive integers. Show that 2abc ab bc ca is the
largest integer that cannot be expressed in the form xbc + yca + zab, where x, y, z are nonnegative
integers.
6. Prove that there are arbitrarily long sequences of consecutive integers, none of which can be written
as the sum of two perfect squares.
7. (2011 AIME) Find the number of positive integers m for which there exist nonnegative integers
P2011
x0 , x1 , . . . , x2011 such that mx0 = k=1 mxk .
8. (2011 AIME) For some integer m, the polynomial x3 2011x + m has the three integer roots a, b, and
c. Find |a| + |b| + |c|.
9. (2009 AIME) The terms of the sequence (ai ) defined by an+2 =
Find the minimum possible value of a1 + a2 .
an +2009
1+an+1
10. (2008 AIME) Find the largest integer n such that n2 is the difference of two consecutive cubes and
2n + 79 is a perfect square.
11. (2008 AIME) There exist r unique nonnegative integers n1 > n2 > > nr and r unique integers ak
(1 k r) with each ak either 1 or 1 such that
a1 3n1 + a2 3n2 + + ar 3nr = 2008.
Find n1 + n2 + + nr .
12. (2000 AIME) A point whose coordinates are both integers is called a lattice point. How many lattice
points lie on the hyperbola x2 y 2 = 20002 ?
13. Solve x2 + 1 = 2y 4 over the integers.
14. Prove that the equation x4 = y 2 + z 2 + 4 has no integer solutions.
15. (St. Petersburg) Prove that the equation 3k = m2 + n2 + 1 has infinitely many solutions in positive
integers.
16. Let p > 2 be a prime. Prove that p 1 (mod 4) iff there exist integers x, y such that x2 py 2 = 1.
17. Solve the equation x3 + 117y 3 = 5 over the integers.
18. Find infinitely many integral solutions of (x2 + x + 1)(y 2 + y + 1) = z 2 + z + 1.
19. Does m3 + 6m2 + 5m = 27n3 + 9n2 + 9n + 1 have any integer solutions?
20. Solve 1! + 2! + + x! = y 2 over the positive integers.
21. Solve x2 + y 2 = 2z 2 over the positive integers.
22. Solve x2 + y 2 = 3z 2 over the positive integers.
23. (UK) Find all triples of positive integers such that 2 = 1 +
1
x
1+
1
y
1+
1
z
28. (IMO 1997) Find all pairs (a, b) of positive integers such that ab = ba .
5
Diophantine Equations
CMT: 2011-2012
Victor Wang
29. If n = a2 + b2 + c2 for positive integers a, b, c, show that there exist positive integers x, y, z such that
n2 = x2 + y 2 + z 2 .
30. Show that x2 + y 2 + z 2 = x3 + y 3 + z 3 has infinitely many integer solutions.
31. If d > 1 is a squarefree integer, show that x2 dy 2 = c gives some bounds in terms of a fundamental
solution.
32. Find all n such that x2 y 2 = n has integer solutions.
33. An odd positive integer is the product of n distinct primes. In how many ways can it be represented
as the difference of two squares?
34. If 3n + 1 and 4n + 1 are perfect squares, show that 56|n.
35. (ISL 1985) Are there integers m and n such that 5m2 6mn + 7n2 = 1985?
36. Prove that every Pythagorean triple contains a multiple of 5.
37. Solve x2 = 2n + 3n + 6n over the positive integers.
38. Solve x3 + 3y 3 + 9z 3 3xyz = 0 over the positive integers.
39. (Dirichlet) Solve x3 + 2y 3 + 4z 3 6xyz = 1 over the positive integers.
40. (ISL) Let M denote the number of integral solutions to the equation x2 y 2 = z 3 t3 with 0
x, y, z, t 106 , and let N be the number of such solutions with x2 y 2 = z 3 t3 + 1. Show that
M > N.
41. Solve x2 + 5y 2 = z 2 over the integers.
42. Prove that x5 y 2 = 4 has no integer solutions.
43. Prove that the equation 4xy x y = z 2 has no solutions in positive integers.
44. Show that x3 + y 3 + z 3 + t3 = 1999 has infinitely many integer solutions.
45. Show that (x + 1)2 + (x + 2)2 + + (x + 99)2 = y z is not solvable in integers x, y, z with z > 1.
46. Find all positive integer solutions to x2 y! = 2001.
2
Diophantine Equations
CMT: 2011-2012
Victor Wang
a3 +b3
c3 +d3
xn 1
x1
71. (ISL?) If a1 a2 + a2 a3 + + an1 an + an a1 = 0 with ai {1, 1} for all i, show that 4|n.
72. If p = a2 + nb2 = c2 + nd2 for a prime p and positive integers a, b, c, d, n, show that a = c.
73. (Engel) Find the smallest positive integer of the form |12m 5n | for two integers m, n.
74. Find all primes p such that (p 1)! + 1 is a perfect power of p.
75. (Brazil 2010) Solve 3a 1 = 2b2 over the positive integers.
76. (China 2010) Find all positive integers m, n 2 such that m + 1 3 (mod 4) is a prime number and
for some prime number p and nonnegative integer a,
n
m2 1 1
= mn + pa .
m1
77. (Russia 2011) For an integer a, let P (a) be a largest prime positive divisor of a2 + 1. Prove that there
exist infinitely many triples of distinct positive integers (a, b, c) such that P (a) = P (b) = P (c).
78. (Russia 2005) Integers x > 2, y > 1, z > 0 satisfy xy + 1 = z 2 . If p denotes the number of different
prime divisors of x and q denotes the number of prime divisors of y, prove that p q + 2.
79. (Victor Wang) Solve y 2 = 8x4 8x2 + 1, y 2 = 20x4 4x2 + 1, and y 2 = 2x4 2x2 + 1 over the integers.
Diophantine Equations
CMT: 2011-2012
Victor Wang
80. Rational approximation dude. If d is a positive integer and not a perfect square, show that x2 dy 2 = 1
has a solution in positive integers x, y.
81. (nnosipov, AoPS) Find the least positive constant c for which
m
m
c
< 34 <
+
n
n
mn
has infinitely many solutions in positive integers m, n.
82. (David Yang) If (x 1)(y 1), xy, (x + 1)(y + 1) are all perfect squares for some positive integers
x, y > 1, show that x = y.
83. (nnosipov, AoPS) Are there rational numbers x, y, z such that x2 y 2 = 2011 = z 2 x2 ?
84. Find all positive integer solutions satisfying both x2 + y 2 = zt and z 2 t2 = 2xy.
85. If z 2 = 4 +
x2 +1
y2
86. (nnosipov, AoPS) For some positive integers x and y, the number x2 is divisible by 2xy + y 2 1. Prove
that 2x divides y 2 1.
87. Find all integers p, q such that (p2 q 2 + 4pq)2 12p2 q 2 is a perfect square.
88. (Bulgaria) Let a, b, c be positive integers such that ab divides c(c2 c + 1) and a + b is divisible by
c2 + 1. Prove that {a, b} = {c, c2 c + 1}.
89. (ISL 2000) Prove that there exist infinitely many positive integers n such that p = nr where p and r
are the semiperimeter and the inradius of a triangle with integer side lengths, respectively.
90. Find all functions f : N N such that for all m, n N,
(2m + 1)f (n)f (2m n) = 2m f (n)2 + f (2m n)2 + (2m 1)2 n.
91. (China) Let x < y be positive integers and
P =
x3 y
.
1 + xy
an1 + nk
n 1,
n
Diophantine Equations
CMT: 2011-2012
Victor Wang
96. (ISL 2009) Find all positive integers n such that there exists a sequence of positive integers a1 , a2 , . . . , an
satisfying
a2 + 1
ak+1 = k
1
ak1 + 1
for every k with 2 k n 1.
97. (Euler) Show that there are infinitely many quadruples of positive integers (a1 , a2 , a3 , a4 ) such that
ai aj + 1 is a perfect square for all 1 i < j 4.
98. (Kiran Kedlaya) Given positive integers x, y, z such that (xy + 1)(yz + 1)(zx + 1) is a perfect square,
show that each of xy + 1, yz + 1, zx + 1 is a perfect square itself.