65
Lecture Notes in Number Theory

Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

  • Upload
    others

  • View
    12

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Lecture Notes in NumberTheory

Page 2: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

CONTENTS

1 Preliminary Concepts 2

2 Divisibility in Z 5

3 Theory of Congruences 6

4 Applications of Congruences 7

5 Three Classical Milestones in Number Theory 8

6 Number Theoretic Functions 9

7 Primitive Roots 14

1

Page 3: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

CHAPTER 1

MATHEMATICALPRELIMINARIES

Overview

In this chapter, we introduce the mathematical tools that we will need to provethe various results that will be discussed in this course.

ObjectivesAt the end of this chapter, you should be able to do the following:

1. Describe and illustrate each of the four methods of proving discussed in thischapter.

2. Choose the appropriate method of proving a given mathematical statement.

1.1 Methods of Proof

In mathematics, theorems are often stated in the form of propositions or impli-cations, which are made up of the hypothesis and the conclusion.

The statement of these theorems are often stated in either of the followingforms:

1. Conditional: P ⇒ which is read as ”P implies Q” or ”If P , then Q”. Inthis case, P is a sufficient condition for Q, or Q is a necessary conditionfor P .

2

Page 4: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

2. Equivalence: P ⇔ Q which is read as ”P if and only if Q”. This meansthat P is both a necessary and sufficient condition for Q, or that the twoconditions are equivalent, so that when one condition is true, the other istoo.

There are four main methods of proving propositions. These are

1. Direct Proof: In this method, we begin with the hypothesis, andprogress logically using known results and definitions to arrive at the con-clusion.

2. Indirect Proof: In this method, we use the fact that a conditional of theform P ⇒ Q is equivalent to its contrapositive not Q ⇒ not P , andprove the contrapositive.

3. Proof by Contradiction: This is similar to the indirect method ofproof. We will assume that the conclusion is false, and proceed to obtaina contradiction.

4. Proof by Mathematical Induction: This method of proof is used whenthe statement to be proven contains a function of an integer variable.

Example 1. Use each of the first three methods of proof to prove the statement:If x and y are odd integers, then x+ y is even.

1. Direct Proof:Let x, y be odd integers. Then there exist integers p and q such thatx = 2p+ 1 and y = 2q + 1. This gives us

x+ y = (2p+ 1) + (2q + 1)

= 2p+ 2q + 2

= 2(p+ q + 1)

Since x+ y = 2(p+ q + 1), it must be even.

2. Indirect Proof:We will prove that if x+ y is odd, the integers x and y are not both odd.Since x+ y is odd, it can be expressed in the form

x+ y = 2k + 1

. If x is odd, then x = 2m+ 1 for some integer m. We have

y = (x+ y)− x = (2k + 1)− (2m+ 1) = 2(k −m)

which shows that y is even. Similarly, if y is odd, there is an integer nsuch that y = 2n+ 1, and so we have

x = (x+ y)− y = (2k + 1)− (2n+ 1) = 2(k − n)

which shows that x is even.

3

Page 5: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

3. Proof by Contradiction: Let x, y be odd integers, and assume thatx+ y is odd. Then there exist integers p, q, r such that

x = 2p+ 1, y = 2q + 1, x+ y = 2r + 1

We then have

x+ y = x+ y

(2p+ 1) + (2q + 1) = 2r + 1

2(p+ q + 1) = 2r + 1

We have a contradiction since the left hand side is even and the right handside is odd.

SAQ 1.1Following the example given above, prove the statement:The sum of any two consecutiveintegers is odd.using each of the three methods of proof.

Try to solve this exercise on your own before comparing it with the solution givenbelow:

4

Page 6: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

ASAQ 1.1

1. Direct Proof:Let x and y be consecutive integers and let y = x+ 1. Then

x = y = x+ x+ 1 = 2x+ 1

which shows that x+ y is odd.

2. Indirect Proof:Suppose x + y is even. We want to show that this is not possible when x and y areconsecutive integers. If x is even, then x + y = 2m, x = 2n for some integers m and n,and we have

y = (x+ y)− x = 2m− 2n = 2(m− n)

which shows that y is also even. However, two consecutive integers can not be both even.Now if x is odd, we can write x = 2n+ 1, so that

y = (x+ y)− x = 2m− (2n+ 1) = 2m− 2n− 1 = 2m− 2n− 2 + 1 = 2(m− n− 1) + 1

which shows that y is also odd. Again this is impossible since two consecutive integers cannot be both odd.

3. Proof by Contradiction:Suppose x + y is even, so that there exists an integer k such that x + y = 2k. If x andy are consecutive integers with y representing the bigger number, then y = x+ 1 and wehave

x+ y = 2k = x+ (x+ 1) = 2x+ 1

and we have a contradiction because the even number on the left-hand side can not beequal to the odd integer on the right. Hence, x+ y must be odd.

Did you get similar results? Compare your own solutions with the ones given here, and seewhere you ade a mistake, if any.

1.1.1 Proof by Mathematical Induction

Well-Ordering Principle: The set N of natural numbers is well-ordered withrespect to the usual order in the sense that every nonempty subset S of N hasa least element.

When the statement to be proven involves a formula or a property which issupposed to be true for a sequence of positive integers, the method of mathemat-ical induction is often used for the proof. The most common form of mathemat-ical induction is known as the first principle of mathematical induction,which is stated below:Let sm, sm+1, . . . be a sequence of statements, where m is a positive integer.Suppose that the following conditions are true:

5

Page 7: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. sm is true

2. If an arbitrary statement sk is true, then the next statement sk+1 is alsotrue

Then all the statements in the sequence { sn } are true.This means that the proof using the first principle mathematical induction con-sists of two parts, namely:

• Part I: Show that the statement is true for the smallest value of theinteger n ,i.e. show that sm is true.

• Part II: Assume that the statement is true for n = k, and show that itis also true for n = k + 1.

Example 2. Use mathematical induction to prove that 4n − 1 is divisible by 3for all positive integers n.

A number is divisible by 3 if there is no remainder upon division by 3. Hence,it can be expressed in the form 3q, where q is the quotient. Applying mathemat-ical induction, we have:

1. Part I: Let n = 1. Then 4n − 1 = 4− 1 = 3, which is divisible by 3.

2. Part II: Assume that 4k−1 is divisible by 3, so that we can write 4k−1 =3q for some integer q. We have

4k+1 − 1 = 4(4k)− 1 = 3(4k) + (4k − 1) = 3(4k) + 3q = 3(4k + q)

which shows that 4k+1 − 1 is divisible by 3.

This shows that 4n − 1 is divisible by 3, for all positive integers n.

Example 3. Use mathematical induction to prove that n! > 2n for n ≥ 4.

1. Part I: Let n = 4. Then n! = 4! = 24 and 2n = 16, so that

n! = 4! = 24 > 16 = 24 = 2n

This shows that the theorem is true when n = 4.

2. Part II: Assume that k! > 2k for a positive integer k ≥ 4. For n = k + 1,we have

n! = (k + 1)! = (k + 1)k! > (k + 1)2k > 2(2k) = 2k+1 = 2n

so that (k + 1)! > 2k+1 and the statement is also true for n = k + 1.

This shows that for any n ≥ 4, we have n! > 2n.

The second principle of mathematical induction states the following:

(a) Suppose a property f(n) is true for n = 1 and

6

Page 8: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

(b) The property f(n) is true for all n < k, where k is an arbitary integergreater than or equal to 1

Then the property holds when n = k, and hence the property holds for alln ∈ N.

SAQ 1.2Let n be a positive integer. Use mathematical induction to prove that the sum of the

first n consecutive integers from 1 to n is equal ton(n+ 1)

2.

Try to solve this exercise on your own before comparing it with the solution givenbelow:

ASAQ 1.2The first part of induction is to test the statement for the smallest value of n, which in this case

is 1. Thus, when n = 1, the sum of just the number is 1, whilen(n+ 1)

2=

1(2)

2= 1, which

shows that the formula is valid when n = 1.For our inductive assumption, assume that the statement holds when n = k, that is

1 + 2 + · · ·+ k =k(k + 1)

2

We wish to show that the formula is still true for n = k + 1. In this case, we have

1 + 2 + · · ·+ k + (k + 1) = {1 + 2 + · · ·+ k}+ (k + 1)

=k(k + 1)

2+ (k + 1)

=k(k + 1) + 2(k + 1)

2

=(k + 1)(k + 2)

2=

(k + 1)((k + 1) + 1)

2

Sincen(n+ 1)

2=

(k + 1)((k + 1) + 1)

2when n = k + 1, this shows that the formula is still true

for n = k + 1, and the proof is complete.

1. Use the indirect method to prove that every nonzero real number x has aunique multiplicative inverse.

2. Use mathematical induction to prove the following statements:

(a) The sum of the first n odd natural numbers is n2. In sysmbols, wehave

n∑i=1

(2i− 1) = n2

7

Page 9: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

(b) The sum of the squares of the first n natural numbers isn(n+ 1)(2n+ 1)

6.

(c) The sum of the first n odd squares isn(4n2 − 1)

3

(d) For all positive integers n, we have 3n > 3n− 1

(e) For all positive integrs n, we have 5n > n2

Answers to the Exercises:

1. Let x be a nonzero real number. Suppose that the multiplicative inverseof x is not unique. Then there exist nonzero real numbers y and z, wherey 6= z, such that

xy = yx = 1, xz = zx = 1

Then we have

y = y(1) = y(xz) = (yx)z = 1(z) = z

which shows that x = z, contrary to our assumption that these two in-verses are distinct.

2. (a) If n = 1, then the first odd integer is 1, and n2 = 1. If n = 2, thenthe sum is

1 + 3 = 4, and n2 = 22 = 4

This shows that the formula holds when n = 1 and when n = 2.Assume that it is also true when n = k, where k is some positiveinteger. Thus,

1 + 3 + 5 + · · ·+ (2k − 1) = k2

When n = k + 1, we get

1 + 3 + · · ·+ (2k − 1) + (2(k + 1)− 1)

= [1 + 3 + · · ·+ (2k − 1)] + (2k + 1)

= k2 + (2k + 1) = (k + 1)2

Hence, the formula is also true for n = k + 1, and the proof is com-plete.

(b) The sum of the squares of the first n natural numbers isn(n+ 1)(2n+ 1)

6.

To prove this, let n = 1. Thenn(n+ 1)(2n+ 1)

6=

1(2)(3)

6= 1,

8

Page 10: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

which shows that the statement is true when n = 1. For our in-ductive assumption, assume that the formula holds when n = k, sothat

12 + 22 + · · ·+ k2 =k(k + 1)(2k + 1)

6

When n = k + 1, we get

12 + 22 + · · ·+ k2 + (k + 1)2

= [12 + 22 + · · ·+ k2] + (k + 1)2

=k(k + 1)(2k + 1)

6+ (k + 1)2

=k(k + 1)(2k + 1) + 6(k + 1)2

6=

(k + 1)(2k2 + k + 6(k + 1))

6

=(k + 1)(2k2 + 7k + 6)

6=

(k + 1)(k + 2)(2k + 3)

6

=(k + 1)[(k + 1) + 1][2(k + 1) + 1]

6

The last expression is what you will get if you use the formula withn = k + 1.

(c) When n = 1, we have 12 = 1, andn(4n2 − 1)

3=

1(3)

3= 1, which

shows that the formula is true for n = 1. If it is also true for n = k,then we must have

12 + 32 + · · ·+ (2k − 1)2 =k(4k2 − 1)

3

Assuming this is true, then when n = k + 1, we will get

12 + 32 + · · ·+ (2k − 1)2 + (2k + 1)2

= [12 + 32 + · · ·+ (2k − 1)2] + (2k + 1)2

=k(4k2 − 1)

3+ (2k + 1)2 =

k(4k2 − 1) + 3(2k + 1)2

3

=(2k + 1)[k(2k − 1) + 3(2k + 1)]

3

=(2k + 1)(2k2 + 5k + 3)

3=

(k + 1)(2k + 1)(2k + 3)

3

Now,n(4n2 − 1)

3=n(2n− 1)(2n+ 1)

3

and if n = k + 1, then this expression becomes

n(2n− 1)(2n+ 1)

3=

(k + 1)(2k + 1)(2k + 3)

3

which shows that the formula for the sum is correct when n = k+ 1.

9

Page 11: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

(d) To prove that 3n > 3n− 1, we first check when n = 1, and we get

31 = 3 > 3(1)− 1 = 2

Next we assume that 3k > 3k − 1 for some positive integer k. Thenfor n = k + 1, we have

3k+1 = 3(3k) > 3[3k−1] = 9k−3 = 3k−1+(6k−2) > 3k−1+3 = 3(k+1)−1

since k ≥ 1. This shows that the inequality holds for n = k + 1.

(e) To prove that 5n > n2 for all positive integers n, we first verify forthe case when n = 1. This gives us

5n = 51 = 5 > 12 = n2

If we assume that it is true for n = k, then we have the inequality5k > k2, where k ≥ 1 is a positive integer. For n = k + 1, we have

5k+1 = 5(5k) > 5k2 = k2 + 4k2 > k2 + 2k + 1 = (k + 1)2

and this proves that the inequality is also true for n = k + 1.

10

Page 12: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

CHAPTER 2

DIVISIBILITY IN THE SET OFINTEGERS

Overview

In this chapter, we will discuss the concept of divisibility in the set of integers.The fundamental theorem is the division algorithm, and additional results con-cerning divisibility will also be discussed. The concepts of the greatest commondivisor and the least common multiple will be discussed here.

2.1 The Division Algorithm

Theorem 1. (Division Algorithm) Let a, b ∈ Z with a > 0. There exists aunique pair of integers q and r satisfying

b = qa+ r, 0 ≤ r < a

If b > 0, then q is the quotient when b is divided by a, and r is the remainder.

Proof:Consider the arithmetic sequence

. . . , b− 3a, b− 2a, b− a, b, b+ a, b+ 2a, b+ 3a, . . .

Since a > 0, the sequence contains both negative and positive integers. Let rbe the value of the smallest nonnegative term in the sequence. Thus, r can beexpressed in the form r = b− qa, so that b = qa+ r, where r ≥ 0. It remains toshow that r < a. Suppose instead that r ≥ a. Then

r − a = b− qa− a = b− (q + 1)a ≥ 0

11

Page 13: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

so that r − a is a term of the sequence which is nonnegative and less than r,contradicting the minimality of r. Hence, r < a.

