Number Theory: Lecture Notes
Number Theory: Lecture Notes
Lecture Notes
Vahagn Aslanyan1
1 www.math.cmu.edu/~vahagn/
Contents
1 Divisibility 3
1.1 Greatest common divisors . . . . . . . . . . . . . . . . . . . . 3
1.2 Linear Diophantine equations . . . . . . . . . . . . . . . . . . 4
1.3 Primes and irreducibles . . . . . . . . . . . . . . . . . . . . . . 4
1.4 The fundamental theorem of arithmetic . . . . . . . . . . . . . 5
1.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Multiplicative functions 7
2.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 The Möbius inversion formula . . . . . . . . . . . . . . . . . . 8
2.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Modular arithmetic 11
3.1 Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Wilson’s theorem . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Fermat’s little theorem . . . . . . . . . . . . . . . . . . . . . . 12
3.4 The Chinese Remainder Theorem . . . . . . . . . . . . . . . . 12
3.5 Euler’s totient function . . . . . . . . . . . . . . . . . . . . . . 13
3.6 Euler’s theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Primitive roots 17
4.1 The order of an element . . . . . . . . . . . . . . . . . . . . . 17
4.2 Primitive roots modulo a prime . . . . . . . . . . . . . . . . . 18
4.3 Primitive roots modulo prime powers . . . . . . . . . . . . . . 19
4.4 The structure of (Z/2k Z)× . . . . . . . . . . . . . . . . . . . . 20
4.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5 Quadratic residues 23
5.1 The Legendre symbol and Euler’s criterion . . . . . . . . . . . 23
5.2 Gauss’s lemma . . . . . . . . . . . . . . . . . . . . . . . . . . 24
iii
iv CONTENTS
7 Diophantine equations 33
7.1 The Pythagorean equation . . . . . . . . . . . . . . . . . . . . 33
7.2 A special case of Fermat’s last theorem . . . . . . . . . . . . . 34
7.3 Rational points on quadratic curves . . . . . . . . . . . . . . . 35
7.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
8 Continued fractions 39
8.1 Finite continued fractions . . . . . . . . . . . . . . . . . . . . 39
8.2 Representation of rational numbers by continued fractions . . 41
8.3 Infinite continued fractions . . . . . . . . . . . . . . . . . . . . 41
8.4 Periodic continued fractions . . . . . . . . . . . . . . . . . . . 44
8.5 Pell’s equation . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
8.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
9 Diophantine approximations 51
9.1 Dirichlet’s theorem . . . . . . . . . . . . . . . . . . . . . . . . 51
9.2 Better approximations . . . . . . . . . . . . . . . . . . . . . . 52
9.3 Transcendental numbers and Liouville’s theorem . . . . . . . . 53
9.4 Transcendence of e . . . . . . . . . . . . . . . . . . . . . . . . 55
9.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
11 Chebyshev’s theorem 65
11.1 Basic estimates . . . . . . . . . . . . . . . . . . . . . . . . . . 65
11.2 Proof of Chebyshev’s theorem . . . . . . . . . . . . . . . . . . 67
11.3 On the prime number theorem . . . . . . . . . . . . . . . . . . 68
11.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
CONTENTS v
Bibliography 70
Preface
These are lecture notes for the Number Theory course taught at CMU
in Fall 2017 and Fall 2018. I used several texts when preparing these notes.
In particular, most of the material can be found in [Bak12, Gre17, HW80].
The books [Bak12, HW80] go way beyond the material of these notes and
the reader is referred to those books for more advanced topics.
Synopsis
Divisibility in the ring of integers, primes, the fundamental theorem of arith-
metic. Multiplicative functions, the Möbius inversion formula. Modular
arithmetic, Wilson’s theorem, Fermat’s little theorem, Euler’s theorem, the
Chinese Remainder Theorem. Primitive roots. Quadratic residues, Gauss’s
law of quadratic reciprocity. Fermat’s theorem on sums of two squares, La-
grange’s theorem on sums of four squares. Some classical Diophantine equa-
tions. Continued fractions, Pell’s equation. Diophantine approximations,
Liouville numbers, algebraic and transcendental numbers. Quadratic num-
ber fields, Gaussian integers. Chebyshev’s theorem, a weak version of the
prime number theorem.
Notations
• The sets of natural numbers1 (positive integers), integers, rationals, re-
als and complex numbers will be denoted by N, Z, Q, R, C respectively.
1
The standard convention is that 0 ∈ N but in this course it is more convenient to
assume 0 is not a natural number.
1
2 CONTENTS
• For a real number x its integral part, denoted [x], is the greatest integer
which does not exceed x. The fractional part of x is defined as {x} =
x − [x].
Divisibility
Definition 1.2. The greatest common divisor of two integers a and b, de-
noted gcd(a, b), is defined as a positive number d which divides a and b and
is divisible by every common divisor of a and b.
Proposition 1.3. The greatest common divisor of any two numbers a and
b, which are not simultaneously zero, exists and is unique. It is the biggest
among the common divisors of a and b.
Lemma 1.4. For any integers a, b there are integers x, y such that
gcd(a, b) = ax + by.
Proof 1. This follows immediately from the proof of the previous result.
Proof 2. (Euclid’s algorithm)
Let a = bq0 + r0 for some 0 ≤ r0 < b. If r0 = 0 then gcd(a, b) = b.
Otherwise let b = q1 r0 + r1 with 0 ≤ r1 < r0 . Now if r1 = 0 then gcd(a, b) =
3
4 CHAPTER 1. DIVISIBILITY
Definition 1.6. Two integers are called coprime or relatively prime if their
greatest common divisor is 1.
Proof. There are integers x, y such that ax+by = 1. This implies acx+bcy =
c. Now a divides the left hand side and so it must divide the right hand side
as well.
ax + by = c
Proof. If the equation has a solution (x0 , y0 ) then obviously d | ax0 + by0 = c.
Conversely, if c = dl then since d = am + bn for some integers m, n, we know
that (ml, nl) is a solution.
If (x, y) and (x0 , y0 ) are two solutions then a(x − x0 ) + b(y − y0 ) = 0.
Denote u = x − x0 , v = y0 − y. Then au = bv. If a = da0 , b = db0 then
gcd(a0 , b0 ) = 1 and a0 u = b0 v and so a0 | v, b0 | u. Therefore v = a0 k, u = b0 k
for some integer k. The result follows.
Here 1 and −1 are the only units of the ring Z, that is, integers with a
multiplicative inverse in Z.
Lemma 1.10. An integer p is prime iff it is irreducible.
Proof. Suppose p is prime and p = ab. But then p | ab, hence p | a or p | b.
Assume the former holds. On the other hand a and b divide p. This shows
that b = ±1 and a = ±p.
Now suppose p is irreducible and p | ab. If p - a then gcd(p, a) = 1.
Therefore p | b.
Note that primes and irreducibles may not coincide in other rings.
Lemma 1.11. Every non-zero integer has a prime divisor.
Proof. The number min{d : 1 < d, d | n} is a prime divisor of n.
1.5 Exercises
1. Show that
4. Show that a natural number is divisible by 3 iff the sum of its digits is
divisible by 3.
9. Prove that for every positive integer n there are n consecutive numbers
none of which is prime.
10. Show that if for a positive integer n the number 2n + 1 is prime then n
must be a power of 2.
12. Prove that there are infinitely many primes of the form 4k + 3, k ∈ N.
ap + b p
!
gcd a + b, = 1 or p.
a+b
Chapter 2
Multiplicative functions
2.1 Basics
Definition 2.1. A function f : N → C is multiplicative if f (1) = 1 and
whenever m, n are coprime natural numbers, we have f (mn) = f (m)f (n).
P
Lemma 2.2. If f is multiplicative and g(n) = d|n f (d) then g is also mul-
tiplicative.
Proof. If gcd(m, n) = 1 then any divisor d of mn can be factored into a
product ab with a | m and b | n. The numbers a and b are determined
uniquely by d, m, n. Therefore
X X X
g(mn) = f (d) = f (ab) = f (a)f (b)
d|mn a,b:a|m,b|n a,b:a|m,b|n
X X
= f (a) · f (b) = g(m)g(n).
a|m b|n
Example 2.3. If τ (n) and σ(n) are respectively the number and the sum
of all positive divisors of a natural number n, then those are multiplicative.
P P
Indeed, τ (n) = d|n 1 and σ(n) = d|n d and the functions f (n) = 1 and
f (n) = n are obviously multipliactive.
An important multiplicative function, namely Euler’s totient function,
will be introduced in the next chapter.
The following is obvious.
Lemma 2.4. If f is multiplicative and n = i pki i is the prime factorisation
Q
of n then
f (pki i ).
Y
f (n) =
i
7
8 CHAPTER 2. MULTIPLICATIVE FUNCTIONS
is multiplicative as well.
Lemma 2.6.
0, if n > 1,
ν(n) =
1, if n = 1.
Proof. Since both the left hand side and the right hand side are multiplicative
functions, it suffices to establish the equality for n = pk for primes p. This
is left as an exercise.
Proof. We have
Proposition 2.8. If X
f (n) = µ(d)g(n/d)
d|n
P
then g(n) = d|n f (d).
Proof. We have
2.3 Exercises
1. For a complex number s denote
ds .
X
σs (n) :=
d|n
|µ(d)| = 2k .
P
2. If n has k distinct prime factors, show that d|n
3. Prove that
X µ(d)2 n
= .
d|n
ϕ(d) ϕ(n)
√
4. Prove that τ (n) ≤ 2 n for all n ∈ N.
Chapter 3
Modular arithmetic
3.1 Congruences
Definition 3.1. For a, b, m ∈ Z with m 6= 0 it is said that a is congruent to
b modulo m, written a ≡ b mod m, if m | b − a.
This gives rise to residue classes mod m. More precisely for an integer a
we denote [a]m := {b ∈ Z : a ≡ b mod m}. Obviously mZ = {mk : k ∈ Z}
is an ideal of the ring of integers and [a]m = a + mZ is just its coset with a
representative a. Then the quotient ring Z/mZ consists of the residue classes
modulo m and the operations are defined by
(a + Z/mZ) + (b + Z/mZ) = (a + b) + Z/mZ,
(a + Z/mZ) · (b + Z/mZ) = (ab) + Z/mZ.
We will often identify a + mZ with the integer a and by abuse of notation
write Z/mZ = {0, 1, . . . , m − 1}.
Definition 3.2. For a ring R its multiplicative group R× is the set of all
invertible elements of R which is a group under multiplication of the ring.
Lemma 3.3. For m 6= 0 we have
(Z/mZ)× = {a + mZ : gcd(a, m) = 1}.
Note that here gcd(a, m) does not depend on the choice of the represen-
tative a.
Proof. Clearly, a + mZ is invertible iff ak ≡ 1 mod m for some integer k.
Such a k exists iff gcd(a, m) = 1.
Corollary 3.4. If p is prime then every non-zero element in Z/pZ is invert-
ible. Hence it is a field and is normally denoted by Fp .
11
12 CHAPTER 3. MODULAR ARITHMETIC
Remark 3.7. This is equivalent to the following: ap ≡ a mod p for all integers
a.
This is a special case of Euler’s theorem that we prove later. The standard
proof of Fermat’s little theorem presented in textbooks is actually a special
case of the proof of Euler’s theorem. To avoid repetition, we now give a
different proof to Fermat’s theorem.
This follows immediately from the following result which is also known
as the Chinese Remainder Theorem.
Qn
Theorem 3.9. Let m1 , . . . , mm be pairwise coprime and denote M := i=1 mi .
Then
Z/M Z ∼ = Z/m1 Z × · · · × Z/mn Z.
3.5. EULER’S TOTIENT FUNCTION 13
Proof 2. Consider the multiplicative group (Z/mZ)× and its subgroup (a)
generated by a. If the latter has order (cardinality) n then an = 1. By
Lagrange’s theorem n divides the order of the group (Z/mZ)× which is ϕ(m).
Thus, aϕ(m) = 1 in (Z/mZ)× and we are done.
Corollary 3.17 (Fermat’s little theorem). If p is prime and p - a then
ap−1 ≡ 1 mod p.
Proof. When p is prime, ϕ(p) = p − 1.
3.7. EXERCISES 15
3.7 Exercises
1. Find a positive integer x such that x ≡ 2 mod 4, 2x ≡ 3 mod 9, 7x ≡
1 mod 11.
2. Suppose a28 +28b is prime for some positive integers a and b > 1. Prove
that 2 | b or 29 | a.
Primitive roots
Proof. Denote k := ordm (a) and let n ≡ l mod k with 0 ≤ l < k. Then
al ≡ 1 mod m and by minimality of k we must have l = 0.
The second part of the lemma follows from the first part and Euler’s
theorem (or from Lagrange’s theorem directly).
Definition 4.3. If ordm (a) = ϕ(m) then a is called a primitive root modulo
m.
17
18 CHAPTER 4. PRIMITIVE ROOTS
X p−1 − 1 = (X d − 1)g(X).
Theorem 4.8. For every prime p there is a primitive root mod p. Equiva-
lently, F×
p is cyclic.
Remark 4.9. This proof actually shows that every finite subgroup of the
multiplicative group of a field is cyclic.
Proof 2. For each divisor d | p − 1 let Ad := {a ∈ Fp : ordp (a) = d} and
ψ(d) := |Ad |. Clearly, (Ad )d|p−1 is a partition of F×
p . Therefore
X
ψ(d) = p − 1.
d|p−1
d
Now suppose Ad 6= ∅ and let a ∈ Ad . Then ordp (ak ) = gcd(d,k) for each k.
In particular, ordp (a ) = d iff gcd(d, k) = 1, hence the set Ad ∩{1, a, . . . , ad−1 }
k
has ϕ(d) elements. Thus ψ(d) ≥ ϕ(d). We claim that the equality holds.
Indeed, let b ∈ F× p with ordp (b) = d. Then b is a root of the polynomial
X − 1. However, the latter has exactly d roots and those are 1, a, . . . , ad−1 .
d
Proof. The proof is split into two steps presented in the following claims.
Claim. If g is a primitive root mod p then either g or g + p must be a
primitive root mod p2 .
Let g be a primitive root mod p. Denote k := ordp2 (g). We have k |
ϕ(p2 ) = p(p − 1) and g k ≡ 1 mod p2 . Since ordp (g) = p − 1, k must be
divisible by p − 1. Thus k = p(p − 1) or k = p − 1. In the former case g is
a primitive root modulo p. So assume k = p − 1, that is, g p−1 ≡ 1 mod p2 .
Then
(Z/mZ)× ∼
= (Z/pk11 Z)× × · · · × (Z/pks s Z)× ,
which is cyclic iff m is not divisible by 8 and the numbers ϕ(pk11 ), . . . , ϕ(pks s )
are pairwise coprime. Since ϕ(pk ) is even for an odd p, the result follows.1
Example 4.16. Let us decompose the group (Z/360Z)× into a direct product
of cyclic groups. By the Chinese Remainder Theorem we have
(Z/360Z)× ∼
= (Z/23 Z)× × (Z/32 Z)× × (Z/5Z)× ∼
= C2 × C2 × C6 × C4 .
22 CHAPTER 4. PRIMITIVE ROOTS
4.5 Exercises
1. Let n > 0 be an integer. Prove that n | ϕ(2n − 1).
2. Show that if g1 and g2 are primitive roots modulo an odd prime p, then
g1 g2 is not a primitive root modulo p.
3. Find all positive integers n for which the congruence a25 ≡ a mod n
holds for all integers a.
7. Let p be an odd prime. Prove that there is a number 1 < g < p which
is a primitive root modulo pn for every positive integer n.
Chapter 5
Quadratic residues
23
24 CHAPTER 5. QUADRATIC RESIDUES
are all the roots of the above polynomial, that is, if a is a quadratic non-
p−1
residue then a 2 6= 1 in Fp . However, we know that ap−1 = 1 and since Fp is
p−1 p−1
a field, a 2 = ±1. Thus, if a is a quadratic non-residue then a 2 = −1.
Proof. The first two are evident and the third one follows from Euler’s cri-
terion.
Remark 5.7. The third property states that the product of two quadratic
residues is a quadratic residue, the product of a quadratic residue and a non-
residue is a non-residue, and the product of two quadratic non-residues is a
quadratic residue. These could be deduced directly from definitions. Indeed,
the first two statements are obvious, while the third one follows from the first
two and the pigeonhole principle.
p p
t = # x : 0 < x < , qx ≡ a mod p for some a ∈ − , 0 .
2 2
Given x as above, there is a unique a ∈ − p2 , p2 with qx ≡ a mod p.
Furthermore, there is a unique integer
y such that a = qx − py. Moreover,
p qx−a q
if − 2 < a < 0 then y = p ∈ 0, 2 (since it is an integer). Therefore
q
t = #E2 = t2 and p
= (−1)t2 .
p
Similarly, q
= (−1)t3 . Thus, to prove the theorem we need to show
that
(p − 1)(q − 1)
− (t2 + t3 )
4
is even. But this number is equal to #E − #E2 − #E3 = t1 + t4 . Observe
that the map (x, y) 7→ p+1 2
− x, q+1
2
− y is a bijection from E1 onto E4 .
Hence t1 = t4 and t1 + t4 is indeed even.
The law of quadratic reciprocity, along with the results on the quadratic
nature of −1 and 2, gives an algorithm for determining whether a given
number is a quadratic residue modulo a prime.
Is −6
Example 5.11. aquadratic
residue modulo p = 113?
−6 −1 2 3
We have p = p p p
.
Since p ≡ 1 mod 4, −1 p
= 1. Also, p ≡ 1 mod 8 and so 2
p
= 1.
By the reciprocity law
3 113 113 2
(3−1)(113−1)
= (−1) 4 = = = −1.
113 3 3 3
−6
Thus, 113
= −1.
Proof. Let xi be an integer with x2i ≡ a mod pki i . By the Chinese Remainder
Theorem there is an integer x such that x ≡ xi mod pki i . Now it is easy to
see that x2 ≡ a mod m.
x2 = a + pk b.
y 2 ≡ a mod pk+1
Now let us explore quadratic residues modulo powers of 2. All odd num-
bers are quadratic residues modulo 2, and quadratic residues modulo 4 are
exactly the numbers of the form 4n + 1.
5.5 Exercises
1. Show that a primitive root modulo an odd prime is a quadratic non-
residue.
28 CHAPTER 5. QUADRATIC RESIDUES
Representation of integers by
some quadratic forms
a1 u + b 1 ≡ a2 u + b 2 mod p.
29
30CHAPTER 6. REPRESENTATION OF INTEGERS BY SOME QUADRATIC FORMS
6.3 Exercises
1. Describe (in terms of congruences) all primes p which can be expressed
as p = x2 + 2y 2 for some x, y ∈ Z.
Chapter 7
Diophantine equations
x2 + y 2 = z 2
33
34 CHAPTER 7. DIOPHANTINE EQUATIONS
Reducing the equation modulo 4 we see that z is odd and exactly one of
x, y is even. Since the equation is symmetric with respect to x and y, we can
assume that y is even. Furthermore, it suffices to find positive solutions and
so we can assume x, y, z > 0.
Thus, the theorem follows from the following claim.
Claim. All primitive positive solutions of the Pythagorean equation with y
even are given by x = a2 − b2 , y = 2ab, z = a2 + b2 where a, b ∈ N with
gcd(a, b) = 1 and a > b.
Let y = 2w. We write the equation in the form
z−x z+x
w2 = · .
2 2
xn + y n = z n
with n > 2 does not have any positive integer solutions. This turned out
to be an extremely difficult problem solved by A. Wiles in 1995 (after being
unsuccessfully attacked by many mathematicians for about 350 years).
It is easy to see that in order to prove Fermat last theorem, it is enough
to prove it for n = 4 and odd prime values of n. We consider the case n = 4
below. It is also interesting to note that the equation for n = 2 has infinitely
many solutions while for n > 2 it does not have any solutions.
7.3. RATIONAL POINTS ON QUADRATIC CURVES 35
Case 1. First suppose y is even. By Theorem 7.1 there are coprime integers
a, b such that
x = a2 − b2 , y 2 = 2ab, z 2 = a2 + b2 .
Assume a is even and b is odd. From the third equation we deduce
that a = 2uv, b = u2 − v 2 for some relatively prime integers u, v. Now
(y/2)2 = uv(u2 − v 2 ) hence u = p2 , v = q 2 , u2 − v 2 = r2 for some integers
p, q, r (since u, v, u2 − v 2 are mutually coprime). Therefore
r 2 + q 4 = p4 .
Thus, assuming (x, y, z) is a positive solution to (2.1), we found another pos-
itive solution (r, q, p) with p < z. Applying the same procedure to this new
solution, we will find yet another solution the third coordinate of which is
smaller than p. This can be repeated indefinitely which will yield an infinite
strictly decreasing sequence of positive integers which is a contradiction.
Case 2. Now suppose x is even. Then by Theorem 7.1 there are coprime
integers a, b such that
x = 2ab, y 2 = a2 − b2 , z 2 = a2 + b2 .
Therefore (yz)2 + b4 = a4 and a < z. This leads to a contradiction as
above.
Remark 7.3. The method of the proof, invented by Fermat, is known as the
method of infinite descent.
Corollary 7.4. The equation x4 + y 4 = z 4 has no positive integer solutions.
y = t(x − x0 ) + y0 .
The line l intersects the quadratic curve C in two points one of which is
(x0 , y0 ). Let (x1 , y1 ) ∈ R2 be the other point of intersection. It may actually
coincide with (x1 , y1 ) if l is tangent to C. The abscissa x1 is a root of
the quadratic polynomial f (X, t(X − x0 ) + y0 ). Since one of the roots of
this polynomial, namely x0 , is rational, and its coefficients are rational, the
second root must be rational as well. Therefore x1 is rational and hence
y1 = t(x1 − x0 ) + y0 is rational too.
Thus, there is a one-to-one correspondence between rational points on C
and lines with rational slope passing through (x0 , y0 ). This gives an algorithm
for finding all rational solutions of (3.2). We just need to solve the equation
f (x, t(x − x0 ) + y0 ) for x. Note that since x0 is a root, the root x1 will be
given by a rational function of t, that is, x1 = r(t) for some r(X) ∈ Q(X).
So for each rational value of t the point (r(t), t(r(t) − x0 ) + y0 ) is a solution of
(3.2) and all solutions are of that form. In other words we found a rational
parametrisation of the quadratic curve C. One says in this case that C is
rational.
x2 + y 2 = 1.
1
One says that C(R) is the set of R-rational points of the curve given by the equation
(3.2)
7.4. EXERCISES 37
This can be used to find all integer solutions of the Pythagorean equation
x2 + y 2 = z 2 .
x 1 − t2 y 2t
= , = .
z 1 + t2 z 1 + t2
b
Let t = a
with gcd(a, b) = 1. Then
x a2 − b 2 y 2ab
= 2 2
, = 2 .
z a +b z a + b2
Hence
x = a2 − b2 , y = 2ab, z = a2 + b2 .
Remark 7.6. Here we implicitly assumed that a and b have different parities
in order to deduce the last qualities from the previous ones. We leave it as
an exercise for the reader to prove that when both a and b are odd, x, y and
z can be written as x = 2mn, y = m2 − n2 , z = m2 + n2 for some integers
m, n with gcd(m, n) = 1.
7.4 Exercises
1. Find all integer solutions of the equation y 2 = x3 + 16.
2. Find all pairs (x, y) of positive rational numbers such that x2 +3y 2 = 1.
Continued fractions
39
40 CHAPTER 8. CONTINUED FRACTIONS
In the second equality we used the induction hypothesis and the above re-
mark.
pn qn−1 − pn−1 qn = (an pn−1 + pn−2 )qn−1 − pn−1 (an qn−1 + qn−2 )
= −(pn−1 qn−2 − pn−2 qn−1 ) = −(−1)n−2 = (−1)n−1 .
pn pn−1 (−1)n−1
• − = ,
qn qn−1 qn−1 qn
pn pn−2 (−1)n an
• − = .
qn qn−2 qn−2 qn
Lemma 8.6. The sequence x2n is strictly increasing and x2n+1 is strictly
decreasing. Furthermore, x2n < x2m+1 for every m, n.
Proof. The first part follows immediately from the second identity of Corol-
lary 8.5 (note that qn is positive).
For the second part, first botice that x2n < x2n+1 according to the first
identity of Corollary 8.5. If n ≤ m then x2n ≤ x2m < x2m+1 , and if n ≥ m
then x2n < x2n+1 ≤ x2m+1 .
Thus, if the value of the continued fraction is x then x2n ≤ x and x2m+1 ≥
x, and equality holds only once when the index is equal to N .
8.2. REPRESENTATION OF RATIONAL NUMBERS BY CONTINUED FRACTIONS41
Proposition 8.13. Two infinite continued fractions are equal if and only if
all their corresponding partial quotients are equal. Furthermore, an infinite
continued fraction cannot be equal to a finite one.
Proof. Indeed, if the value is rational then the continued fraction algorithm
terminates. This contradicts uniqueness.
√ 1
2 = [1, 2, 2, . . .] = 1 + .
1
2+
2 + ...
44 CHAPTER 8. CONTINUED FRACTIONS
f (X, Y ) = aX 2 + bXY + cY 2 .
pn
If qn
is the n-th convergent to u then the substitution
X = pn X 0 + pn−1 Y 0 , Y = qn X 0 + qn−1 Y 0
8.4. PERIODIC CONTINUED FRACTIONS 45
fn (X 0 , Y 0 ) = an X 02 + bn X 0 Y 0 + cn Y 02
where
It is easy to see that b2n − 4a2n c2n = d. This also follows from the fact that
the above transformation has determinant pn qn−1 − pn−1 qn = (−1)n−1 and
hence it does not change the discriminant of the form.
Since f (u, 1) = 0, we have
! !
an p2n pn
2
= a 2 − u2 + b −u .
qn qn qn
pn pn
We know that u − < 1
< 1, hence u + ≤ |u| + pqnn < (2|u| + 1).
qn
2
qn qn
Therefore
|an | 2|u| + 1 1
< |a| + |b| .
qn2 qn2 qn2
Thus, |an | < |a|(2|u| + 1) + |b| and the right hand side does not depend on n.
So we showed that the sequence an is bounded, hence cn = an−1 is bounded.
Also, b2n = 4a2n c2n + d and bn is bounded as well.
Now let u = [a0 , a1 , . . .] and un = [an , an+1 , . . .] be the n-th complete
quotient of u. Then
pn un+1 + pn−1
u=
qn un+1 + qn−1
and
fn (un+1 , 1) = f (pn un+1 +pn−1 , qn un+1 +qn−1 ) = (qn un+1 +qn−1 )2 ·f (u, 1) = 0.
Proof. Assume x > 1 and −1 < x̄ < 0. Let x = [a0 , a1 , . . .] and let xn =
[an , an+1 , . . .] be the n-th complete quotient.
First, a0 > 0 as x > 1. Further, we show by induction that −1 < x̄n < 0.
1 1
Since xn = an + xn+1 , we have x̄n = an + x̄n+1 . Hence −1 < x̄n+1 < 0 by the
induction hypothesis. h i
1 1
Now − x̄n+1 = an − x̄n and 0 < −x̄n < 1, hence an = − x̄n+1 .
1 1
We know that xn = xn+l for some n, l. Hence x̄n = x̄n+l . This implies
an−1 = an+l−1 which shows in its turn that xn−1 = xn−1+l . Repeating this
argument we get x0 = xl and we are done.
Conversely, if x = [a0 , a1 , . . .] is purely periodic then a0 = al ≥ 1 for some
l > 0. So x > a0 ≥ 1.
Moreover,
pn x + pn−1
x=
qn x + qn−1
and therefore
qn x2 + (qn−1 − pn )x − pn−1 = 0.
The roots of the above quadratic equation are x and x̄, hence x · x̄ =
− pn−1
qn
< 0. In particular x̄ < 0 as x > 0.
Recall that even convergents of a continued fraction are less than its value
while odd convergents are greater. So if n is even, then pn−1
qn
< pqnn < x since
pn is increasing. And if n is odd, then pn−1
qn
pn
< qn−1 < x since qn is increasing.
Therefore x · x̄ > −x and x̄ > −1.
x2 − dy 2 = 1 (5.1)
8.5. PELL’S EQUATION 47
is known as Pell’s equation. We are going to apply the results of the last
section to solve Pell’s equation.
First, notice that for all d there is a trivial solution (±1, 0). We will first
show that for all d there is a non-trivial solution.
p2n−1 − dqn−1
2
= −(pn qn−1 − pn−1 qn ) = (−1)n = 1
since n is even.
Thus, for every even multiple n of m the pair (pn−1 , qn−1 ) is a solution to
Pell’s equation. So there are infinitely many non-trivial solutions.
Proof. If x > 0, y > 0 then z > x ≥ 1. Conversely, if z > 1 then 0 < z̄ < 1,
hence x > 0, −y < 0.
48 CHAPTER 8. CONTINUED FRACTIONS
√
Definition 8.26. The number z1 = min{z ∈ Z[ d] : z > 1, z z̄ = 1} is
called the fundamental solution of the equation (5.2).
Proposition 8.27. All solutions of the equation (5.2) are given by ±z1m , m ∈
Z.
Proof. Since z1 z¯1 = 1, z1m · z1m = (z1 z̄1 )m = 1. Now, taking into account
that z1−1 = z̄1 , it suffices to show that for every solution z with z > 1 there
is a positive integer m such that z = z1m . As z1 > 1 there is m > 0 such
that z1m ≤ z < z1m+1 . If the first inequality is strict then z 0 := zzm satisfies
1
z 0 · z¯0 = 1 and 1 < z 0 < z1 which contradicts the definition of z1 . This finishes
the proof.
√
Remark 8.28. The above proposition shows that if z1 = x1 + y1 d then all
solutions of Pell’s equation are given by
√ √ √ √
(x1 + y1 d)n + (x1 − y1 d)n (x1 + y1 d)n − (x1 − y1 d)n
x=± , y=± √ ,
2 2 d
where n is a positive integer.
Alternatively,
√ n if xn , yn , n > 0, are determined from the equation xn +yn =
(x1 + y1 d) then all solutions are given by (±xn , ±yn ). The trivial solutions
correspond to n = 0.
Remark 8.29. In the proof of Lemma 8.24 if we choose n = (m, 2), that
is, m = n if n is even and m = 2n if n is odd, then (pn−1 , qn−1 ) is the
fundamental solution of Pell’s equation. Though we will not prove this, it
gives an algorithm for solving the equation. Moreover, all solutions of Pell’s
equation are of the form (pn−1 , qn−1 ) where n is an even multiple of m.
x2 − 2y 2 = 1.
√
Since 2 = [1, 2], (3, 2) is the fundamental solution. So all solutions are of
the form
√ √ √ √ !
(3 + 2 2)n + (3 − 2 2)n (3 + 2 2)n − (3 − 2 2)n
± , ± √ .
2 2 2
8.6 Exercises
√ √ 1
1. Find the continued fraction representation of the numbers 2, − 23
6
, 5, 7, √3 .
8.6. EXERCISES 49
(i) x2 − 3y 2 = 1,
(ii) x2 − 6y 2 = 1.
4. Prove that the sum of the first n natural numbers is a perfect square
for infinitely many n.
Diophantine approximations
Proof. Consider the numbers {0x}, {x}, {2x}, . . . , {(Q − 1)x}, 1.1 By the
pigeonhole principle, we can choose two of these numbers the distance of
which is at most 1/Q. Assume first for some 0 ≤ i < j < Q we have
|{ix} − {jx}| ≤ 1/Q. This means
Corollary 9.2. If x is irrational then there are infinitely many fractions p/q
such that |x − p/q| < 1/q 2 .
Proof. For an arbitrary Q let p, q be such that |qx − p| ≤ 1/Q < 1/q. Then
1
|x − p/q| < 1/q 2 so there is at least one such p/q. Now let Q > qx−p be an
0 0
arbitrary integer and let p , q be such that
51
52 CHAPTER 9. DIOPHANTINE APPROXIMATIONS
Proof. We show that at least one of any two consecutive convergents to (the
continued fraction of) x satisfies the desired inequality. Indeed, we have
pn pn+1 p
n+1 pn 1 1 1
x − + x − = − = < 2 + 2 ,
qn qn+1 qn+1 qn qn qn+1 2qn 2qn+1
Proof. Here we show that at least one of any three consecutive convergents
to x must satisfy the required inequality.
Suppose for some n
pk 1
x − ≥ √
qk 5qk2
for k = n, n + 1, n + 2.
Using the proof of the previous proposition we see that
1 1 1
√ +√ 2 ≤ .
2
5qn 5qn+1 qn qn+1
√
Denoting λ = qn+1 /qn we get λ + 1/λ ≤ 5.
Obviously
√ λ is a rational number, hence√5+1
the above inequality is strict.
2
Thus, λ − 5λ + 1 < 0 which implies λ < 2 .
9.3. TRANSCENDENTAL NUMBERS AND LIOUVILLE’S THEOREM53
√
Similarly, for µ := qn+2 /qn+1 we have µ < 5+1 2
.
However, qn+2√= an+2 qn+1 + qn ≥ qn+1√ + qn hence µ ≥ 1 + 1/λ. This
yields 1 + 1/λ < 5+1 2
2
and so λ > √5−1 = 5+12
, a contradiction.
√
Now we show that 5 in the last result is best possible.
√
Proposition 9.6. Proposition 9.5 does not remain true if we replace 5 by
a bigger number.
√ √
Proof. Let A > 5. Consider the number x = 5−1 2
. Assume p/q satisfies
|x − p/q| < 1/Aq 2 .
Write x = pq + qδ2 where |δ| < A1 < √15 . Then
√
δ 5 q
− q = − − p.
q 2 2
Taking squares we get
δ2 √
2
− δ 5 = p2 + pq − q 2 .
q
√ √
Now |δ√ 5| < 5/A which does not depent√on q and is less than 1. Since
2
δ < 1/ 5, if q is large enough then qδ2 − δ 5 ∈ (−1, 1). This means p2 +
pq − q 2 ∈ (−1, 1) and therefore p2 + pq − q 2 = 0 since it is an integer. This
is a contradiction.
Remark 9.7. It can be shown (though we will not do it) that for an irrational
x the convergents pn /qn give the best approximations to x among all rational
numbers p/q with 1 ≤ q ≤ qn . More precisely, if n ≥ 1, 0 < q ≤ qn and
p/q 6= pn /qn then
pn p
x − ≤ x −
qn q
and the strict inequality holds for n > 1.
Proof. There are countably many rationals, hence countably many polyno-
mials with rational coefficients. Each of them has finitely many roots, hence
there are countably many algebraic numbers.
Corollary 9.10. Almost all numbers (complex or real) are transcendental.
This establishes the existence of transcendental numbers. Nevertheless,
proving that a given number, like e or π, is transcendental is much more
difficult. Liouville was the first to construct a transcendental number and
thus establish their existence (Cantor’s set theory (and the above argument)
came after his discovery). We will now prove Liouville’s result asserting
that transcendental numbers have better diophantine approximations than
algebraic numbers.
Definition 9.11. A real number ξ is approximable by rationals to the order
n if there is a constant c = c(ξ), depending only on ξ, and infinitely many
rational numbers p/q such that
p c
ξ
− < n .
q q
We saw for example that irrational numbers are approximable to the order
2 while rationals are not.
Definition 9.12. A real number ξ is a Liouville number if for every n > 0
there are integers p, q with q > 1 such that
p 1
0< ξ − < n .
q q
Lemma 9.13. A real number is Liouville iff it is approximable to the order
n for every n > 0.
Proof. Obvious.
Theorem 9.14. Let f (X) ∈ Z[X] be a polynomial of degree n. If ξ is a real
zero of f then it is not approximable to the order n + 1.
Proof. Assume ξ is approximable to the order n+1. Then there are a constant
c and a rational number p/q ∈ (ξ − 1, ξ + 1) such that |ξ − p/q| < c/q n+1 and
f (p/q) 6= 0.
Let f (X) = an X n + . . . + a1 X + a0 . The derivative f 0 (X) is bounded on
every bounded set. Let |f 0 (x)| < M for all x ∈ (ξ − 1, ξ + 1). Now
|an pn + an−1 pn−1 q + . . . + a0 q n |
!
p 1
f = ≥ n
n
q q q
9.4. TRANSCENDENCE OF E 55
since the numerator is a non-zero integer. On the other hand by the mean
value theorem we have
! ! !
p p p
f =f − f (ξ) = − ξ · f 0 (x)
q q q
for some number x between ξ and p/q. Combining what we obtained above
we get
c p |f (p/q) 1
> ξ − = 0 > .
q n+1 q |f (x)| M qn
This shows that q < cM , i.e. there are finitely many possibilities for q, which
is a contradiction.
We will show that this is a Liouville number. Fix a positive integer N and
let
N
X 1 p
ξN := n!
=
n=1 10 q
where q = 10N ! . Clearly
∞
p X 1 2 2 1
0<ξ− = n!
< (N +1)! = N +1 < N .
q n=N +1 10 10 q q
9.4 Transcendence of e
Theorem 9.17. The number e is transcendental.
j=0 j=0
56 CHAPTER 9. DIOPHANTINE APPROXIMATIONS
an en + . . . + a1 e + a0 = 0.
Obviously |f (x)| ≤ g(x) for all real values of x and g is increasing on the
positive half-line hence
|I(t)| ≤ tet g(t).
Further, denote
n
X
J := aj I(j).
j=0
Observe that
• if 1 ≤ k ≤ n and j < p, then f (j) (k) = 0,
Since m j
j=1 |aj |je does not depend on p, the right hand side can be bounded
P
9.5 Exercises
√
1. Find two rational numbers a/b such that | 2 − ab | < √1 .
5b2
is transcendental.
Chapter 10
Lemma 10.3. √ The norm is multiplicative, that is, N (αβ) = N (α)N (β) for
all α, β ∈ Q( d).
10.1 Units
√
In this section we will describe the multiplicative group of the ring Z( d).
Recall that it consists of the invertible elements (units) of the ring, and is
√ ×
denoted by Z[ d] .
1
√
An element α ∈ Q( d) is an algebraic integer if it is a root of a quadratic polynomial
X 2 + bX + c with b, c ∈ Z.
59
60 CHAPTER 10. QUADRATIC NUMBER FIELDS
√
Lemma 10.4. An element α ∈ Z[ d] is a unit iff N (α) = ±1.
Case 2. d = −1
In this case the field Q(i) (where i2 = −1) is known as the Gaussian field
and the elements of Z(i), which correspond to lattice points on the complex
plane, are called Gaussian integers.
The equation x2 + y 2 = ±1 has four solutions, (±1, ±1). Thus, there are
four units in the ring of Gaussian integers, namely, ±1, ±i.
Case 2. d > 0
This case is non-trivial unlike the case d < 0. We need to solve the equation
x2 − dy 2 = ±1.
We have already studied the equation x2 −dy 2 = 1 in Section√8.5 and seen that
it has infinitely many solutions. In particular, the ring Z[ d] has infinitely
many units. √ ×
Let α0 := min α ∈ Z[ d] : α > 1 . This is called the fundamental
unit. As in Section 8.5 one can show easily that all positive units must be
powers of α0 . Moreover, if N (α0 ) = −1 then all odd powers of α0 will have
norm −1 (those will be all positive solutions of the equation x2 − dy 2 = −1)
and all even powers will have norm 1 (those will be all solutions of Pell’s
equation). If N (α) = 1 then all powers will have norm 1 and will be solutions
of Pell’s equation. In particular, the equation x2 − dy 2 = −1 will have no
solutions in this case.
Taking into account negative solutions of the above equations as well, we
conclude that
√ ×
Z[ d] = {±α0m : m ∈ Z} = (−1, α0 ),
2
It is a general result that unique factorisation holds in Euclidean domains and the
proof is basically the same as for Z.
3
These are defined as in Section 1.3, that is, an element π 6= 0, ±1, ±i is irreducible if
π = αβ implies that either α or β is a unit, and it is a (Gaussian) prime if π | αβ implies
π | α or π | β.
62 CHAPTER 10. QUADRATIC NUMBER FIELDS
Case 2. N (π) = 2.
We notice that 2 = (1 + i)(1 − i) = −i(1 + i)2 . Here 1 + i is a Gaussian prime
and 2 ∼ (1 + i)2 . One says that 2 ramifies in Z[i].
Case 3. N (π) = p2 .
Then N (π/p) = 1, hence π ∼ p and p is a Gaussian prime. It is said to
be inert in Z[i]. We already saw that p = 2 are p ≡ 1 mod 4 cannot be
Gaussian primes, hence in this case p ≡ 3 mod 4.
• π ∼ 1 + i.
(x + yi)p ≡ xp + y p ip ≡ x + yi mod p.
If π = q ≡ 3 mod 4 then
αq = (x + yi)q ≡ xq + y q iq ≡ x − yi ≡ ᾱ mod q
and so
2
¯≡α
αq ≡ ᾱ mod q.
y 2 = x3 − 1. (4.1)
We write it as
(y + i)(y − i) = x3 .
4
A set S ⊆ Z[i] is a complete residue system modulo π if every Gaussian integer is
congruent to an element of S mod π and no two elements of S are congruent mod π.
64 CHAPTER 10. QUADRATIC NUMBER FIELDS
10.5 Exercises
1. Prove Proposition 10.8.
Chebyshev’s theorem
Theorem 11.1. For every n > 1 there is a prime number p with n < p < 2n.
We are going to estimate the binomial coefficient 2nn
= (2n)!
(n!)2
from above
and from below. It is quite easy to get a lower bound which we will do
shortly. To get an upper bound we will factorise it into a product of primes
and get estimates for prime factors.
In particular, if Chebyshev’s theorem
is false then all prime factors of 2n
n
are at most n. Then we will see that
if n is large enough then the two bounds are inconsistent. This will prove
the theorem for sufficiently large n and small values of n will be dealt with
separately by exhibiting prime numbers in each interval (n, 2n) (we will do
this in a smart way and not consider all possible values of n).
The proof that we are going to present is due to Erdős, and is taken from
[AZ14].
4n
!
2n
≥ .
n 2n
65
66 CHAPTER 11. CHEBYSHEV’S THEOREM
2n 2n
The last inequality follows from the fact that n
≥ k
for all k and
2n
n
≥ 2.
Recall that for a positive integer n and a prime number p the p-adic
valuation of n is defined by
where the last product is over all primes p. It is actually a finite product
since if p - n then vp (n) = 0.
Lemma 11.3. For n ≥ 1 we have
∞
" #
X n
vp (n!) = .
k=1 pk
h i
n
Proof. There are p
numbers between (and including) 1 and n divisible by
h i
p. Each of those numbers contributes at least 1 to vp (n!). Now, pn2 many
of those numbers is divisible by p2 and they contribute two. Repeating this
argument for
h i
each pk we get the desired result. Note that when k > logp n,
the terms pnk vanish and hence the sum is actually a finite sum.
2n
Denote N := n
.
Lemma 11.4. For each prime p ≤ 2n we have
(i) pvp (N ) ≤ 2n,
√
(ii) if p > 2n then vp (N ) ≤ 1,
2n
(iii) if 3
< p ≤ n then vp (N ) = 0 (for n ≥ 3).
Proof. (i) First notice that for any real number x the difference [2x] − 2[x]
is either 0 or 1. Further, by the previous lemma,
[logp 2n] " # " #!
X 2n n
vp (N ) = vp ((2n)!) − 2vp (n!) = − 2 ≤ logp 2n.
k=1 pk pk
√
(ii) If 2n < p ≤ 2n then logp 2n = 1.
11.2. PROOF OF CHEBYSHEV’S THEOREM 67
(iii) If 2n
3
< p ≤ n then 3p > 2n and 2p > n and p2 ≥ 3p > 2n. So
vp ((2n)!) = 2 and vp (n!) = 1.
p ≤ 4x−1 ,
Y
p≤x
where the product is over all prime numbers that do not exceed x.
Proof. Replacing x by [x] we may assume that x is a positive integer and we
will proceed to the proof by induction on x. Further, we can assume that
x = 2m + 1 is an oddinteger
(and a prime number).
2m+1
First, notice that m ≤ 4m since
2m+1
! ! ! !
2m+1 2m+1
X 2m + 1 2m + 1 2m + 1 2m + 1
2 = (1+1) = ≥ + =2 .
k=0 k m m+1 m
Second, !
Y 2m + 1 (2m + 1)!
p
=
m+1<p≤2m+1 m m!(m + 1)!
since each prime p with m + 1 < p ≤ 2m + 1 divides (2m + 1)! and does not
divide m!(m + 1)!.
Now, using the induction hypothesis for m, we get
!
2m + 1
p ≤ 4m · ≤ 4m · 4m = 42m .
Y Y Y
p= p·
p≤2m+1 p≤m+1 m+1<p≤2m+1 m
Thus, √
4n/3 ≤ (2n) 2n+1
,
and so
log 2 √
2n · ≤ ( 2n + 1) log 2n.
3
This is obviously wrong for sufficiently large n since the left hand side grows
much faster. We will now show that it is in fact false for n > 5000. Indeed,
it suffices to show that for x > 10000 we have
log 2 √
x· > ( x + 1) log x.
3
1
First, it is easy to check that log3 2 > 0.2 and log x < x 4 if x > 10000.
√ 1
We claim that the stronger inequality 0.2x > 2 x · x 4 holds. But this is
obviously equivalent to x > 10000.
Thus, we proved Chebyshev’s theorem for n > 5000. For smaller n we
argue as follows. Consider the following sequence of primes:
2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 5003.
Every prime in this sequence is smaller than twice the previous one. Hence
for any 1 ≤ n ≤ 5000 one of those primes is between n and 2n.
Theorem 11.7. There are constants 0 < A < 1 < B such that
x x
A ≤ π(x) ≤ B
log x log x
for all sufficiently large x.
1 f (x)
The notation f (x) ∼ g(x) means that limx→∞ g(x) = 1.
11.3. ON THE PRIME NUMBER THEOREM 69
The following proof is from [Gre16] and the reader can also find a proof
of the prime number theorem there.
Proof. First, we will establish the upper bound. Lemma 11.5 implies
p ≤ 4x ,
Y
x/2<p≤x
x log 4
π(x) ≤ π(x/2) + .
log(x/2)
√ m √ ∞
X x/2k x X 1
π(x) < 2 x + 2 log 4 √ <2 x+ · 4 log 4 k
.
k=1 log x log x k=1 2
√ x
Obviously, 2 x < log x
for sufficiently large x and so we can take B =
1 + 4 log 4.2
n log C ≤ (2n)π(2n)
and
log C 2n
π(2n) ≥ · .
2 log 2n
This establishes the lower bound for x = 2n. The general case follows
easily from this.
11.4 Exercises
1. How many zeroes are there at the end of the decimal representation of
99! ?
[AZ14] Martin Aigner and Günter M. Ziegler. Proofs from THE BOOK.
Springer-Verlag Berlin Heidelberg, 5 edition, 2014.
71