To prove the uniqueness of r and q, suppose r1 and q1 is another pair ofintegers such that b = q1a+ r1, 0 ≤ r1 < a. Then we have

r − r1 = (b− qa)− (b− q1a) = (q1 − q)a

which shows that a||r − r1|. If r − r1 6= 0, then by (5) of Theorem ??, we musthave a ≤ |r − r1|, which is impossible, since 0 ≤ r < a, 0 ≤ r1 < a. Hence,r = r1, and hence r − r1 = (q1 − q)a = 0. Since a > 0, we get q = q1. Thefollowing corollary shows that our divisor need not be positive.

Corollary 1. Let a, b ∈ Z, b 6= 0. There exist unique integers q and r suchthat

b = qa+ r, 0 ≤ r < |a|

Example 4.

1. Let b = 27, a = 12. We have 27 = 12(2) + 3, so q = 2 and r = 3.

2. Let b = −42, a = 12. We take the multiple of 12 closest to and not greaterthan -42. This will be -48, so we have −42 = −48 + 6 = 12(−4) + 6, sothat q = −4 and r = 6.

3. Let b = 70, a = −11. The largest multiple of -11 which does not exceed70 is 66, so we have 70 = (−11)(−6) + 4, and so we have q = −6, r = 4.

4. Use the division algorithm to show that the square of any integer is of theform either 3k + 1 or 3k, for some positive integer k.Solution:Let x be any integer. If x is divided by 3, then the possible remaindersare 0, 1 or 2. By the division algorithm, we can write x in any of thefollowing forms: 3q, 3q + 1 or 3q + 2.

If x = 3q : x2 = (3q)2 = 9q2 = 3(3q2) = 3k, where k = 3q2.

If x = 3q+1: x2 = (3q+1)2 = 9q2+6q+1 = 3(3q2+2q)+1 = 3k+1,where k = 3q2 + 2q.

If x = 3q+2: x2 = (3q+2)2 = 9q2 +12q+4 = 3(3q2 +4q+1)+1 =3k + 1, where k = 3q2 + 4q + 1.

1. If n is an odd integer, show that the expression n4+4n2+11 is expressiblein the form 16k for some integer k.

2. If a|1, prove that a = ±1.

3. Prove: If a, b and n are positive integers such that n|(a− 1) and n|(b− 1),then n|(ab− 1).

12

Page 14: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

4. Prove: If a, b and n are positive integers such that a|b, then an|bn for alln.

Solutions to the Exercises:

1. Since n is odd, there exists an integer q such that n = 2q + 1. Thus,

n4 + 4n2 + 11 = (2q + 1)4 + 4(2q + 1)2 + 11

= [16q4 + 4(8q3) + 6(4q2) + 4(2q) + 1] + [4(4q2 + 4q + 1)] + 11

= 16q4 + 32q3 + 24q2 + 8q + 1 + 16q2 + 16q + 4 + 11

= 16(q4 + 2q3 + 2q2 + q + 1) + 8(q2 + q)

= 16(q4 + 2q3 + 2q2 + q + 1) + 8q(q + 1)

The first expression on the right-hand side is divisible by 16. To show thatthe second expression is divisible by 16, we need to show that q(q + 1) isdivisible by 2. Since q and q + 1 are consecutive integers, one of themmust be even, so that their product isd divisible by 2, and 8q(q+1) is alsodivisible by 16.

2. Since a|1, there is an integer b such that 1 = ab. However, the only possiblefactorizations of 1 are (1)(1) and (-1)(-1), so this shows that a = ±1.

3. If n|(a− 1) an n|(b− 1), then there exist integers p and q such that

a− 1 = np, b− 1 = nq ⇔ a = np+ 1, b = nq + 1

Thus, we have

ab− 1 = (np+ 1)(nq + 1)− 1 = n2pq + nq + np+ 1− 1 = n(npq + q + p)

so that ab− 1 = n(npq + q + p). But this shows that n|(ab− 1).

4. Since a|b, there exists an integer q such that b = aq. If n is a positiveinteger, we get

bn = (aq)n = anqn, qn ∈ Z

This shows that an|bn.

2.2 The Greatest Common Divisor

Definition 1. Let a, b be integers, with a 6= 0. We say that b is divisible bya, or that a divides b, if there exists an integer c such that

b = ac

. We also say that b is a multiple of a, and that a is a divisor of b. In this case,we write a|b. Otherwise, we write a 6 |b.

Example 5.

13

Page 15: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. 3| − 24 since −24 = 3(−8)

2. 5 6 |23 since there is no integer k such that 23 = 5k.

The following theorem gives the basic properties that govern divisibility in theset of integers:

Theorem 2. Let a, b, c ∈ Z.

1. a|0, 1|a, a|a

2. a|1 if and only if a = ±1.

3. If a|b and c|d, then ac|bd.

4. If a|b and b|c, then a|c.

5. a|b if and only if ac|bc for all nonzero integers c.

6. If a|b and b|a, then a = ±b.

7. If a|b, b 6= 0, then |a| ≤ |b|.

8. If a|b and a|c, then a|(bx+ cy) for all x, y ∈ Z.

9. If ab|c, then a|c.

Proof. The proof of (1) is left as an exercise. One part of (2) is a solved exercisein the preceding section, so the converse is also given as an exercise.

(3) Since a|b and c|d, we can find integers x and y such that b = ax andd = cy. This gives us

bd = (ax)(cy) = (ac)(xy)

Since xy ∈ Z, this equation means that ac|bd.

(4) Since a|b and b|c, there exist integers m and n such that b = am andc = bn. This gives us

c = bn = (am)n = a(mn)

which shows that a|c.

(5) Suppose a|b. Then there exists an integer x such that b = ax. If cis any nonzero integer, then bc = axc = (ac)(x) so by our definition,ac|bc. Conversely, suppose ac|bc, so that there is an integer y such thatbc = (ac)(y). Since c 6= 0, we can divided both members of this equationby c to get b = ay, which tells us that a|b.

14

Page 16: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

(6) If a|b, then b = ax for some integer x. Since b|a, there is also an integer ysuch that a = by. This gives us

a = by = (ax)y) = axy

from which we get xy = 1. Hence, either x = y = 1 or x = y = −1, whichshows that either a = b or a = −b.

(7) Since a|b, there is an integer c such that b = ac. Since b 6= 0, it followsthat c 6= 0. Taking absolute values, we get

|b| = |ac| = |a||c| ≥ |a| since |c| ≥ 1

(8) Since a|b and a|c, there exist integers m and n such that b = am andc = an. We have

bx+ cy = (am)x+ (an)y = a(mx+ ny)

and since mx+ ny ∈ Z, it follows that a|(bx+ cy) for all x, y ∈ Z.

(9) Suppose ab|c. Then we can find an integer x such that c = (ab)x = a(bx).Since b, x ∈ Z, their product bx is also an integer. Thus, a|c.

Prove (1) and the converse of (2)of the preceding theorem, i.e. show that

(a) a|0, 1|a, a|a,

(b) If a = ±1, then a|1

Definition 2. If c|a and c|a, we call c a common divisor of b and a. If atleast one of b and a is nonzero, then they only have a finite number of commondivisors. The largest positive common divisor of b and a is called the greatestcommon divisor of b and a, and is denoted by (a, b) or by gcd(a, b). Thus,the greatest common divisor satisfies the following conditions: If d = gcd(a, b),then

• d|a and d|b

• If c is a positive integer such that c|a and c|b, then c ≤ d

Example 6. Let a = 24, b = −30. The positive divisors of a are 1, 2, 3, 4, 6, 8, 12and 24, while the positive divisors of -30 are 1, 2, 3, 5, 6, 10, 15 and 30. Thisshows that the common positive divisors of 24 and -30 are 1, 2, 3 and 6, so thatthe greatest common divisor is (24, − 30) = 6.

Aside from the properties given in the definition, we have the following proper-ties of the greatest common divisor:

Theorem 3. Properties of the GCD Let d = (a, b). Then

15

Page 17: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. (a, b) = a if and only if a|b.

2. 1 ≤ d ≤ min { a, b }.

3. If c|a and c|b, then

(a

c,b

c

)=d

c.

4. For all integers n, we have (an, bn) = n (a, b).

Proof.

1. If (a, b) = a, then by definition, we have a|b. Conversely, if a|b, then sincewe also have a|a, this means that a is a common divisor of a and b. If cis any other common divisor, then since c|a, we know that c ≤ a. Thismeans that every common divisor of a and b is smaller than a, and soa = (a, b).

2. Since 1 is a common divisor of a and b, we know that 1 ≤ d. Since d|a,we have d ≤ a. Similarly, d ≤ b, so that d ≤ min { a, b }.

3. If c is a common divisor of a and b, then c|d, so thatd

cis an integer. Since

d|a, we can write a = dx, or, equivalently,a

cc =

d

ccx and hence

a

c=d

cx,

which shows thatd

c

∣∣∣ac

. Similarly, we can show thatd

c

∣∣∣∣bc , so thatd

cis a

common divisor ofa

cand

b

c. Let k be any other common divisor. Then

kc|a and kc|b, so that kc|d and hence k

∣∣∣∣dc . This shows that

(a

c,b

c

)=d

c

4. Since d|a and d|b, it is clear that dn|an and dn|bn. Let k be any othercommon divisor of an and bn. Then k/n is a common divisor of a andb, and so (k/n)|d. This shows that (k/n)n|dn, or, equivalently, k|dn andk ≤ dn. This shows that (an, bn) = dn = (a, b)n.

The following examples illustrate the above properties:

Example 7.

1. (36, 18) = 18 since 18|36.

2. Since (54, 36) = 18, we see that 1 ≤ 18 ≤ min{ 54, 36 } = 36.

16

Page 18: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

3. Let a = 72, b = 60, so that d = 12. Let c = 6, so that c|a and c|b. Thenwe have (

a

c,b

c

)= (72/6, 60/6) = (12, 10) = 2 =

12

6=d

c

4. Let a = 24, b = 32 and n = 4. We have d = (a, b) = (24, 32) = 8. Onthe other hand,

(na, nb) = (96, 128) = 32 = 4(8) = n(a, b)

Example 8. If d|a and d|b, show that d|(ax + by) for all integer values of xand y.Solution:Since d|a and d|b, there exist integers m and n so that a = dm and b = dn.Hence,

ax+ by = (dm)x+ (dn)y = d(mx+ ny)

which shows that d|(ax+ by).

Theorem 4. If d = (a, b), then there exist integers x0 and y0 such that d =ax0 + by0, i.e. the greatest common divisor of a and b is expressible as a linearcombination of the two integers.

Proof. Consider the set

S = { ax+ by : x, y ∈ Z }

Note that a, − a, b, − b are all in S, so that S contains both positive andnegative elements. Let k be the smallest positive element of S. Thus, k can beexpressed in the form

k = ax0 + by0

for some integers x0 and y0. We want to show that d = (a, b) = k.By the division algorithm, we can write

b = q1k + r1, 0 ≤ r1 < k

If r1 > 0, then

r1 = b− q1k = b− q1(ax0 + by0) = a(−q1x0) + b(1− q1y0) ∈ S

Since r1 < k, this contradicts the minimality of k as an element of S. Thus,r1 = 0 and hence b = q1k, so that k|b. Similarly, we can show that k|a, so thatk is a common divisor of a and b. Since d is the largest common divisor of aand b, it follows that k ≤ d. On the other hand, since k is a linear combinationof a and b and d divides both a and b, we know from (3) of Theorem ?? thatd|k. By (5) of the same theorem, this means d ≤ k. The two inequalities showthat d = k = (a, b) and so d = k is a linear combination of a and b.

17

Page 19: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Remark. The concept of the GCD may be extended to any finite number ofintegers, not all of which are zeros. Thus, if b1, b2, . . . , bn ∈ Z, then there existsa positive integer d = (b1, b2, . . . , bn) which divides each bi and is the largestsuch common divisor. Moreover, there exist integers xi such that

d = b1x1 + b2x2 + . . .+ bnxn

Example 9. Let a = 12, b = 21, so that d = (a, b) = (12, 21) = 3. We maywrite

3 = (12, 21) = 2(12) + (−1)(21)

Corollary 2. If a, b are integers which are not both zero, then the set

T = { ax+ by | x, y ∈ Z }

is precisely the set of all multiples of d = (a, b).

Proof. Since d|a and d|b, it follows from property (7) of Theorem ?? that d|(ax+by) for all integers x and y. This means that every element of T is a multiple ofd. On the other hand, let nd be any multiple of d. From the preceding theorem,we know that we can write d in the form d = ax0 + by0 for some integers x0 andy0. This means that we can write

nd = n(ax0 + by0) = a(nx0) + b(ny0) ∈ T since nx0, ny0 ∈ Z

This shows that T is exactly the set of all integral multiples of d.

Definition 3. Two integers a and b which are not both zero are said to berelatively prime if (a, b) = 1.

Example 10. Let a = 14 and b = 15. The positive divisors of a = 14 are:1, 2, 7, 14. On the other hand, the positive divisors of b = 15 are : 1, 3, 5, 15.This shows that the only common positive divisor and hence the greatest commondivisor of a and b is 1, and so the given numbers ar relatively prime.

Using Theorem ??, we obtain the following result:

Theorem 5. Let a, b be two integers which are not both zero. Then (a, b) = 1if and only if there exist positive integers x and y such that 1 = ax+ by.

Proof. If a and b are relatively prime, then (a, b) = 1, so by Theorem ??, thereexist integers x and y such 1 = ax + by. For the converse, suppose that thereexist integers x and y such 1 = ax + by. Let d = (a, b). Since d|a and d|b, itfollows from Property (7) of Theorem ?? that d|ax+ by for all integer values ofx and y. In particular, d|1. Since the only positive divisor of 1 is 1, it followsthat d = 1.

Example 11. In the earlier example, we showed that (14, 15) = 1, so we shouldbe able to express 1 as a linear combination of 14 and 15. Clearly, the requiredlinear combination is

1 = 1(15) + (−1)(14)

18

Page 20: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Example 12. Show that for any positive integer a, we have (2a+ 1, 9a+ 4) =1.Solution:

Observe that because of Theorem ??, it is sufficient to show that 1 can beexpressed as a linear combination of 2a+ 1 and 9a+ 4. We can write

1 = 9(2a+ 1) + (−2)(9a+ 4)

and hence (2a+ 1, 9a+ 4) = 1.

The proofs of the following results are found in the text and will be omitted.Instead, we illustrate them with examples.

Corollary 3. If (a, b) = d, then (a/d, b/d) = 1.

This appears as Corollary 1 to Theorem 2-4 on page 24 of Burton. Read and study theproof given in the text.

Example 13. The above corollary states that if we divide a and b by their gcd,then the quotients will already be relatively prime. As an example, consider(36, 28) = 4 = d. If we divide 36 and 24 by d = 4, we get 9 and 7, respectively.it is clear that (9, 7) = 1, so 9 and 7 are relatively prime.

Corollary 4. If a|c and b|c, and if (a, b) = 1, then ab|c.

Example 14.

1. Let c = 60, a = 5 and b = 4. Then a|c, b|c and (a, b) = (5, 4) = 1, sothat the conditions of the corollary are all satisfied. This means that theconclusion must also be true. We have ab = 20, and since 20|60, we seethat ab|c, as claimed by the conclusion of the corollary.

2. Let c = 48, a = 12 and b = 3. Then we see that a|c and b|c. However, wehave ab = (12)(3) = 36 and 36 does not divide 48, which shows that theconclusion of the above corollary does not hold. The reason for this is thefact that (a, b) = (12, 3) = 3 6= 1, which is required in the hypothesis ofthis corollary.

Theorem 6. (Euclid’s Lemma) If a|bc and (a, b) = 1, then a|c.

Remark. The above theorem says that if an integer a divides a product bc andit does not have any common factor other that 1 with b, then a must divide thesecond factor c.

Example 15. Let a = 4 and bc = 72 = 9(8) with b = 9 and c = 9. Since(a, b) = (4, 9) = 1, we have a|c = 4|8.

The next theorem gives an alternative set of conditions in order for a positiveinteger d to be the greatest common divisor of two or more integers. The secondcondition says that d must be be the biggest among the common divisors of thegiven integers.

19

Page 21: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Theorem 7. Let a, b ∈ Z such that a and b are not both zero. Then d = (a, b)if and only if the following conditions are satisfied:

1. d|a and d|b

2. If c is a positive integer such that c|a and c|b, then c|d.

This theorem is given as Theorem 2-5 in Burton (p. 25). Study and read the proof given inthe indicated page.

Example 16.

(a) Let a = 24 and b = 60. It can be verified that d = (a, b) = (24, 60) = 12.Moreover, the common divisors of a and b are 1, 2, 3, 4, 6 and 12, so theseare the values of c mentioned in the theorem. Observe that each of thesenumbers divides the gcd, which is 12.

(b) If a|b and a|c, then a2|bc.Solution:Since a|b and a|c, there exist integers x and y such that b = ax and c = ay.Thus we can write

bc = (ax)(ay) = a2(xy) so that bc = (a2)(xy)

The last equation shows that a2|bc.

(c) The sum of the squares of two odd integers can not be a perfect square,i.e. if x and y are both odd, then there is no perfect square z2 such thatx2 + y2 = z2.Solution:Since x, y are both odd, we can write them in the form x = 2r+1, y = 2s+1where r, s are integers. Then we have

x2 + y2 = (2r + 1)2 + (2s+ 1)2 = 4(r2 + s2 + 4r + 4s) + 2

which shows that x2 + y2 leaves a remainder of 2 upon division by 4. Bythe division algorithm, any integer z can be written in the form z = 4q+ r,where r = 0, 1, 2 or 3.

If z = 4q: z2 = 16q2 = 4(4q2) + 0

If z = 4q + 1: z2 = 16q2 + 8q + 1 = 4(4q2 + 2q) + 1

If z = 4q + 2: z2 = 16q2 + 16q + 4 = 4(4q2 + 4q + 1)

If z = 4q + 3: z2 = 16q2 + 24q + 9 = 4(4q2 + 6q + 2) + 1

This shows that the square of any integer can only have a remainder of 0 or1 upon division by 4. Since x2 + y2 leaves a remainder of 2 upon divisionby 4, x2 + y2 can not be a perfect square.

20

Page 22: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. Verify that for any integer a, we have 3|a(a+ 1)(a+ 2).

2. Show that for any integer a, we have (5a+ 2, 7a+ 3) = 1.

3. If a and b are integers which are not both zero, prove that (2a−3b, 4a−5b)divides b.

4. If (a, b) = (a, c) = 1, prove that (a, bc) = 1.

5. If a and b are both odd integers, prove that 16|(a4 + b4 − 2).

2.3 The Euclidean Algorithm

In the preceding section, we discussed some properties of the greatest commondivisor. One of these is that the gcd of two integers is always expressible as alinear combination of the given integers. However, this is not very easy to dowhen the integers are big. In this section, we will present another method fordetermining the gcd. It also shows how the gcd can be expressed as a linearcombination of the given integers. We begin with the following lemma, whichis the basis for the proof of the main procedure.

Lemma 1. If a = bq + r, then (a, b) = (b, r).

Proof. To prove this, let d = (a, b) and c = (b, r). Since d|a and d|b, it followsthat d|(a − bq) = d|r, which shows that d is a common divisor of b and r.Hence, we must have d|c. On the other hand, since c|b and c|r, we also havec|(bq + r) = c|a. This means that c is a common divisor of a and b and so wehave c|d as well. Thus, c = d or (b, r) = (a, b).

Theorem 8. (Euclidean algorithm) Let a, b ∈ Z, a > 0. By repeatedlyapplying the division algorithm, we can obtain a sequence of equations of theform

b = q1a+ r1, 0 ≤ r1 < a

a = q2r1 + r2, 0 ≤ r2 < r1

r1 = q3r2 + r3, 0 ≤ r3 < r2...

...

rk−2 = qkrk−1 + rk, 0 ≤ rk < rk−1

rk−1 = qk+1rk

so that rk is the last nonzero remainder. Then (a, b) = rk. Moreover, (a, b) canbe expressed as a linear combination of a and b by eliminating the remaindersri, i = 1, 2, k − 1 from the above equations.

21

Page 23: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Proof. By repeatedly applying the lemma, we get

(a, b) = (b, r) = (r, r1) = (r1, r2) = · · · = (rk−2, rk−1) = (rk−1, rk) = rk

since the last equation shows that rk−1 is a multiple of rk and so rk is theirgreatest common divisor.Working our way backwards from the second to the last equation, we get

rk = rk−2 + (−qk)rk−1

= rk−2 + (−qk){rk−3 + (−qk−1)rk−2}= (−qk)rk−3 + rk−2(1 + qkqk−1)

We continue to eliminate the remainders in the sequence rk−1, rk−2, rk−3, . . . , r1until rk is expressed as a linear combination of a and b.

Example 17. Use the Euclidean algorithm to find (840, 504).We obtain the following equations:

840 = (504)(1) + 336

504 = (336)(1) + 168

336 = (168)(2) + 0

so that the last nonzero remainder and hence the greatest common divisor is168. To express 168 as a linear combination of 840 and 504, we have

168 = (504)(1) + (336)(−1)

= (504)(1) + [(840)(1) + (504)(−1)](−1)

= (840)(−1) + (504)(2)

so that 168 = (840)(-1) + (504)(2).

Theorem 9. If c > 0, then (ca, cb) = c(a, b).

Proof. In the proof of the Euclidean algorithm, we multiply each equation by cto obtain the GCD for ca and cb, thus:

cb = cq1a+ cr1, 0 ≤ cr1 < ca

ca = cq2r1 + cr2, 0 ≤ cr2 < cr1

cr1 = cq3r2 + cr3, 0 ≤ cr3 < cr2...

...

crk−2 = cqkrk−1 + crk, 0 ≤ crk < crk−1

crk−1 = cqk+1rk

Clearly, this shows that

(cb, ca) = (ca, cr1) = (cr1, cr2) = · · · = crk = c(a, b)

22

Page 24: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Example 18. From the preceding example, we have (840, 504) = 168. Usingc = 5, we have (4200, 2520) = 5(840, 504) = 5(168) = 840.

Definition 4. If a|n and b|n, then n is called a common multiple of a andb.

Example 19. Let a = 12, b = 9. Then if n = 72, we have a|n and b|n, son = 72 is a common multiple of a and b.

Definition 5. Let a, b be nonzero integers. A positive integer m = [a, b] iscalled the least common multiple of a and b if it satisfies the following:

(a) a|m and b|m

(b) If a|c and b|c, where c > 0, then m|c

Example 20. Let a = 12 and let b = 15. The first few positive multiples of 12are 12, 24, 36, 48, 60, 72, 84, 96, 108, 120 while the first few positive multiplesof 15 are 15, 30, 45, 60, 75, 90, 105, 120. We see that 60 is the smallest commonmultiple of 12 and 15, and so we write [12, 15] = 60.

The following theorem gives the basic properties of the least common multiple,aside from those included in the definition:

Theorem 10. Let m = [a, b]. Then we have

1. If a|n and b|n, then m ≤ n.

2. [a, b] = b if and only if a|b.

3. max { a, b } ≤ m ≤ ab.

4. If c|a and c|b, then

[a

c,b

c

]=m

c.

5. For any positive integer n, we have [an, bn] = n [a, b].

Proof.

1. From the second part of our definition, we have m|n, so that m ≤ n.

2. Let [a, b] = b. Then from the definition, we must have a|b. Conversely,suppose a|b. Then since we also have b|b, it is clear that b is a commonmultiple of a and b. If n is any other common multiple of a and b, then wehave b|n, so the second part of the definition is satisfied, and [a, b] = b.

3. Since a|m and b|m, it is clear that a ≤ m and b ≤ m, and hencemax { a, b } ≤ m. Now ab is a common multiple of a and b, so thatm|ab and hence m ≤ ab.

23

Page 25: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

4. Let j =

[a

c,b

c

], so that

a

c|j and

b

c|j . Hence, a|cj and b|cj, so that

cj is a common multiple of a and b. Thus, m|cj and som

c|j . On the

other hand, since a|m and b|m, we havea

c

∣∣∣mc

andb

c

∣∣∣mc

. This shows

thatm

cis a common multiple of

a

cand

b

c, and so j

∣∣∣mc

. This shows that

j =m

c=

[a

c,b

c

].

5. Let f = [an, bn]. We want to show that f = mn. Since a|m and b|m,we have an|mn and bn|mn, and so mn is a common multiple of an andbn. Thus, f |mn, and there exists an integer c such that mn = fc and

f =mn

c. Since n|an and n|bn, we know from (4) that

[a, b] =

[an

n,bn

n

]=f

n=m

c= m

This means that c = 1, so that

f = [an, bn] =mn

c= mn = n [a, b]

When the numbers involved are big, it is not so easy to determine the leastcommon multiple. The following theorem gives a relation between the lcm andthe gcd of the same two integers. It also gives a way to compute the leastcommon multiple when the numbers involved are large.

Theorem 11. Let a, b be positive integers. Then

(a, b) [a, b] = ab

Proof. Let d = (a, b), so there exist integers r and s so that a = dr and b = ds.

Let m =ab

d, so that m = as = rb. The last equation shows that m is a common

multiple of a and b. To show that m = [a, b], let c be any other positive commonmultiple of a and b. We may write c = au = bv for some integers u and v. Sinced = (a, b), there exist integers x and y such that d = ax+ by. This gives us

c

m=cd

ab=c(ax+ by)

ab=(cb

)x+

( ca

)y = vx+ uy ∈ Z

which shows that m|c, and so m ≤ c. The last inequality complete the require-ments for m = [a, b]. We now have

m = [a, b] =ab

d=

ab

(a, b)

24

Page 26: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

or, equivalently,[a, b] (a, b) = ab

Example 21. To find [840, 504], we have

[840, 504] =(840)(504)

(840, 504)=

423360

168= 2520

Example 22. Let a and b be positive integers. Show that (a, b) = [a, b] if andonly if a = b.Solution:Let m = (a, b) = [a, b]. By Theorem ??, we have

(a, b)[a, b] = m2 = ab

Since a|m and b|m, we can write m = ax = by for some integers x and y. Thus,

ab = m2 = (ax)(by) = (ab)(xy)⇒ xy = 1

Since a and b are both positive, it follows that x = y = 1, so that m = ax = a =by = b.

Conversely, if a = b, then a|b, so that (a, b) = a by part (1) of Theorem ??.Also, b|a, so that [a, b] = a by part (2) of Theorem ??. Hence, (a, b) = [a, b].

An immediate consequence of Theorem ?? is the following corollary:

Corollary 5. Let a and b be positive integers. Then [a, b] = ab if and only if(a, b) = 1.

Remark. The definitions of the gcd and the lcm may be extended to any finiteset of nonzero integers. Thus,

1. d = (a1, a2, . . . , an) if and only if d|ai for i = 1, 2, . . . , n and if c is apositive integer such that c|ai for i = 1, 2, . . . , n, then c ≤ d.

2. m = [a1, a2, . . . , an] if and only if ai|m for i = 1, 2, . . . , n and if c isa positive integer such that ai|m for i = 1, 2, . . . , n, then m ≤ c.

The following result is easy to show, and is left as an exercise.

Theorem 12.

1. For any three integers a, b, c, we have [a, b, c] = [[a, b], c].

2. For any set of integers a1, a2, . . . , an, we have

[a1, a2, . . . , an] = [[a1, a2, . . . , an−1], an]

Example 23. To find [63, 91, 104], we have [63, 91, 104] = [[63, 91], 104] =[819, 104] = 6552.

1. For each pair of integers, use the Euclidean algorithm to find the greatestcommon divisor of the numbers in the pair.

25

Page 27: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

(a) 102, 402

(b) 231, 273

(c) 126, 621

(d) 104, 299

(e) 221, 273

(f) 185, 222

2. Use the Euclidean algorithm to obtain integers x and y satisfying thefollowing:

(a) (56, 72) = 56x+ 72y

(b) (1769, 2378) = 1769x+ 2378y

3. Find all pairs of integers a and b such that 1 ≤ a < b ≤ 10 and (a, b) = 1.

4. Find [306, 657] using the equation given in Theorem ??

5. Show that (a, b, c) = ((a, b), c).

6. If a, b and c are pairwise relatively prime, show that (a, b, c) = 1.

7. Let m = [a, b] and d = (a, b). Prove that d|m.

8. Prove part (1) of Theorem ??. Part (2) follows from part (1) by induction.

2.4 Prime Numbers and Their Distribution

Definition 6. A positive integer p > 1 is said to be prime if it has only twodistinct positive divisors, namely: 1 and p itself. If p is not prime, then we saythat it is composite.

Example 24.

1. 23 is a prime since its only positive divisors are itself and 1.

2. 45 is composite since its positive divisors are 1, 3, 5, 9, 15 and 45.

Remark. If n is a composite number, then there exist integers a and b suchthat

n = ab, 1 < a < n, 1 < b < n

The following theorem by Euclid shows that the number of primes is infinite.

Theorem 13. (Euclid) : There are infinitely many primes.

Proof. We prove this by contradiction . Assume that there are only finitelymany primes, say p1, p2, . . . , pn. Let N = p1p2 · · · pn + 1. Clearly, N is notdivisible by any of the primes pi since there is always a remainder of 1 when Nis divided by any of these primes. Thus, if N is composite, it must be divisibleby a prime other than the primes already enumerated. Otherwise, N is a primegreater than each pi, thus contradicting the assumption that all the primes havealready been enumerated. Therefore, the number of primes must be infinite.

26

Page 28: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Theorem 14. If p is a prime and m is an arbitrary positive integer, then

(m, p) =

{p if p|m1 if p 6 |m

Proof. Let d = (m, p). Since d|p and p is prime, we know that either d = 1 ord = p. If p|m, then we know that d = (m, p) = p. Since the converse of thisstatement is also true, we know that if d = p, then p|m. Hence, if p 6 m, wemust have d = 1.

Theorem 15. If p is a prime and p|ab, then either p|a or p|b.

Proof. Suppose that p|ab, and assume that p 6 |a. Since p is a prime, this meansthat (a, p) = 1 and so by Theorem ??, it follows that p|b.

Example 25. Prove that any prime of the form 3k+1 is also of the form 6k+1.Solution:

We will show that k must be even. Assume, to the contrary, that k is odd,so that 3k is also odd and hence 3k + 1 is even. Now 3k + 1 6= 2 since thereis no integer value for k which yields the value 2. This shows that 3k + 1 is anumber greater than 2 and divisible by 2, and hence must be even, contradictingour hypothesis. Thus, k = 2r is even, and we can write 3k + 1 = 6r + 1.

Corollary 6. If p is a prime and p|a1a2 · · · an, then p|am for some m ≤ n.

Proof. The proof is by induction. If n = 2, then our theorem shows that thestatement is true. For our inductive assumption, suppose that the statement istrue for all k < n. We show that is is also true for k = n. Suppose p|a1a2 · · · an =p|(a1a2 · · · an−1)(an). If p|an, then we take m = n and we are done. Otherwise,Theorem ?? tells us that p|a1a2 · · · an−1. By our inductive assumption, thereexists m ≤ n−1 such that p|am. In either case, we have found an integer m ≤ nsuch that p|am.

Corollary 7. If p, q1, q2, . . . , qn are all primes and p|q1q2 · · · qn, then p = qmfor some m ≤ n.

Proof. By our first corollary, we know that there exists m ≤ n such that p|qm.However, since p and qm are both primes, this can only happen if p = qm.

The next theorem is one of the most important foundation theorems in numbertheory.

Theorem 16. (Fundamental Theorem of Arithmetic)Every positive integer n > 1 is either a prime or can be uniquely expressed as aproduct of primes.

27

Page 29: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Proof. We will use the second principle of mathematical induction. In this case,the second part of the inductive process will assume that the statement to beproven is true for all integers greater than 1 and less than n. The last step is toprove that it is also true for n.

If n = 2, then n has only one prime factor, which is itself. So suppose it istrue when 2 ≤ n < k, and we prove that it is true when n = k. We considertwo cases.

Case 1: If k is prime, then we are done.

Case 2: If k is composite, then there exist integers a and b such thatk = ab, 1 < a < k, 1 < b < k. By our inductive assumption, a and b areboth products of primes, and hence so is k.

To show uniqueness, suppose there exist primes p1, p2, . . . , pr, q1, q2, . . . , qssuch that

n = p1p2 · · · pr = q1q2 · · · qswhere the prime factors are arranged in increasing order. The above equationsays that p1 divides the product q1q2 · · · qs, so by Corollary ??, we have p1 = qkfor some k ≥ 1. Hence, p1 ≥ q1. Similarly, we can show that q1 ≥ p1, so thatp1 = q1. We can therefore divide both products representing n by p1 = q1. Bya similar argument, we can show that p2 = q2, p2 = q3 and so on. If r < s, wewill obtain an equation of the form

1 = qr+1 · · · qs

If r > s, we will have1 = ps+1 · · · pr

Both of these are impossible, so we must have r = s. This shows that everypositive integer greater than 1 is uniquely expressible as a product of primes.

Corollary 8. If n is composite and p is the least prime divisor of n, thenp ≤√n

Proof. Since p|n, there exists a positive integer m such that n = pm, wherem > 1 because n is composite. By the preceding theorem, there exists a primeq which divides m, so that m = qk for some integer k ≥ 1. Since m|n, we musthave q|n. By hypothesis, p is the smallest prime dividing n, so that p ≤ q, andhence

p2 ≤ pq ≤ pqk = pm = n

and hence p ≤√n.

Example 26. Let n = 253. If n is composite, then any prime divisor of n mustbe less than or equal to

√n =

√253 ≈ 15.9. Hence, the only possible prime

divisors of 253 are 2, 3, 5, 7, 11 1nd 13. The divisibility test show that 2, 3 and5 are not divisors of 253, while actual division shows that 7, 11 and 13 are alsonon-divisors of 253. This shows that n = 253 must be prime.

28

Page 30: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Corollary 9. (Unique Factorization Theorem)Any positive integer n > 1 can be uniquely expressed in the form

n = pk11 pk22 · · · pkrr

where each ki is a positive integer and p1 < p2 < · · · < pr.

Example 27. We may write

360 = 23 · 32 · 5 and 276 = 22 · 3 · 23

Example 28. Prove that every integer of the form n4 + 4 is composite, for allpositive integers n > 1.Solution:

Using completing the square, we may write

n4 + 4 = n4 + 4n2 + 4− 4n2 = (n2 + 2)2 − (2n)2 = (n2 + 2n+ 2)(n2 − 2n+ 2)

Since n > 1, the second factor n2−2n+2 ≥ 2, while the first factor n2+2n+2 >n2 − 2n+ 2, which shows that the two factors are distinct and are both greaterthan 1. Thus, n4 + 4 is composite.

Example 29. If p ≥ 5 is a prime, show that p is of the form 6k + 1 or 6k + 5for some nonnegative integer k.

Solution:Since p is an odd prime, we know that p yields an odd remainder upon divisionby 6. Thus, the remainder r is 1, 3 or 5. If r = 3, then p = 6k + 3 = 3(2k + 1)which is composite, contradicting the hypothesis. This shows that r is just either1 or 5.

1. Find the prime factorization of the following integers: 1234, 10140, 36000.

2. If (a, b) = p and p is a prime, find all the possible values of (a2, b2), (a2, b)and (a3, b2).

3. Prove the following:

(a) Every integer of the form 3n+ 2 has a prime divisor of this form.

(b) If p ≥ q ≥ 5 and both p and q are primes, then 24|(p2 − q2).

(c) If p is a prime and p|an where n > 1, prove that pn|an.

4. If n is the product of k primes, of which p is the smallest, show thatp ≤ n1/k

5. If n ≥ 9 and n− 2 and n+ 2 are both primes, then 3|n.

6. If p and q are distinct primes such that pq|n2, then pq|n.

29

Page 31: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

CHAPTER 3

THE THEORY OFCONGRUENCES

Overview

In the first chapter, the concept of divisibility was discussed. Divisibility isone of the fundamental topics in number theory, and many important resultsconcerning divisibility were discussed in the preceding chapter. In this chap-ter, we continue the study of divisibility but we will present it in a slightlydifferent form - in terms of congruences. Many results involving congruence canbe stated in terms of divisibility, but the notion of congruence and the corre-sponding notation allows a more convenient way of establishing deeper resultson divisibility.

3.1 Congruences: Definition and Basic Proper-ties

Definition 7. Let a, b ∈ Z and let n be a positive integer. We say that a iscongruent to b modulo n and denote this by

a ≡ b (mod n)

if and only if n|(a − b), i.e. n divides the difference of a and b. Equivalently,there exists an integer k such that

a− b = nk

Otherwise, we writea 6≡ b (mod n)

30

Page 32: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Example 30.

1. 24 ≡ 36 (mod 6) since 6|(36− 24).

2. 56 6≡ 35( mod 11) since 11 6 |(35− 56).

Theorem 17. If a, b ∈ Z and n is a positive integer, then a ≡ b (mod n) ifand only if a and b leave the same remainder upon division by n.

Proof. Suppose a ≡ b (mod n), so that n|(a− b). By the division algorithm, wemay write

a = q1n+ r1, b = q2n+ r2, 0 ≤ r1, r2 < n

Without loss of generality, we may assume that r1 ≥ r2. Thus we have

a− b = (q1n+ r1)− (q2n+ r2) = (q1 − q2)n+ (r1 − r2)

so thatr1 − r2 = (a− b)− (q1 − q2)n

Since the right-hand side of the last equation is divisible by n, so is the left-handside. But both r1 and r2 are nonnegative and less than n, so their difference isstrictly nonnegative and strictly less than n. This is possible only if r1− r2 = 0,or, equivalently, r1 = r2.

Conversely, suppose that in the relations

a = q1n+ r1, b = q2n+ r2, 0 ≤ r1, r2 < n

we have r1 = r2. Then

a− b = (q1n+ r1)− (q2n+ r2) = (q1 − q2)n

which shows that n|(a − b). From our definition of congruence, this meansa ≡ b (mod n).

Remark. From the division algorithm, if n is a fixed positive integer, thenany integer b can be written in the form b = qn + r, where 0 ≤ r < n. Sinceb− r = qn so that n|(b− r), we see that b ≡ r (mod n). This shows that everyinteger is congruent to exactly one of the numbers 0, 1, 2, . . . , n − 1, whichare the only possible remainders upon division by n. This leads to the followingdefinition:

Definition 8. Let n be a positive integer. A collection of n integers { a1, a2, . . . , an }is called a complete residue system modulo n or a crs if every integer b iscongruent modulo n to exactly one of the elements in the collection.

Example 31.

1. From the above remark, it follows that for any positive integer n, the set{ 0, 1, 2, . . . , n − 1 } is a complete residue system modulo n. This iscalled the set of least positive residues modulo n.

31

Page 33: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

2. If n = 5, then the set { 2, 8, 10, 21, 14 } forms a complete residue systemmodulo 5, since 2 ≡ 2 (mod 5), 8 ≡ 3 (mod 5), 10 ≡ 0 (mod 5), 21 ≡1 (mod 5), 19 ≡ 4 (mod 5)4, which shows that the numbers in the collec-tion have different remainders upon division by 5 and all possible remain-ders are represented by the numbers in the set. If b is any integer, then bis congruent modulo 5 to exactly one integer in the set- the one whichhas the same remainder as b when divided by 5.

Example 32. If S = { a1, a2, . . . , an } is a complete residue systemmodulo n and (a, n) = 1, prove that the set T = { aa1, aa2, . . . , aan } isalso a complete residue system modulo n.Solution:To prove this statement, we only have to show that the elements of T are pair-wise incongruent modulo n, so that their remainders include all the possibleremainders upon division by n. Thus, if i 6= j, then a1 6≡ aj (mod n), sinceS is a complete residue system modulo n. Suppose aa1 ≡ aaj (mod n). Thenn|a(ai−aj), and since (a, n) = 1, it follows that n|(ai−aj). This is impossible,since this would mean that a1 ≡ aj (mod n). Hence, the elements of T arepairwise incongruent modulo n, and form a crs.

Definition 9. Let Zn denote the set of least positive residues modulo n, i.e.

Zn = { 0, 1, 2, · · · , n− 1 }

We define addition and multiplication modulo n as follows:

1. Addition (mod n)If a, b ∈ Zn, then a ⊕ b = a + b(mod n) is the least positive residue ofa+ b modulo n. For example, if n = 7, then

2⊕ 4 = 6

3⊕ 5 = 1 since 3 + 5 = 8 ≡ 1 (mod 7)

6⊕ 1 = 0 since 6 + 1 = 7 ≡ 0 (mod 7)

2. Multiplication (mod n)If a, b ∈ Zn, then a� b = a+ b(mod n) is the least positive residue of abmodulo n. For example, if n = 7, then

4� 6 = 3 since 4(6) = 24 ≡ 3 (mod 7)

3� 5 = 1 since 3(5) = 15 ≡ 1 (mod 7)

5� 4 = 6 since 5(4) = 20 ≡ 6 (mod 7)

3. Negative of a Least ResidueIf a ∈ Zn, then −a = b if a⊕ b = 0 in Zn. Thus, for example, if n = 10,then

−4 = 6,−8 = 2,−11 = −1 = 9

32

Page 34: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

The following theorem gives the basic properties of congruences.

Theorem 18. Let n > 0 and let a, b, c, d ∈ Z

1. a ≡ a (mod n)

2. The following statements are equivalent:

(a) a ≡ b (mod n)

(b) b ≡ a (mod n)

(c) a− b ≡ 0 (mod n)

3. If a ≡ b (mod n) and b ≡ c (mod n) then a ≡ c (mod n).

4. If a ≡ b (mod n) and c ≡ d (mod n) then a+ c ≡ b+ d (mod n).

5. If a ≡ b (mod n) and c ≡ d (mod n) then ac ≡ bd (mod n).

6. If a ≡ b (mod n) then a + c ≡ b + c (mod n) for any c and ac ≡bc (mod n)for any c > 0.

7. If a ≡ b (mod n), then ak ≡ bk (mod n) for any positive integer k.

8. Let n = [n1, n2, . . . , nk]. Then a ≡ b (mod ni), i = 1, 2, . . . , k if and onlyif a ≡ b (mod n).

Proof.

1. If a is any integer, then a−a = 0 = 0·n, so that n|(a−a) and a ≡ a (mod n)

2. If a ≡ b (mod n), then n|(a − b), so there exists an integer c such thata − b = nc. Hence, b − a = n(−c) which shows that b ≡ a (mod n).Similarly, b− a = 0− (a− b) = n(c) which shows that a− b ≡ 0 (mod n).We may also start from any of the given statements and show that theother two statements are true. Thus, the three statements are equivalent.

3. If a ≡ b (mod n), then n|(a − b), so there exists an integer r such thata− b = nr. Similarly, b ≡ c (mod n) means that there is an integer s suchthat b− c = ns. We then have

a− c = (a− b) + (b− c) = ns+ nr = n(s+ r)

which shows that n|(a− c), and hence a ≡ c (mod n).

4. Since a ≡ b (mod n) and c ≡ d (mod n), there exist integers r and s suchthat a− b = nr and c− d = ns. This gives us

(a+ c)− (b+ d) = (a− b) + (c− d) = nr + ns = n(r + s)

so that n|((a+ c)− (b+ d)) and so a+ c ≡ b+ d( mod n).

33

Page 35: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

5. Since a ≡ b (mod n) and c ≡ d (mod n), there exist integers r and s suchthat a − b = nr and c − d = ns. Equivalently, we have a = b + nr andc = d+ ns. Then

ac = (b+ nr)(d+ ns) = bd+ nrd+ bns+ n2rs = bd+ n(rd+ bs+ nrs)

or, equivalently,ac− bd = n(rd+ bs+ nrs)

This shows that n|(ac− bd), so that ac ≡ bd( mod n).

6. If a ≡ b( mod n), there exists an integer r such that a− b = nr. For anyinteger c, we have nr = a−b = (a+c)−(b+c), so that n|(a+c)−(b+c), or,equivalently, a+c ≡ b+c( mod n). If c > 0, then c(a−b) = ac−bc = n(cr)so that n|(bc− ac) and hence ac ≡ bc( mod n).

7. We use induction on he value of k. When k = 1, we have a ≡ b (mod n),which is true by hypothesis. Suppose that the statement is true for k = r,so that ar ≡ br (mod n). To show that it is also true for k = r+ 1, we useproperty (6), with c = ar and d = br. We get

a · ar ≡ b · br (mod n) or, equivalently, ar+1 ≡ br+1 (mod n)

8. Since a ≡ b (mod n), we have n|(a − b). Since ni|n for i = 1, 2, . . . , k,it follows that ni|(a − b), so that a ≡ b (mod ni), for i = 1, 2, . . . , k.Conversely, suppose that a ≡ b (mod ni), for i = 1, 2, . . . , k. Then fori = 1, 2, . . . , k, it follows that ni|(a−b), so that a−b is a common multipleof n1, n2, . . . , nk. Since n = [n1, n2, . . . , nk], we have n|(a − b), andso a ≡ b (mod n).

Below we show some applications of these properties.

Example 33. To find the remainder when 250 is divided by 7, observe that23 = 8 ≡ 1 (mod 7) and that 50 = 3(16) + 2. This gives us

250 = 23(16)+2 = (23)16 · 22 ≡ 116 · 4 ≡ 4(mod 7)

This shows that a remainder of 4 is obtained.

Example 34. To find the remainder when

15 + 25 + 35 + · · ·+ 995 + 1005

is divided by 4, observe that 1 ≡ 1(mod 4), 2 ≡ 2(mod 4), 3 ≡ 3(mod 4), 4 ≡0(mod 4), 5 ≡ 1(mod 4) and so on, so that the remainders repeat in the sequence1, 2, 3, 0. The fifth powers will then follow a similar sequence, and we have:

15 ≡ 1(mod 4), 25 = 32 ≡ 0(mod 4), 35 = 243 ≡ 0(mod 4), 45 ≡ 0(mod 4)

34

Page 36: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

The sequence of remainders 1, 0, 3, 0 repeats 25 times, so we have

15 + 25 + 35 + · · ·+ 995 + 1005 ≡ 25(1 + 0 + 3 + 0) ≡ 0(mod 4)

Thus, the given sum is divisible by 4.

Example 35. Prove that if a is an odd integer, then a2 ≡ 1(mod 8).Solution:Since a is odd, we can write a = 2k+1, so that a2 = 4k2+4k+1 = 4k(k+1)+1.Now k(k + 1) is even, so 4k(k + 1) ≡ 0(mod 8). This gives us

a2 = 4k(k + 1) ≡ 0 + 1 = 1(mod 8)

Theorem 19. Let f(x) be a polynomial with integer coefficients. If a ≡ b( mod m),then f(a) ≡ f(b)( mod m).

Proof. Letf(x) = a0 + a1x+ . . .+ anx

n, aj ∈ ZSince a ≡ b( mod m), we know from (7) of Theorem ?? that for each positiveinteger k we have

ak ≡ bk( mod m)

We then have

a0 ≡ a0( mod m)

a1a ≡ a1b( mod m)

a2a2 ≡ a2b

2( mod m)

......

anan ≡ anb

n( mod m)

where the congruences after the first were obtained by applying (5) of Theorem??. By property (4) of the said theorem, we can add the corresponding membersof the above congruences, to get

n∑j=0

ajan ≡

n∑j=0

ajbn( mod n)

or, equivalently,f(a) ≡ f(b)( mod n)

Example 36. Let f(x) = x2 + 3x − 4. Let a = 5, b = −3, m = 4. We knowthat 5 ≡ −3 (mod 4). We have

f(a) = f(5) = 52 + 3(5)− 4 = 25 + 15− 4 = 36

f(b) = f(−3) = (−3)2 + 3(−3)− 4 = 9− 9− 4 = −4

f(b)− f(a) = 36− (−4) = 40 = 4(10)

so that m|(f(b)− f(a)) and f(b) ≡ f(a) (mod m).

35

Page 37: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

The preceding theorem provides a basis for the following well-known divisibilitytests.

Theorem 20. Let N be a positive integer, with N = 10mam + 10m−1am−1 +· · · + 10a1 + a0 as the decimal (or base ten) representation of N . Let S =a0 + a1 + · · ·+ am. Then 9|N if and only if 9|S, i.e. a number N is divisible by9 if and only if the sum of its digits is divisible by 9.

Proof. Let f(x) =

m∑k=0

akxk be a polynomial with integer coefficients ak. Then

f(10) = N and f(1) = S. Moreover, 10 ≡ 1(mod 9), so by Theorem ??, wehave

N = f(10) ≡ f(1) = S(mod 9)

This shows that S and N are either both divisible or both not divisible by 9.

Theorem 21. Let N be a positive integer, with N = 10mam + 10m−1am−1 +· · · + 10a1 + a0 as the decimal (or base ten) representation of N . Let T =a0 − a1 + a2 − · · · + (−1)mam. Then 11|N if and only if 11|T , i.e. a numberN is divisible by 11 if and only if the alternating sum of its digits is divisible by11.

Proof. The proof is similar to that of the immediately preceding theorem. Let

f(x) =

m∑k=0

akxk be a polynomial with integer coefficients ak. Then f(10) = N

and f(−1) = T . Moreover, 10 ≡ −1(mod 11), so by Theorem ??, we have

N = f(10) ≡ f(−1) = T (mod 11)

This shows that T and N are either both divisible or both not divisible by11.

Example 37. Let N = 77, 468, 886. To test if N is divisible by 9 or by 11, weget

S = 7 + 7 + 4 + 6 + 8 + 8 + 8 + 6 = 54 = 9(6)

which is divisible by 9. This means that N is also divisible by 9. On the otherhand, we have

T = 6− 8 + 8− 8 + 6− 4 + 7− 7 = 0 = 11 · 0

which shows that T is divisible by 11. Hence, N is also divisible by 11.

1. Show that the integer 53103 + 10353 is divisible by 39.

2. Prove: If a ≡ b (mod n) and m|n, then a ≡ b(mod m).

3. Show that 43|{6n+2 + 72n+1}, for any positive integer n.

36

Page 38: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

4. Show that 97|248 − 1.

5. Prove: If ab ≡ cd(mod n) and b ≡ d(mod n) and (b, n) = 1, then a ≡c(mod n).

6. Without performing the divisions, determine whether the number 149,235,678is divisible by 9 or 11.

7. Prove: A number N is divisible by 4 if and only if the number formed byits tens and units digits is divisible by 4.

3.2 Linear Congruences

Definition 10. An equation of the form ax ≡ b(mod m) where a, b are integersand m is a positive integer is called a linear congruence. A solution to thislinear congruence is an integer x0 which satisfies the congruence, i.e. ax0 ≡b(mod m). This means that there is an integer k such that ax0 − b = km, or,equivalently, m|(ax0 − b).

Example 38. The linear congruence 6x ≡ 9(mbox mod 15) has x0 = 4 as oneof its solutions, since 6(4) - 9 = 15 = 15(1) is divisible by 15.

Remark. Note that if x0 is a solution to the linear congruence ax ≡ b(mod m)and x0 ≡ c)mod m), then by Theorem ??, we have

ac ≡ ax0 ≡ b(mod m)

which shows that c is again a solution to the same linear congruence. In thiscase, we say that x0 and c are congruent solutions of the linear congruence.Since any number of the form c = x0 − km where k is an integer will also bea solution, we obtain an infinite number of solutions. Thus, for finiteness, wewill only consider as distinct solutions to a linear congruence those that are notcongruent modulo m. Congruent solutions will be counted as just one solutionto a given linear congruence.

The following results will help us determine the existence or nonexistence ofsolutions to linear congruences.

Theorem 22. If ac ≡ bc (mod n) and d = (c, n), then a ≡ b (mod n/d).

Proof. Since ac ≡ bc (mod n), there exists k ∈ Z such that

ac− bc = c(a− b) = kn

Since d = (c, n), there exist integers r, s such that

(r, s) = 1, c = dr, , n = ds

This gives usc(a− b) = dr(a− b) = kn = kds

37

Page 39: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

so that r(a− b) = ks and s|r(a− b). Since (r, s) = 1, it follows that s|(a− b),which means that

a ≡ b (mod s) or a ≡ b (mod n/d)

If d = (c, n) = 1, we obtain the following corollary, which is the analogue ofthe cancellation law for congruence modulo n.

Corollary 10. If ac ≡ bc (mod n) and (c, n) = 1, then a ≡ b (mod n).

When the modulus n = p is a prime number, then the above corollary takes thefollowing form:

Corollary 11. If p is a prime number such that ac ≡ bc (mod p) and p 6 |c,then a ≡ b (mod p).

Example 39.

1. We have 45 ≡ 81 (mod 18). Since 45 = 9 · 5 and 81 = 9 · 9, we havec = 9, n = 18, d = (c, n) = (9, 18) = 9, n/d = 2. Hence, we can cancelc = 9 and get 5 ≡ 9 (mod 2).

2. We have 46 ≡ 28 (mod 9). Since 46 = 2 · 14 and 46 = 2 · 23, then if we letc = 2, n = 9, d = (c, n) = (2, 9), then we can cancel 2 from the givencongruence without changing the modulus, to obtain

23 ≡ 14 (mod 9)

Before we consider the more general result for the existence of solutions of linearcongruences, we first consider the following special case.

Theorem 23. The linear congruence

ax ≡ 1( mod m)

has a solution if and only if (a, m) = 1. Furthermore, if (a, m) = 1 and x1, x2are two solutions of the congruence, then x1 ≡ x2( mod m).

Proof. Suppose that the congruence

ax ≡ 1( mod m)

has a solution, say b. Then ab ≡ 1( mod m) so there exists an integer k such thatab− 1 = mk, or, equivalently, ab+m(−k) = 1, which shows that (ab, m) = 1.Thus,

(a, m) ≤ (ab, m) = 1

which shows that (a, m) = 1.

38

Page 40: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Conversely, suppose (a, m) = 1 and let S = { r1, r2, . . . , rφ(m) } be an rrsmod m. Then the set T = { ar1, ar2, . . . , arφ(m) } is also an rrs mod m. Since(1, m) = 1, there exists ari ∈ T such that

ari ≡ 1( mod m)

This shows that x = ri is a solution of the given congruence.To prove the second part of the assertion, let x1, x2 be any two solutions of

the given congruence. This shows that

ax1 ≡ 1( mod m) ax2 ≡ 1( mod m)

and , by transitivity, we get ax1 ≡ ax2( mod m). Since (a, m) = 1, we getx1 ≡ x2( mod m).

Example 40. If (a, m) = 1, show that the solution to the linear congruenceax ≡ b( mod m) is of the form x ≡ baφ(m)−1( mod m).

We have

ax ≡ a(baφ(m)−1( mod m) ≡ baφ(m)( mod m) ≡ b( mod m)

which shows that the solution is as indicated above.

Example 41. Find the solution of the linear congruence 5x ≡ 1( mod 11).Solution:

We have a = 5, m = 11, so that (a, m) = (5, 11) = 1. From the precedingexample, we have

x ≡ aφ(m)−1( mod 11) = 59 ( mod 11)

Since this value is computationally large, we use an alternative solution. Toconvert the coefficient on the left hand side of the original congruence to 1, wemultiply by a constant so that the residue of the resulting coefficient modulo 11is 1. Thus, we have

9(5x) = 45x = 44x+ x ≡ x( mod 11) ≡ 9(1) = 9( mod 11)

so that x ≡ 9( mod 11).

Example 42. Find the solution of the congruence 3x ≡ 5( mod 11).Solution:

From the result of Example ??, we know that a solution exists since (a, m) =(3, 11) = 1. As in the preceding example, we multiply both sides of the congru-ence by 4, to get

12x = 11x+ x ≡ x( mod 11) ≡ (4)(5)( mod 11) ≡ 9( mod 11)

so that the solution is x ≡ 9( mod 11).

39

Page 41: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Theorem ?? is actually a special case of the following theorem.

Theorem 24. If (a, m) = d then the linear congruence ax ≡ b( mod m) has asolution if and only if d|b. In this case, the congruence had d mutually incon-gruent solutions modulo m of the form

x ≡ x0 +tm

d( mod m), t = 0, 1, . . . , d− 1

where x0 is a solution of the linear congruence (a/d)x ≡ (b/d) ( mod m/d).

Proof. If d 6 |b, then since d|a, it follows that d 6 |(ax − b) for all values of x.Since d|m, it follows that m 6 |(ax − b) for any choice of x, so that congruenceax ≡ b ( mod m) has no solution.

On the other hand, if d|b, then the congruence has a solution if we can findan integer x such that m|(ax− b), or, equivalently, if there is an integer x such

thatm

d|(ax− bd

). This is precisely the congruence

a

dx ≡ b

d

(mod

m

d

)Since

(ad,m

d

)= 1, we know from Theorem ?? that a unique solution modulo

m

dexists, say

x ≡ x0 ( mod m/d

This solution is actually made up of integers of the form

x = x0 + km

d, k ∈ Z

They also form solutions for our original congruence. Taking these integersmodulo m, we obtain d incongruent solutions, namely:

x0, x0 +m

d, x0 +

2m

d, . . . , x0 + (d− 1)

m

d

This completes the proof of the theorem.

Example 43. Show that the linear congruence

6x ≡ 15(mod 21)

has solutions, and find all incongruent solutions.Solution:We have d = (6, 21) = 3 and 3|15, so we know that the given congruencehas solutions. By Theorem ??, there are three incongruent solutions to thiscongruence. If we divide all constants in the given congruence by d = 3, we get

2x ≡ 5(mod 7)

40

Page 42: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

By inspection, x0 = 6 is a solution to this second congruence and is likewise asolution to the original congruence. The other two solutions are

x0 +m

d= 6 +

21

3= 6 + 7 = 13

x0 +2m

d= 6 + 2(7) = 20

Solve the following linear congruences:

1. 25x ≡ 15(mod 29)

2. 5x ≡ 2(mod 26)

3. 36x ≡ 8(mod 102)

4. 34x ≡ 60(mod 98)

5. 140x ≡ 133(mod 301)

3.3 Linear Diophantine Equations

Definition 11. A Diophantine equation is an equation in one or more un-knowns whose solutions are restricted to the set of integers.

Example 44.

1. A linear Diophantine equation in two unknowns is an equation of the formax+ by = c where a, b and c are integer constants.

2. The equation x2 + y2 = az2 where a is an integer constant is a quadraticDiophantine equation in three unknowns x, y and z.

In this section, we will discuss the conditions that will guarantee the existenceof solutions to the linear Diophantine equation in two unknowns given in (1)above.

Theorem 25.

1. The linear Diophantine equation ax+ by = c has a solution if and only ifd|c where d = (a, b).

2. If (x0, y0) is a particular solution of this equation, then any other solutioncan be expressed in the form

x = x0 +

(b

d

)t, x = y0 −

(ad

)t, t ∈ Z

Proof.

41

Page 43: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. Suppose d|c, so that c = dr for some integer r. Since d = (a, b), we knowthat there exist integers p, q such that d = ap+ bq. We then have

c = dr = (ap+ bq)r = a(pr) + b(qr)

which shows that x = pr, y = qr is a solution to the equation.

Conversely, suppose a solution x = x0, y = y0 exists, so that c = ax0+by0.Since d|a, d|b, there exist integers r and s such that a = dr, b = ds.Substituting these into our equation, we have

c = ax0 + by0 = drx0 + dsy0 = d(rx0 + sy0)

which shows that d|c.

2. Suppose (x0, y0) is a particular solution of this equation, and suppose

that a = dr, b = ds for integers r and s, with

(a

d,b

d

)= (r, s) = 1. Let

(x′, y′) be any other solution of the equation. Then

c = ax0 + by0 = ax′ + by′ or, equivalently a(x′ − x0) = b(y0 − y′)

If we divide the last equation by d, we get

s(y0 − y′) = r(x′ − x0)

This shows that r|s(y0 − y′), and since (r, s) = 1, we have r|(y0 − y′).This means that there exists an integer t such that y0 − y′ = rt. Sincer(x′ − x0) = s(y0 − y′) = srt, we get x′ − x0 = st. Thus, all solutions ofthe given Diophantine equation are expressible in the form

x′ = x0 + st = x0 +

(b

d

)t, y′ = y0 − rt = 00 −

(ad

)t

The preceding theorem gives us a procedure for solving a linear Diophantineequation of the form ax + by = c, assuming that d = (a, b) divides c, which isdescribed below:

42

Page 44: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Procedure for Solving a Linear DiophantineEquation in Two Unknowns

• Since d|c and d = (a, b), we can write c = dr and d = ap+ bq for some integers p, qand r.

• Write c = dr = r(ap+ bq) = a(pr) + b(qr). Then x0 = pr, y0 = qr is a solution of theequation.

• All other solutions may be obtained from the equations

x = x0 +

(b

d

)t, y = y0 −

(ad

)t, t ∈ Z

Example 45.

1. Show why the equation 14x+ 35y = 93 has no solution.

We have (14, 35) = 7 but 7 6 | 93, so the conditions of our theorem are notsatisfied.

2. Show that the Diophantine equation 24x+ 138y = 18 is solvable, and findall solutions.

We have (24, 138) = 6 and 6|18, so we know that solutions exist. More-over, we can write 24 = 6(4), 138 = 6(23) and 6 = 6(24) + (-1)(138).Thus, x0 = 18, y0 = −3 is a solution, since (24)(18) + (138)(-3) = 18.According to our theorem, all solutions are of the form

x′ = 18 + 23t, y′ = −3− 4t, t ∈ Z

Example 46. A certain number of sixes and nines are added to give a sum of126. If the numbers of sixes and nines are interchanged, the new sum is 114.How many of each were there originally?Solution:Let x and y denote the original number of sixes and nines, respectively. Thenthe original situation is described by the Diophantine equation 6x + 9y = 126.When the numbers are interchanged, the new equation is 9x+6y = 114. Solvingthese equations simultaneously gives us x = 6 and y = 10.

When the coefficients of a given equation are large, it may not be very convenientto obtain the solution using the method described in the proof or by solving theequivalent linear congruence. We may use a reduction procedure to make thecoefficients smaller. We demonstrate the procedure with the equation 123x +57y = 531. Since we can write 123 = 57(2) + 9, we can convert the givenequation to the form

9x+57(y+2x) = 531 or, equivalently 9x′+57y′ = 531, x′ = x, y′ = y+2x

43

Page 45: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

We reduce the coefficients further by using 57 = 9(6) + 3, so that our secondequation transforms into

9(x′ + 6y′) + 3y′ = 9x′′ + 3y′′ = 531, where x′′ = x′ + 6y′, y′′ = y′

Using 9 = 3(3) + 0, we may now write

0·x′′+3(3x′′+y′′) = 0·x(3)+3y(3) = 3y(3) = 531, where x(3) = x′′, y(3) = 3x′′+y′′

The last equation gives us y(3) = 177, while x(3) can be any number. We canfind the values of x and y by working our way from (x, y) to (x′, y′) to (x′′, y′′)to (x(3), y(3)). The computations for these may be done together with ourreductions. The steps for this particular equation are enumerated below.

1. 123x+ 57y = 531, x = x, y = y

2. 9x+ 57(y+ 2x) = 531, x = x, y = −2x+ y+ 2x = y become transformedinto 9x′ + 57y′ = 531, x′ = x, − 2x′ + y′ = y.

3. 9(x′+6y′)+3y′ = 531, x′+6y′−6y′ = x, −2x′+y′ = −2(x′′−6y′)+y′ =−2x′′ + 13y′ = y are transformed into 9x′′ + 3y′′ = 531, x′′ − 6y′′ =x, − 2x′′ + 13y′′ = y.

4. 9x′′ + 3y′′ = 3(3x′′ + y′′) + 0 · x′′ = 531, x′′ − 6y′′ = 19x′′ − 6(y′′ +3x′′) = x, − 2x′′ + 13y′′ = −41x′′ + 13(y′′ + 3x′′) = y are converted to3y(3) = 531, 19x(3) − 6y(3) = x, − 41x(3) + 13y(3) = y.

Using y(3) = 177 and x(3) = u ∈ Z, we then have

x = 19u− 1062, y = −41u+ 2301

Since u is an arbitrary integer and 1062 = 19(56) - 2, we may further reducethe coefficients of the solutions by the transformation u = 56 − t, so that oursolutions can now be expressed in the form

x = 19(56− t)− 1062 = 2− 19t, y = −41(56− t) + 2301 = 5 + 41t

The computations can be facilitated by working only on the coefficients andperforming the appropriate sequence of elementary column operations on thematrix representing the coefficients. At each step, we multiply one columnby a scalar and add the result to the other column. In the illustration givenbelow, the scalars used are enclosed in parenthesis and shown at the bottomof the column to which they were used. We do this alternately until one ofthe coefficients in the first row becomes zero. For our particular equation, thematrix is set up from the coefficients of 123x+ 57y = 531, x = x, y = y. Wehave

123 57 5311 00 1

(−2)

9 57 5311 0−2 1

(−6)

9 3 5311 −6−2 13

(−3)

0 3 53119 −6−41 13

44

Page 46: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

If we denote by (u, v) the transformed variables in the last matrix, then thefirst row of the last matrix gives 0 · u + 3v = 531, or v = 177, as before. Theother two rows give us

x = 19u− 6v = 19u− 1062, y = −41u+ 13v = −41u+ 2301

, the solutions we obtained earlier.The procedure illustrated above may be generalized to a Diophantine equationwith several unknowns. As a generalization of Theorem ??, the Diophantineequation

a1x1 + a2x2 + · · ·+ anxn = c

has an integral solution if and only if (a1, a2, . . . , an)|c. The matrix represen-tation for this equation is

a1 a2 · · · an c1 0 · · · 00 1 · · · 0...

......

...0 0 · · · 1

We reduce the coefficients and solve the given equation using the followingprocedure:

1. Locate the coefficient in the first row with the least absolute value. Callthe column containing this entry the pivotal column.

2. Add appropriate multiples of the pivotal column to each of the othercolumns to minimize the absolute values of the other coefficients in thefirst row.

3. Repeat steps (1) and (2) until all except one of the coefficients in the firstrow are zeros.

4. Obtain the solution from the last matrix formed.

Example 47. Solve the equation 15x+ 12y + 30z = 24.Since (15, 12, 30) = 3 divides 24, we know that the given equation has

infinitely many integral solutions. Our starting matrix takes the form

15 12 30 241 0 00 1 00 0 1

The least coefficient is 12, which is found in the second column, so we addmultiples of the second column to the first and the third columns to reduce the

45

Page 47: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

values of 15 and 30. This gives us

3 12 6 241 0 0−1 1 −2

0 0 1

The least entry is 3, which is found in the first column. Since 12 and 6 are bothmultiples of 3, our next reduction will change these entries to zeros. We get

3 0 0 241 −4 −2−1 5 0

0 0 1

The first row yields the equation 3t = 24 or t = 8. The other rows give us thesolutions

x = t− 4u− 2v = 8− 4u− 2v, y = −t+ 5u = −8 + 5u, z = v, u, v ∈ Z

1. Determine if the given Diophantine equations are solvable or not. If solv-able, find all solutions.

(a) 6x+ 51y = 22

(b) 33x+ 14y = 115

(c) 56x+ 72y = 40

2. If (a, b) = 1, a, b > 0, prove that the Diophantine equation ax− by = chas infinitely many positive solutions.

3. Use the reduction method described in this section to find all solutions tothe following Diophantine equations:

(a) 15x− 36y + 60z = 21

(b) 25x+ 30y − 55z + 60w = 45

4. Solve each of the following problems using Diophantine equations.

(a) A small theater charges P180 for adults P75 for children. On aparticular screening, the total receipts was P9000. Assuming thatmore adults than children were present, how many people attendedthe screening?

(b) Divide 100 into two parts such that one part is divisible by 7 and theother by 11.

(c) If a number of coins is divided equally among 77 persons, there willbe 27 left over, but if these are divided among eight persons, thenthe number is exact. How many coins are there?

46

Page 48: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

3.4 The Chinese Remainder Theorem

In this section, we will study how to solve a set of simultaneous linear congru-ences. Suppose, for example, that we want to find the smallest positive integer xgreater than 1 so that when it is divided by 3, 5 and 7, separately, the remainderwill always be equal to 1. Then this can be stated as a problem on congruenceswhere we want to find a number x satisfying all of the following congruences:

x ≡ 1(mod 3)

x ≡ 1(mod 5)

x ≡ 1(mod 7)

Problems of this type fascinated early mathematicians, and the search for solu-tions has a long history. Since the Chinese were among those who made earlycontributions towards solving the problem, the algorithm for solving simultane-ous congruences is named after them. We have the following:

Theorem 26. (Chinese Remainder Theorem) Let m1, m2, . . . , mr berelatively prime in pairs, so that (mi, mj) = 1 whenever i 6= j. Also leta1, a2, . . . , ar be a set of r integers. The system of congruences

x ≡ ai( mod mi), i = 1, 2, . . . , r

has a solution x0. Moreover, any two solutions are congruent modulo m =m1m2 · · · cr = [m1, m2, . . . , mr].

Proof. Let

Mi =m

mi, i = 1, 2, . . . , r

Clearly, (Mi, mi) = 1 for i = 1, 2, . . . , r, so each of the congruences Mib ≡1( mod mi) has a solution which we denote by bi. Moreover, Mibi ≡ 0( mod mj)if i 6= j. Define the integer x0 by

x0 =

r∑i=1

Mibiai = M1b1a1 +M2b2a2 + . . .+Mrbrar

Thenx0 =

∑j 6=i

Mjbjaj +Mibiai ≡ ai( mod mi)

which shows that x0 is a common solution to the system of congruences.To prove the second assertion, let x0 and x1 be two solutions to the system.

Then we have

x0 ≡ ai( mod mi), i = 1, 2, . . . , r

x1 ≡ ai( mod mi), i = 1, 2, . . . , r

47

Page 49: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

By transitivity, we have

x0 ≡ x1( mod mi), i = 1, 2, . . . , r

so thatx0 ≡ x1( mod m), m = [m1m2 · · ·mr]

Example 48.

1. To solve the problem posed at the beginning of this section, and using thenotation of the theorem, we wish to find the smallest positive integer xgreater than 1 whose remainder is 1 when divided separately by 3, 5 and7.

This is equivalent to finding a solution to the system of congruence

x ≡ 1( mod 3) x ≡ 1( mod 5) x ≡ 1( mod 7)

Since the numbers 3, 5 and 7 are relatively prime in pairs,we know fromthe Chinese remainder theorem that a solution exists. We have M1 =35, M2 = 21 and M3 = 15, and the congruences

35x ≡ 1( mod 3) 21x ≡ 1( mod 5) 15x ≡ 1( mod 7)

have solutions b1 = 2, b2 = 1, b3 = 1. The required integer is found tobe

x0 = (35)(2)(1) + (21)(1)(1) + (15)(1)(1) = 106

Note that 106 is just one more than the least common multiple of the threefactors 3, 5 and 7 , so we know that this is indeed the smallest positiveinteger greater than 1 which yields a common remainder of 1.

2. Use the Chinese remainder theorem to solve the congruence

8377x ≡ 4213( mod 9000)

Since 9000 = 23 · 32 · 53, the above congruence is equivalent to the systemof congruences

8377x ≡ 4213( mod 8) 8377x ≡ 4213( mod 9) 8377x ≡ 4213( mod 125)

which may also be expressed in the reduced form

x ≡ 5( mod 8) 7x ≡ 1( mod 9) x ≡ 44( mod 125)

To obtain a common solution to these congruences, we first obtain a so-lution to each of the congruences Mib ≡ 1( mod mi), i = 1, 2, 3. Wehave M1 = 1125, M2 = 1000, M3 = 72. Then

48

Page 50: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

The system 1125x ≡ 1( mod 8) has a solution b1 = 5

The system 1000x ≡ 1( mod 9) has a solution b2 = 1

The system 72x ≡ 1( mod 125) has a solution b3 = 33

We can then form

x0 = M1b1a1 +M2b2a2 +M3b3a3

= (1125)(5)(5) + (1000)(4)(1) + (72)(33)(44)

= 136, 669

This gives us

8377x0 − 4213 = (8377)(136669)− 4213 = (127208)(9000)

which shows that 8377x0 ≡ 4213( mod 9000), and so x0 = 136669 is asolution to the given congruence.

Example 49. When eggs in a basket are removed 2, 3, 4, 5 or 6 at a time,there remain, respectively, 1, 2, 3, 4 or 5 eggs. When the eggs are removed 7at a time, then no egg is left over. Find the smallest number of eggs that thebasket can contain.Solution:The above problem, usually called the basket-of-eggs problem, is equivalent to thesystem of congruences

x ≡ 1(mod 2 x ≡ 4(mod 5x ≡ 2(mod 3 x ≡ 5(mod 6x ≡ 3(mod 4 x ≡ 0(mod 7

Since (2, 4) = (2, 6) = (4, 6) = 2 6= 1, the problem does not satisfythe condition that the moduli be relatively prime in pairs. However, since x ≡1(mod 2 means that x must be odd and x ≡ 3(mod 4 also means that x mustbe odd, we may remove the first congruence from our system. The congruencex ≡ 5(mod 6 is equivalent to the two congruences x ≡ 5(mod 2 and x ≡ 5(mod 3,which can be reduced to x ≡ 1(mod 2 and x ≡ 2(mod 3, respectively. Since theseare already included in the system, we may remove the congruence involvingmodulo 6. Also, since x ≡ 0(mod 7, we know that x is a multiple of 7, sothat we can write x in the form x = 7k. Thus, the above system can now bereformulated as

7k ≡ 2(mod 3) or k ≡ 2(mod 3)

7k ≡ 3(mod 4) or k ≡ 1(mod 4)

7k ≡ 4(mod 5) or k ≡ 2(mod 5)

The resulting system can now be solved by the Chinese remainder theorem.

49

Page 51: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. Use the Chinese remainder theorem to solve each of the following systemsof congruences:

(a) x ≡ 1(mod3), x ≡ 2(mod5), x ≡ 3(mod7)

(b) x ≡ 5(mod11), x ≡ 14(mod29), x ≡ 15(mod31)

(c) x ≡ 5(mod6), x ≡ 4(mod11), x ≡ 3(mod17)

(d) 2x ≡ 1(mod5), 3x ≡ 9(mod6), 4x ≡ 1(mod7), 5x ≡ 9(mod11)

2. Solve the linear congruence 17x ≡ 3(mod210) by solving the system

17x ≡ 3(mod2) 17x ≡ 3(mod3)17x ≡ 3(mod5) 17x ≡ 3(mod7)

3. A band of 17 pirates sold a sack of coins. When they tried to dividethe fortune into equal portions, 3 coins remained. In the ensuing brawlover who should get the extra coins, one pirate was killed. The wealthwas redistributed, but this time, an equal division produced an extra 10coins. Again a fight developed and a second pirate was killed. When thecoins were redistributed once more, there was no coin left over, and thesurvivors all left happy with their share. What is the smallest number ofcoins that were stolen?

50

Page 52: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

CHAPTER 4

THE THEOREMS OF FERMATAND EULER

Overview

We continue our study of congruences by studying some important theorems bytwo of the most prolific mathematicians in number theory, namely: Pierre deFermat and Leonhard Euler. The former is of course most famous for his lasttheorem whose proof eluded mathematicians all over the world for more thanthree hundred years, while the latter showed mathematically that the Konigs-berg seven-bridges problem was unsolvable and thereby laid the foundation fora new branch of mathematics which is now known as Graph Theory. We willalso discuss a related result to the theorems by Euler and Fermat which is dueto Wilson.

4.1 Fermat’s Little Theorem

Theorem 27. (Fermat’s Little Theorem) If p is a prime and a is an integerwhich is not divisible by p, then

ap−1 ≡ 1(mod p)

Proof. Leta, 2a, 3a, . . . , (p− 1)a

be the first p− 1 positive multiples of a. It can be observed that

1. None of the numbers is divisible by p, since (a, p) = 1, so none of them iscongruent to 0 modulo p.

51

Page 53: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

2. The numbers are pairwise incongruent modulo p

These two observations lead us to conclude that the numbers above are con-gruent in some order to the possible nonzero remainders modulo p, namely theintegers 1, 2, 3, . . . , p − 1. The multiplication property of congruences thengives us

a · 2a · 3a · · · (p− 1) ≡ 1 · 2 · 3 · · · (p− 1) (mod p)

so thatap−1(p− 1)! ≡ (p− 1)! (mod p)

By the cancellation property of congruences and because (p − 1)! is relativelyprime to p, we finally have

ap−1 ≡ 1(mod p)

The following corollary follows immediately from Fermat’s theorem:

Corollary 12. If p is a prime and a is any integer, then ap ≡ a (mod p).

Proof. We consider two cases, as follows.Case 1:If (a, p) = 1, then by Fermat’s theorem, we have

ap−1 ≡ 1(mod p)

Multiplying both members of this congruence by a, we get ap ≡ a (mod p).Case 2:If (a, p) > 1, then (a, p) = p since p is prime, and so p divides a. Butthis means that a ≡ 0 (mod p), and by Property (8) of congruences, we haveap ≡ 0 (mod p). By transitivity of congruences, we then have ap ≡ a (mod p).

Thus, in both cases, we have the desired conclusion of the corollary.

The following examples illustrate different uses for Fermat’s theorem.

Example 50.

1. Show that 17 divides 11104 + 1.Using the language of congruence, this is equivalent to showing that 11104+1 ≡ 0(mod 17) or 11104 ≡ −1(mod 17). We need to check if the conditionsof Fermat’s theorem are satisfied. We have p = 17 is a prime, and a = 11is not divisible by 17. Fermat’s theorem then gives us

1116 ≡ 1(mod 17)

To get the desired congruence, we observe that 104 = 6(16) + 8 and 112 =121 ≡ 2(mod 17), so we write

11104 = (1116)6 · (118) ≡ 16 · 24 = 16 ≡ −1(mod 17)

which is what we wanted to show.

52

Page 54: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

2. The three most recent appearances of Halley’s comet were in the years1835, 1910 and 1986. The next appearance will be in 2061. Prove that

18351910 + 19862061 ≡ 0 (mod 7)

Since 1835 and 1986 are both not divisible by 7, the application of Fermat’stheorem gives us

18356 ≡ 1 (mod 7)

19866 ≡ 1 (mod 7)

Also, 1910 = 6(318) + 2 and 2061 = 6(343) + 3, so we have

18351910 = (18356)318 · (18352) ≡ 1318 · 12 ≡ 1 (mod 7)

19862061 = (19866)343 · (19863) ≡ 1343 · 53 ≡ 1 · −1 ≡ −1 (mod 7)

Hence,18351910 + 19862061 ≡ 1 + (−1) ≡ 0 (mod 7)

3. Find the units digit of 3100.Solution:The units digit of 3100 is the remainder when this number is divided by10. Since 10 = 2× 5, we have

34 ≡ 1(mod 5)⇒ 3100 = (34)25 ≡ 1(mod 5)

3 ≡ 1(mod 2)⇒ 3100 ≡ 1100 ≡ 1(mod 2)

Hence,3100 ≡ 1(mod 10)

which shows that the units digit of 3100 is 1.

4.2 Euler’s Generalization of Fermat’s Theorem

In itself, Fermat’s theorem was already an important result, because it madepossible computations involving very large integers by reducing the results mod-ulo some fixed positive integer m. Still, it is limited in application because itcan only be used when the modulus is a prime. Fortunately, Euler was able toobtain a generalization of Fermat’s result which can be applied to all moduli.We need to introduce the following:

Definition 12. Let n be a positive integer greater than 1. The number ofpositive integers less than and relatively prime to n is the value of Euler’stotient or φ function at n, and is denoted by φ(n).

Example 51.

1. Let n = 12. The following integers are smaller than and relatively prime to12: 1, 5, 7, 11. Since there are four integers in the list, we have φ(12) = 4.

53

Page 55: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

2. Let p be a prime. Since every positive integer less than p is relativelyprime to p and there are p− 1 such integers (from 1 up to p− 1), we haveφ(p) = p− 1. If p and q are distinct primes, then φ(pq) = (p− 1)(q − 1).

We now have Euler’s generalization of Fermat’s theorem:

Theorem 28. (Euler’s Theorem) If n is a positive integer and gcd(a, n) = 1,then aφ(n) ≡ 1(mod n).

Euler’s Theorem is given as Theorem 7-5 on pages 131-132 of Burton. Read and study theproof of the theorem.

Example 52.

1. Let n = 12, a = 5 so that gcd(a, n) = gcd(5, 12) = 1. From the precedingexample, we have φ(12) = 4, so that

aφ(n) = 54 = 625 = 12(52) + 1 ≡ 1(mod 12)

This illustrates Euler’s theorem.

2. Use Euler’s theorem to prove that for any integer a such that gcd(a, 1729) =1, we have a37 ≡ a (mod 1729). Use the fact that 1729 = 7 · 13 · 19.Using Property (8) of Theorem ??, we can show that the following con-gruences hold:

a37 ≡ a (mod 7)

a37 ≡ a (mod 13)

a37 ≡ a (mod 19)

Since gcd(a, 1729) = 1, it follows that a is also relatively prime to eachof the factors 7, 13 and 19 of 1729. By Euler’s theorem, we have

a37 ≡ (a6)6 · a ≡ 1 · a ≡ a (mod 7)

a37 ≡ (a12)3 · a ≡ 1 · a ≡ a (mod 13)

a37 ≡ (a18)2 · a ≡ 1 · a ≡ a (mod 19)

Hence, we also havea37 ≡ a (mod 1729)

3. Prove that (215 − 23) divides (a15 − a3) for any integer a.We use the fact that

215 − 23 = 23[212 − 1] = 23(26 + 1)(26 − 1)

= 23(22 + 1)(24 − 22 + 1)(23 + 1)(23 − 1)

= 23(22 + 1)(24 − 22 + 1)(2 + 1)(22 − 2 + 1)(2− 1)(22 + 2 + 1)

= 8(5)(13)(3)(3)(7) = 23 · 32 · 57 · 13

54

Page 56: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

We have

a15 = (a4)3 · a3 ≡ 1 · a3 = a3 (mod 8)

a15 = (a6)2 · a3 ≡ 1 · a3 = a3 (mod 9)

a15 = (a4)3 · a3 ≡ 1 · a3 = a3 (mod 5)

a15 = (a6)2 · a3 ≡ 1 · a3 = a3 (mod 7)

a15 = (a12) · a3 ≡ 1 · a3 = a3 (mod 13)

Thus, we also havea15 ≡ a3 (mod 215 − 23)

or, equivalently,a15 − a3 ≡ 0 (mod 215 − 23)

1. If gcd(a, 35) = 1, show that a12 ≡ 1(mod 35) by using Fermat’s theoremand Property (8) of Theorem ??.

2. Show that for any integer a, the numbers a5 and a have the same unitsdigit. (Hint: This is equivalent to showing that a5 ≡ a(mod 10)).

3. Show that 22225555 + 55552222 ≡ 0(mod 7) by first determining the valueof 1111 mod 7.

4. Use Euler’s theorem to prove that for any integer a such that gcd(a, 2730) =1, we have a13 ≡ a (mod 2730). Use the fact that 2730 = 2 · 3 · 5 · 7 · 13.

4.3 Wilson’s Theorem

Another important result about congruences involving a prime modulus p whichleads to many interesting consequences is what is known as Wilson’s theorem:

Theorem 29. (Wilson’s Theorem:) If p is a prime, then (p−1)! ≡ −1( mod p).

Proof. First observe the following:

(p = 2) : (2− 1)! = 1! = 1 ≡ −1( mod 2)

(p = 3) : (3− 1)! = 2! = 2 ≡ −1( mod 3)

(p = 5) : (5− 1)! = 4! = 24 ≡ −1( mod 5)

This shows that the theorem is true for the primes 2, 3 and 5. Thus, we mayassume that p > 5. The set S = { 1, 2, . . . , p − 1 } is an rrs mod p, so ifa ∈ S, we have (a, m) = 1, and the congruence ax ≡ 1( mod p) has a solution.Let x = r be a solution such that r ∈ S. This gives us ar ≡ 1( mod p). Sincep is prime, it is evident that a ≡ r( mod p) if and only if a ≡ ±1( mod p), or,equivalently, a = 1 or a = p − 1. If 2 ≤ a ≤ p − 2, then r is incongruent to a.

55

Page 57: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

This means that the remaining elements of S can be grouped in pairs a, r suchthat ar ≡ 1( mod p), so that

(p− 2)! = 2 · 3 · 4 · · · (p− 2) ≡ 1( mod p)

Multiplying both members by p− 1, we get

(p− 1)! = (p− 1)(p− 2)! ≡ p− 1( mod p) ≡ −1( mod p)

Example 53. Find the remainder when 15! is divided by 17. Solution:We have p = 17. By Wilson’s theorem, we have 16! ≡ −1( mod 17) ≡ 16( mod 17).Since (16, 17) = 1, we have 15! ≡ 1( mod 17). This shows that 15! yields a re-mainder of 1 upon division by 16.

Example 54. Arrange the integers 2, 3, . . . , 21 in pairs a, b such that ab ≡1( mod 23).

We have the following pairs:

(2, 12), (3, 8), (4, 6), (5, 14), (7, 10), (9, 18), (11, 21), (13, 16), (15, 20), (17, 19)

It can be verified that the product of the numbers in each pair is congruent to 1mod 23.

Example 55. Use Wilson’s theorem to find the remainder when 2(26!) is di-vided by 29. Solution:

Let p = 29. By Wilson’s theorem, we have

28! ≡ −1 ≡ 28(mod 29)

Since (28, 29) = 1, we can cancel 28 from both members of this congruence toget

27! = 27(26!) = −2(26!) ≡ 1(mod 29)

Multiplying both members by −1 ≡ 28(mod 29) gives us

2(26!) ≡ 28(mod 29)

which shows that the remainder when 2(26!) is divided by 29 is 28.

1. Verify that 4(29!) + 5! is divisible by 31.

2. Show that 18! ≡ −1 (mod 437). (Hint: Use the fact that 437 = (19)(23)).

3. If p is a prime, prove that

(p− 1)! ≡ p− 1 (mod 1 + 2 + · · ·+ (p− 1))

56

Page 58: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

4.4 The Function φ(n)

Euler’s φ-function or the so-called totient function was introduced in the pre-ceding section in connection with congruences. By itself, this function has manyinteresting number theoretic properties. We discuss some of these properties inthis section.

Theorem 30. Let m, n be relatively prime integers. Then φ(mn) = φ(m)φ(n).

Proof. Let r = φ(mn) and let S = { x1, x2, . . . , xr } be an rrs mod mn, andlet A = { y1, y2, . . . , ys } and B = { z1, z2, . . . , zt } be rrs’s mod m andmod n, respectively. To prove the theorem, we need to show that r = st. To dothis, we will show that the sets S and A×B have the same cardinality.

Define a function f : S → A × B as follows. For each xi ∈ S, we can findunique elements yj ∈ A and zk ∈ B such that

xi ≡ yj( mod m) xi ≡ zk( mod n)

We can then definef(xi) = (yj , zk) ∈ A×B

1. Show f is one-to-one: Let xp, xq ∈ S such that f(xp) = f(xq) = (yj , zk).This means that

xp ≡ yj( mod m) xq ≡ yj( mod m)xp ≡ zk( mod n) xq ≡ zk( mod n)

By transitivity, we get

xp ≡ xq( mod m) xp ≡ xq( mod n)

Since (m, n) = 1, this means that xp ≡ xq( mod mn). Since these areelements of an rrs S, this is only possible is xp = xq, and so f is one-to-one.

2. Show f is onto: On the other hand, if we begin with an arbitrary(yj , zk) ∈ A × B, we need to find an xi ∈ S such that f(xi) = (yj , zk).To this end, consider the congruences

nx ≡ 1( mod m) and mx ≡ 1( mod n)

Since (m, n) = 1, each of this has a unique solution, which we shall denoteby x1 and x2, respectively. Consider the number

x0 = nx1yj +mx2zk

We have

x0 ≡ nx1yj( mod m) ≡ yj( modm)

x0 ≡ mx2zk( modn) ≡ zk( modn)

57

Page 59: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Moreover,

(x0, m) = (nx1yj +mx2zk, m) = (nx1yj , m) = 1

(x0, n) = (nx1yj +mx2zk, n) = (mx2zk, n) = 1

since (nx1, m) = (yj , m) = (mx2, n) = (zk, n) = 1. This means that(x0, mn) = 1 and since S is an rrs mod mn, there exists a unique xi ∈ Ssuch that xi ≡ x0( mod mn). From the definition of f , it is clear thatf(xi) = (yj , zk) and f is onto.

Since there is a one-to-one correspondence between S and A×B, it followsthat

φ(mn) = |S| = |A×B| = φ(m)φ(n)

Example 56. Let m = 9, n = 10, so that (m, n) = 1, φ(m) = 6, φ(n) = 4.Since the conditions of the above theorem are satisfied, we have

φ(90) = φ(9 · 10) = φ(9)φ(10) = 6 · 4 = 24

Lemma 2. Let p be a prime and let e > 0. We have

1. φ(p) = p− 1

2. φ(pe) = pe − pe−1

Proof. Proof of (2): Among the integers less than or equal to pe, the only onesnot relatively prime to p, namely, the positive multiples of p, i.e. p, 2p, 3p, . . . , (pe−1)p =pe, and there are pe−1 of these numbers. Since there are pe numbers in the set{ 1, 2, . . . , pe }, the number of those that are relatively prime to p is

pe − pe−1

Theorem 31. If n > 1, then φ(n) = n∏p|n

(1− 1

p

).

Proof. Consider the prime factorization of n = pe11 pe22 · · · p

ekk where ei > 0. By

58

Page 60: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Theorem ??, we have

φ(n) = φ(pe11 pe22 · · · p

ekk )

= φ(pe11 )φ(pe22 ) · · ·φ(pekk )

=

k∏i=1

(pe1i − p

ei−1i

)=

k∏i=1

pe1i

(1− 1

pi

)

=

k∏i=1

peii

k∏i=1

(1− 1

pi

)

= n

k∏i=1

(1− 1

pi

)

Example 57. Consider n = 150. The primes that divide n are 2, 3 and 5. Toget φ(150), we use the formula from our theorem, thus

φ(150) = (150)

(1− 1

2

) (1− 1

3

) (1− 1

5

)= 150(1/2)(2/3)(4/5) = 40

This shows that there are 40 positive integers that are relatively prime to andless than 150.

Example 58. Show that φ(nm) = nφ(m) if every prime that divides n alsodivides m. Solution:

We have the following factorizations for n and m:

n = pr11 pr22 · · · p

rkk

m = ps11 ps22 · · · p

skk M

where (M, pi) = 1 for i = 1, 2, . . . , k. Thus, we have

φ(mn) = φ(pr1+s11 pr2+s22 · · · prk+skk M

)= pr1+s11 pr2+s22 · · · prk+skk

[k∏i=1

(1− 1

pi

)]φ(M)

= [pr11 pr22 · · · p

rkk ]

{ps11 p

s22 · · · p

skk

[k∏i=1

(1− 1

pi

)]φ(M)

}= nφ(m)

This shows that φ(nm) = nφ(m).

59

Page 61: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

The following theorem is a direct consequence of Theorem(??).

Theorem 32. If n > 2, then φ(n) is even.

Proof. We consider two cases:

1. n = 2k, k ≥ 2 i.e. n is a power of 2We then have

φ(n) = φ(2k) = 2k(1− 1/2) = 2k−1

which is even, since k − 1 ≥ 1.

2. n is not a power of 2Since n > 2, this means that there exists a prime p 6= 2 which divides n;thus, p must be odd. We can therefore write n = pkm, where k ≥ 1 and(p, m) = 1. This shows that

φ(n) = φ(pkm) = φ(pk)φ(m) = pk−1(p− 1)φ(m)

which is even since p− 1 is even.

Theorem 33. Let n ≥ 1. Then∑d|n

φ(d) = n.

Proof. We use induction on the number of distinct prime factors of n. If n = pk

where p is a prime, then we have∑d|n

φ(d) = φ(1) + φ(p) + φ(p2) + . . .+ φ(pk)

= 1 + (p− 1) + p(p− 1) + p2(p− 1) + . . .+ pk−1(p− 1)

= 1 +(p− 1)(1− pk)

1− p= +(p− 1)(1 + p+ . . .+ pk−1)

= pk = n

which proves that∑d|n

φ(d) = n.

For our inductive assumption, suppose that the theorem is true for all nwith k or fewer prime factors. We will show that it is also true for an integerwith k + 1 distinct prime factors. To this end, let n be a number with k + 1distinct prime factors, and let p be a prime dividing n, with pe as the highestpower of p that divides n. We may write n = peN , where N has k distinctprime factors and (N, pe) = 1. Observe that for any integer d such that d|N ,

60

Page 62: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

we have prd|n, r = 0, 1, . . . , e and (p, d) = 1. This means that∑d|n

φ(d) =∑d|N

φ(d) +∑d|N

φ(pd) +∑d|N

φ(p2d) + · · ·+∑d|N

φ(ped)

=∑d|N

φ(d) +∑d|N

φ(d)φ(p) +∑d|N

φ(d)φ(d2) + · · ·+∑d|N

φ(d)φ(d)φ(pe)

=∑d|N

φ(d)(1 + φ(p) + φ(p2) + · · ·+ φ(pe)

)=

∑d|N

φ(d)∑δ|pe

φ(δ)

= Npe = n

where the last line comes from our inductive assumption. This completes theproof of the theorem.

Example 59. If n = 63, then the divisors of n are 1, 3, 7, 9, 21 and 63. Wehave

φ(1) = 1 φ(3) = 2 φ(7) = 6φ(9) = 6 φ(21) = 12 φ(63) = 36

Then we have ∑d|63

φ(d) = 1 + 2 + 6 + 6 + 12 + 36 = 63

which illustrates the preceding theorem.

1. If the integer n has r distinct odd prime factors, prove that φ(n) is divisibleby 2r.

2. If n = 22k+1, k = 1, 2, , . . ., show that φ(n) is a perfect square.

3. Prove: φ(3n) = 3φ(n) if and only if 3|n.

4.5 Pythagorean Triples

One of the most important theorems in plane geometry gives a relation amongthe lengths of the sides of a right triangle. If x and y represent the lengths ofthe two legs and z represents the length of the hypotenuse, then these satisfythe Pythagorean equation

x2 + y2 = z2

In number theory, triples of positive integers (x, y, z) are called Pythagoreantriples if they represent solutions to the above equation.

Example 60.

61

Page 63: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

1. The triple (3, 4, 5) -s a Pythagorean triple, since 32 + 42 = 9 + 16 = 25 =52.

2. The triple (5, 12, 13) is also a Pythagorean triple, since 52 + 122 = 25 +144 = 169 = 132.

3. If (x, y, z) is a Pythagorean triple and d is any positive integer, then thetriple (dx, dy, dz) is again a Pythagorean triple, since

(dx)2 + (dy)2 = d2x2 = d2y2 = d2(x2 + y2) = d2z2 = (dz)2

This shows that every solution to the Pythagorean equation generates aninfinite number of other solutions by simply introducing a scaling factorin the form of a positive integer d.

We are interested in determining the particular solutions of the Pythagoreanequation which can not be expressed as multiples of ‘smaller Pythagorean triples.We define such triples as follows:

Definition 13. A Pythagorean triple (x, y, z) is said to be primitive if(x, y, z) = 1. In this case, this triple can not be expressed as a positive integralmultiple of another Pythagorean triple.

Example 61. The triples (3, 4, 5), (5, 12, 13) and (9, 40, 41) are all primitive,while (6, 8, 10) = (2 · 3, 2 · 4, 2 · 5) is not primitive.

Primitive Pythagorean triples are important because they can be used to gen-erate all other Pythagorean triples. This means that every Pythagorean tripleis representable as a multiple of a primitive Pythagorean triple. Thus, in oursearch for Pythagorean triples, all we have to do is determine the conditions thatyield primitive Pythagorean triples. These conditions are given in the followingtheorem:

Theorem 34. Let x, y, z be natural numbers such that (x, y, z) = 1. Thenthis triple is a primitive Pythagorean triple if and only if x = 2ab, y = a2 − b2and z = a2 + b2, where a and b are integers such that a > b > 0, (a, b) = 1 anda 6≡ b(mod 2).

The proof of this theorem requires the following lemma:

Lemma 3. Let u, v, w be positive integers such that (u, v) = 1, uv = w2.Then u and v are both perfect squares.

Proof of Lemma:Let p be a prime which divides u and let pk be the highest power of p whichdivides u. Since u and v are relatively prime, we know that p does not divide v.This shows that pk is the highest power of p which divides uv. Since uv = w2 isa perfect square, k must be even. This is true for any prime divisor of u, so thatu is the product of even powers of primes, and hence must be a perfect square.

62

Page 64: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

Repeating the argument for v, we can show that v is likewise a perfect square.�Proof of the Theorem:

Suppose that (x, y, z) is a primitive Pythagorean triple. Note that that ifd = (x, y), then if x2 + y2 = z2, then d|z, so that d|(x, y, z) = d|1, and henced = 1. This shows that x and y can not be both even. If we assume that x andy are both odd, then x2 ≡ y2 ≡ 1(mod 4), and so z2 = x2 + y2 ≡ 2(mod 4).However, this is impossible, since

• If z is odd, then z = 2k + 1 and z2 = 4k2 + 4k + 1 ≡ 1(mod 4)

• If z is even, then z = 2k and z2 = 4k2 ≡ 0(mod 4)

This shows that x and y can not be both odd either. Thus, one of these mustbe even and the other is odd. Without loss of generality, we can assume that xis even and y is odd. This makes z2 = x2 + y2 an odd integer, and hence z isalso an odd integer. If we let x = 2r, then we get

x2 = (2r)2 = 4r2 = z2 − y2 = (z + y)(z − y) ⇐ r2 =

(z + y

2

) (z − y

2

)If we let

t =

(z + y

2,z − y

2

)then we have

t

∣∣∣∣x+ y

2and t

∣∣∣∣x− y

2

and thus t divides any linear combination of these numbers. In particular, we

have t|z and t|y. Since (y, z) = 1, it follows that t = 1. Hence,z − y

2and

z + y

2satisfy the conditions of Lemma (??). Thus, there exist integers a and b suchthat

z + y

2= a2,

z − y2

= b2, z = a2 + b2, y = a2 − b2

Moreover,x2 = (z + y)(z − y) = 4a2b2, x = 2ab

Since y = a2 − b2, we know that a > b > 0. Since z = a2 + b2 is odd, we knowthat a 6≡ b(mod 2). �

Example 62.

1. If we let a = 2, b = 1, then (a, b) = 1, a 6≡ b(mod 2) so the conditionsof the theorem are satisfied. The triple

x = 2ab = 4, y = a2 − b2 = 4− 1 = 3, z = a2 + b2 = 4 + 1 = 5

is a primitive Pythagorean triple.

63

Page 65: Lecture Notes in Number Theory - FCAMPENA - Homefrancisjosephcampena.weebly.com/.../lecturenotes_number_theory.pdf · Lecture Notes in Number Theory. CONTENTS 1 Preliminary Concepts

2. The following table shows all the primitive Pythagorean triples that can beformed with a ≤ 7.

a b x y z2 1 4 3 53 2 12 5 134 1 8 15 174 3 24 7 255 2 20 21 295 4 40 9 416 1 12 35 376 5 60 11 617 2 28 45 537 4 56 33 657 6 84 13 85

1. Find all Pythagorean triples such that one of the members is 17.

2. Find all primitive Pythagorean triples whose components form an arith-metic progression.

3. Prove: If (x, y, z) is a Pythagorean triple, prove that at least one com-ponent is divisible by 3, and at least one component is divisible by 5.

4. Extend the table in the above example to include all primitive Pythagoreantriples with a ≤ 12.

64