Professional Documents
Culture Documents
Math 20133 - Elementary Number Theory
Math 20133 - Elementary Number Theory
Instructional Materials in
MATH 20133
Elementary Number Theory
compiled by
DMS Faculty
College of Science
Polytechnic University of the Philippines
2020
For the sole noncommercial use of the
Faculty of the Department of Mathematics and Statistics
Polytechnic University of the Philippines
2020
Contributors:
Abdul, Alsafat M.
Atienza, Jacky Boy E.
Bernardino, Rhea R.
Criseno, Regine Z.
Ferranco, Franny F.
Longhas, Paul Ryan A.
Saguindan, Ian J.
Sta. Maria, John Patrick B.
Urrutia, Jackie D.
2
Republic of the Philippines
POLYTECHNIC UNIVERSITY OF THE PHILIPPINES
COLLEGE OF SCIENCE
Course Description : This course covers the properties of integers; divisibility; primes and unique factorization; solutions of congruences and residue systems; linear
Diophantine equations, primitive roots; quadratic reciprocity law
COURSE PLAN
Week Topic Learning Outcomes Methodology Resources Assessment
• Prove the First Principle of Finite
Induction using the Well-Ordering
Preliminaries
Principle and Archimedean
• The Number System
Property.
• Review of Principle of • K. H. Rosen. Elementary
• Prove statements about integers
Mathematical Induction and Number Theory and Its
using Mathematical Induction.
Pigeonhole Principle Interactive lecture Applications
• State and prove the Division
Algorithm. • G. Jones and M. Jones.
Divisibility in the Integers Peer teaching Elementary Number
• Prove theorems related to the
Week 1-4 • Division algorithm Theory Quiz 1
divisibility of integers.
• Greatest Common Divisor Work-along exercises • Niven and Zuckermann.
• Prove and apply the Euclidean
• Euclidean algorithm An Introduction to the
Algorithm in obtaining the GCD Problem-based projects
• Relatively prime integers Theory of Numbers
• Establish the relationship • G. H. Hardy and E. M.
and the Least Common
between the gcd and lcm of an Wright. An Introduction to
Multiple
integer the Theory of Numbers
• Linear Diophantine
• Obtain solutions to Linear • C. Vanden Eynden.
Equations ax+by=c
Diophantine Equations using Elementary Number
Euclidean Algorithm Theory
Primes • K. Ireland and M. Rosen.
• Prove and apply the Fundamental
• Fundamental Theorem of Theorem of Arithmetic. A Classical Introduction to
Arithmetic • Obtain solutions to the Linear Modern Number Theory
• Prime distributions and Interactive lecture • Burton. Elementary
Diophantine Equations ax+by=c
the Sieve of Eratosthenes using Euclidean algorithm. Number Theory
Peer teaching • Barnett. Elements of
• Primality Testing and • Prove and apply the properties of
Week 5-8 Number Theory Quiz 2
Factorization congruences (e.g. remainder
Work-along exercises • Ore and Oystein. Number
problems).
• State and prove divisibility tests. Theory and Its History
Theory of Congruences Problem-based projects
• Basic Properties of • Determine solutions, if it exists, to
Congruences linear and system of linear
• Special Divisibility Tests congruences.
• Linear congruence and • Prove and apply Wilson’s
the Chinese Remainder Theorem and Fermat’s Little
Theorem Theorem.
• Fermat’s Little Theorem
and Wilson’s Theorem
Number-Theoretic
Functions
• The Functions 𝜏 and 𝜎 • State and prove the properties of
multiplicative functions.
• Möbius Inversion Formula
• Prove and apply Euler’s Theorem Interactive lecture
• Euler phi-function
• Prove and apply the properties of
• Euler’s Theorem
primitive roots. Peer teaching
Quiz 3
Week 9-12 • Determine the existence of
Primitive Roots and Indices
primitive roots to prime and Work-along exercises
• The order of an integer
composite integers.
modulo n Problem-based projects
• Determine solutions, if it exists, of
• Primitive roots of primes
certain congruences using the
• Composite numbers
theory of indices.
having primitive roots
• The theory of indices
Quadratic Reciprocity and
Other Topics
• Quadratic residues
• Legendre symbol • Prove Euler’s Criterion and apply
• Reciprocity laws in solving quadratic congruences.
Interactive lecture
• Arithmetic functions • Identify Legendre symbol and
• Pythagorean triples prove its properties.
Peer teaching
• Which primes are sums • Prove and apply Gauss’ Lemma.
Week 13-14 Final Examination
of two powers? • Prove and apply the Quadratic Work-along exercises
• No fourth power is the Reciprocity Law
sum of two fourth powers • Encrypt or Decrypt codes using Problem-based projects
Caesar cipher, Hill’s cipher, and
Applications RSA public-key algorithm.
• Cryptosystems
• RSA public-key
cryptography
COURSE GRADING SYSTEM
• Long Exams
• Attendance
• Recitation
• Problem sets/Assignments/Seatwork/Special Report
_________________________ _________________________
Prof. Jacky Boy E. Atienza Prof. Edcon B. Baccay
Faculty, Department of Mathematics and Statistics Chairperson, Department of Mathematics and Statistics
Approved by:
_________________________
Dr. Lincoln A. Bautista
Dean, College of Science
_________________________
Dr. Manuel M. Muhi
Vice President for Academic Affairs
Contents
1 Preliminaries 10
1.1 The Pigeonhole Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 The Principle of Mathematical Induction . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Divisibility Theory 19
2.1 The Division Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 The Greatest Common Divisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.3 Euclidean Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.4 Linear Diophantine Equation ax + by =c . . . . . . . . . . . . . . . . . . . . . . . . 30
4 Theory of Congruences 39
4.1 Basic Properties of Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Applications of Congruence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2.1 Leap-Year Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2.2 Computing the Day of the Week . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2.3 Cryptology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3 Divisibility Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5 Number-Theoretic Functions 50
5.1 Multiplicative Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.2 Euler Phi Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
8
7 Quadratic Reciprocity Law 67
7.1 Euler’s Criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
7.2 Legendre Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
7.3 Quadratic Reciprocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
9
Chapter 1
Preliminaries
OVERVIEW
This chapter will tackle the Well-Ordering Principle, the Archimedean Property, the Pigeonhole
Principle and the Principle of Mathematical Induction.
Learning Objectives
At the end of this chapter, the students are expected to:
1. Present the Well-Ordering Principle and Archimedean Property in the context of integers;
2. State and apply the Pigeonhole Principle in some counting problems; and
3. State and apply the Principle of Mathematical Induction in proving some related theorems
.
Basic Notations:
R := set of real numbers
Z := set of integers = {:::; −3; −2; −1; 0; 1; 2; 3; :::}
Z+ = N := set of positive integers = {1; 2; 3; :::}
Z− := set of negative integers = {−1; −2; −3; :::}
10
N0 := set of all whole numbers = {0; 1; 2; 3; :::}
Definition 1
p
The real number r is rational if there are integers p and q, with q 6= 0, such that r = . If r
q
is not rational, it is said to be irrational.
As a matter of notation, we will use Q to denote the set of all rational numbers while Q0 will denote
the set of all irrational numbers.
Example 1.
22 0 2 1000
1. The numbers ; 0= ; ; are all rational numbers. In fact, every integer n is a rational
7 1 15 313
n
number since n = .
1
√ √
2. The numbers 2; 3; ı; and e (Euler number ) are examples of irrational numbers.
Proof. Assume that for some a and b; na < b for every positive integer n. Then the set
S = {b − na | n ∈ N} ⊆ N. By Well-Ordering Principle, S has a least element, say b − ma: But
b − (m + 1)a also lies in S, since S contains all integers of this form. Furthermore, we have
1. If a = 5 and b = 12, then n can be taken as any positive integer greater 3 so that na ≥ b.
11
Theorem 2: The Pigeonhole Principle
If k + 1 or more objects are placed into k boxes, then at least one box contains two or more of
the objects.
Proof. If none of the k boxes contains more than one object, then the total number of objects would
be at most k. This contradiction shows that one of the boxes contains at least two or more of the
objects.
Example 3.
1. Here there are k + 1 = 10 pigeons in k = 9 holes. Since 10 > 9, the pigeonhole principle implies
that at least one hole has more than one pigeon.
2. Among any group of 10 people, at least two were born on the same day of the week.
Example 4.
l m
30
1. In a class of 30 students, at least 7
= 5 students were born on the same day of the week.
l m
30
2. In a class of 30 students, at least 12
= 3 students have birthdays on the same month.
12
1.2 The Principle of Mathematical Induction
Consider the sequence of sums of the first n odd positive integers.
1 = 1;
1 + 3 = 4;
1 + 3 + 5 = 9;
1 + 3 + 5 + 7 = 16;
1 + 3 + 5 + 7 + 9 = 25;
1 + 3 + 5 + 7 + 9 + 11 = 36:
From these values, we can conjecture that 1 + 3 + 5 + 7 + : : : + 2n − 1 = n2 , for every positive integer
n: But how can we prove that this formula actually holds for all positive integer n?
The Principle of Mathematical Induction (PMI) is a valuable tool for proving results about the integers
- such as the formula we have conjectured for the sum of the first n odd positive integers.
Therefore, S = N.
Proof. Let T be the set of all positive integers not in S, and assume that T 6= ?. By WOP, T has a
least element, we denote it by a. Since 1 is in S, certainly a > 1, and so 0 < a − 1 < a. The choice
of a as the smallest positive integer in T implies that a − 1 is not a member of T, or equivalently, that
a − 1 is in S. By hypothesis, S must also contain (a − 1) + 1 = a, which contradicts the fact that a is
in T. We conclude that the set T = ?, and consequently S = N.
Proof.
Basis step: Prove that the identity is true for n = 1. (Note: On the left hand side, n = 1 means
the number of terms. While on the right hand side, n = 1 is the particular integer value 1).
13
The left-hand side of the equation consists of one term which is equal to 1. The right-hand side
becomes (1)2 = 1: Hence, the formula is true for n = 1.
If suppose we check for n = 2, then we have
1 + 3 = (2)2 ⇐⇒ 4 = 4:
1 + 3 + 5 + : : : + (2k − 1) = k 2 ;
Now, using the formula for n = k and adding [2(k + 1) − 1] to both sides of the equation, we get
1 + 3 + 5 + : : : + (2k − 1) = k 2
1 + 3 + 5 + : : : + (2k − 1) + [2(k + 1) − 1] = k 2 + [2(k + 1) − 1]
= k 2 + 2k + 1
= (k + 1)2
We have proven the two conditions required by the Principle of Mathematical Induction.
Therefore, the formula is true for all positive integers n.
n(n + 1)(n + 2)
2. 12 + 22 + 32 + : : : + n2 = , for all n ≥ 1:
6
Proof.
Basis step: Prove that the identity is true for n = 1.
If n = 1, then
1(1 + 1)(2 · 1 + 1)
12 = ⇐⇒ 1 = 1
6
Hence, the formula is true for n = 1.
14
Inductive Step: Assume that the formula is true for n = k ≥ 1 :
k(k + 1)(k + 2)
12 + 22 + 32 + : : : + k 2 = :
6
(k + 1)[(k + 1) + 1][2(k + 1) + 1]
12 + 22 + 32 + : : : + k 2 + (k + 1)2 =
6
(k + 1)(k + 2)(k + 3)
=
6
Now, using the formula for n = k and adding (k + 1)2 to both sides of the equation, we get
k(k + 1)(k + 2)
12 + 22 + 32 + : : : + k 2 =
6
k(k + 1)(k + 2)
12 + 22 + 32 + : : : + k 2 + (k + 1)2 = + (k + 1)2
6
k(k + 1)(2k + 1) + 6(k + 1)2
=
6
(k + 1)[k(2k + 1) + 6(k + 1)]
=
6
2
(k + 1)(2k + 7k + 6)
=
6
(k + 1)(k + 2)(k + 3)
=
6
We have proven the two conditions required by the Principle of Mathematical Induction.
Therefore, the formula is true for all positive integers n.
Proof.
Basis step: Prove that the statement is true for n = 1.
71 − 1 = 6 = 6 · 1 ⇐⇒ 71 − 1 is divisible by 6:
Inductive Step: Assume that the statement is true for n = k ≥ 1, that is, 7k − 1 is divisible by
6, for all k ≥ 1: We need to show that the statement is true for all n = k + 1, that is, 7k+1 − 1
is divisible by 6.
Observe that
7k+1 − 1 = 7 · 7k − 1
= (6 · 7k + 7k ) − 1
= 6 · 7k + (7k − 1)
15
Since 6 · 7k is divisible by 6, and by the hypothesis, 7k − 1 is divisible by 6, we conclude that their
sum is divisible by 6. Consequently, 7k+1 − 1 is divisible by 6. We have proven the two conditions
required by the Principle of Mathematical Induction. Therefore, 7n − 1 is divisible by 6, for all
n ≥ 1.
Proof.
Basis step: Note that the claim of the statement is that it is true for n ≥ 0. This means that
the basis step is to prove that the statement is true for n = 0.
03 − 0 + 3 = 3 = 3 · 1 ⇐⇒ 03 − 0 + 3 is divisible by 3:
Inductive Step: Assume that the statement is true for n = k ≥ 0, that is, k 3 − k + 3 is divisible
by 3, for all k ≥ 0: We need to show that the statement is true for all n = k + 1, that is,
(k + 1)3 − (k + 1) + 3 is divisible by 3.
Note that since k 3 − k + 3 is divisible by 3, we can write k 3 − k + 3 = 3a, for some integer a:
Thus,
(k + 1)3 − (k + 1) + 3 = k 3 + 3k 2 + 2k + 3
= (k 3 − k + 3) + 3k 2 + 3k
= 3a + 3k 2 + 3k
= 3(a + k 2 + k)
16
Theorem 5: The Second Principle of Mathematical Induction
Let S be a set of positive integers with the following properties:
Therefore, S = N.
The Second Principle of Mathematical Induction is sometimes called strong induction to distinguish
it from the Principle of Mathematical Induction, which is also called weak induction.
Proof. Let T be a set of integers containing 1 and such that for every positive integer k, if it contains
1; 2; : : : ; k, it also contains k + 1. Let S be the set of all positive integers k such that all the positive
integers less than or equal to k are in T . Then 1 is in S, and by the hypotheses, we see that if k is
in S, then k + 1 is in S. Hence, by the Principle of Mathematical Induction, S must be the set of all
positive integers, so clearly T is also the set of all positive integers, because S ⊆ T .
Example 6. Using strong induction, prove that any integer n ≥ 2 has a prime factor.
Proof.
Basis step: Note that the claim of the statement is that it is true for n ≥ 2. This means that the
basis step is to prove that the statement is true for n = 2. Since 2 is divisible by the prime number 2,
the statement is true for n = 2:
Inductive step: We assume that the statement is true for n = 2; 3; : : : ; k, that is, n = 2; 3; : : : ; k has
a prime factor. We need to show that the statement is true for n = k + 1, that is, n = k + 1 has a
prime factor.
Now, the integer n = k + 1 is either prime or not. If n = k + 1 is prime, then we are done. If n = k + 1
is not prime, then it has some factor m satisfying 2 ≤ m < k + 1. Thus by the inductive hypothesis,
m = 2; 3; : : : ; k < k + 1 must have a prime factor, and so n = k + 1 must have that same prime factor.
Therefore by strong induction, any integer n ≥ 2 has a prime factor.
Historical Note
The first known use of mathematical induction appears in the work of the sixteenth-century math-
ematician Francesco Maurolico (1494-1575). In his book Arithmeticorum Libri Duo, Maurolico
presented various properties of the integers, together with proofs. He devised the method of
mathematical induction so that he could complete some of the proofs. The first use of mathe-
matical induction in his book was in the proof that the sum of the first n odd positive integers
equals n2 .
17
Exercise 1
Prove the following using mathematical induction.
1. 5n − 1 is divisible by 4, ∀n ∈ N0 .
2. 8n − 3n is divisible by 5, ∀n ∈ N0 .
3. x 2n − y 2n has a factor x + y , ∀n ∈ N.
18
Chapter 2
Divisibility Theory
OVERVIEW
This chapter will contain discussions on the Division Algorithm of the integers, the greatest
common divisor, the least common multiple, the Euclidean algorithm and solutions to linear
Diophantine equations.
Learning Objectives
At the end of this chapter, the students are expected to:
1. State and apply the division algorithm in establishing the Euclidean algorithm;
2. Determine the greatest common divisor and least common multiple of two integers; and
Definition 2
An integer b is said to be divisible by an integer a 6= 0, in symbols a|b (read as “a divides b”), if
there exists some integer c such that b = ac. We write a 6 | b (read as “a does not divide b”) to
indicate that b is not divisible by a:
Example 7.
2. 20 is not divisible by 3, in symbols 3 6 | 20, since there is no integer c such that 20 = 3c is true.
19
Remarks 1.
1. If a|b with a 6= 0, then we say that “a is a div isor of b", “a is a f actor of b", or “b is a
multiple of a".
2. If a|b, then −a|b. It is sufficient to obtain the positive divisors and then adjoin to them the
corresponding negative integers.
Theorem 6
For a; b; c ∈ Z; the following hold:
1. a | 0; 1 | a; a | a:
4. If a | b and b | c, then a | c:
Proof. We will only show the proof for parts (6) and (7).
(6) If a | b; then there exists an integer c such that b = ac. Also, b 6= 0 implies that c 6= 0: Upon taking
absolute values, we get |b| = |ac| = |a||c|: Since c 6= 0; it follows that |c| ≥ 1, hence |b| = |a||c| ≥ |a|:
(7) The relations a | b and a | c ensure that b = ar and c = as for suitable integers r and s: But then
bx + cy = ar x + asy = a(r x + sy )
20
Theorem 7: Division Algorithm
Given the integers a and b, with b > 0, there exists unique integers q and r satisfying
a = qb + r; 0 ≤ r < b:
The unique integers q and r are called, respectively, the quotient and remainder in the division
of a by b.
Example 8.
Proof.
1. Existence Proof.
Consider the set S = {a − xb | x ∈ Z; a − xb ≥ 0}. Clearly, S ⊆ N. We need to show that
S 6= ?. For this, it suffices to exhibit a value of x making a − xb ≥ 0. Since b ≥ 1, we have
|a| · b ≥ |a| and so
a − (−|a|) · b = a + |a| · b ≥ a + |a| ≥ 0:
Hence, for the choice x = −|a|; then (a − xb) ∈ S. Thus, S 6= ?. By WOP, S has a least
element; say r . By the definition of S; ∃q ∈ Z such that r = a − qb, 0 ≤ r .
We argue that r < b. If this were not the case, then r ≥ b and
a − (q + 1)b = (a − qb) − b = r − b ≥ 0:
This implies that a − (q + 1)b belong to S. But a − (q + 1)b = r − b < r , which contradicts
the choice of r as the least element of S. Hence, r < b.
2. Uniqueness Proof.
Suppose that a has two representations of the desired form; say
a = qb + r = q 0 b + r 0 ;
21
where 0 ≤ r < b; 0 ≤ r 0 < b. Then r 0 − r = b(q − q 0 ) and, owing to the fact that the absolute
value of a product is equal to the product of the absolute values,
|r 0 − r | = b|q − q 0 |:
Upon adding the two inequalities −b < −r ≤ 0 and 0 ≤ r 0 < b, we obtain −b < r 0 − r < b, or
equivalently, |r 0 − r | < b. Thus, b|q − q 0 | < b, which yields
0 ≤ |q − q 0 | < 1:
Corollary 1
If a and b are integers, with b 6= 0, then there exist unique integers q and r such that
a = bq + r; 0 ≤ r < |b|:
Proof. It suffices to consider the case in which b is negative. Then |b| > 0, and the Division Algorithm
produces unique integers q 0 and r for which
Noting that |b| = −b, we may take q = −q 0 , to obtain a = qb + r , with 0 ≤ r < |b|:
Example 10. We illustrate the case where b = −7 < 0 and a = 1; −2; 61; and − 59. We have
1 = 0(−7) + 1
−2 = 1(−7) + 5
61 = (−8)(−7) + 5
−59 = 9(−7) + 4
22
Example 11. Show that the square of an odd integer has the form 8q + 1.
Proof. The earlier declaration of the form of an odd and even integer can’t be used. Since the required
square will not form a factor 8. We will utilize a different way to exhibit odd and even integers.
Let n ∈ Z and take 4 as a divisor for any n. Then, by division algorithm, there exist unique integers q
and r such that n = 4q + r , where 0 ≤ r < 4. Thus, n is even if it is of the form 4k or 4k + 2, and, it
is odd if it is of the form 4k + 1 or 4k + 3.
If n = 4k + 1, then
(4k + 1)2 = 16k 2 + 8k + 1 = 8(2k 2 + k) + 1.
Take q = 2k 2 + 1. Hence, n2 = 8q + 1.
If n = 4k + 3, then
(4k + 3)2 = 16k 2 + 24k + 9 = (16k 2 + 24k + 8) + 1 = 8(2k 2 + 3k + 1) + 1.
Take q = 2k 2 + 3k + 1. Hence, n2 = 8q + 1.
1. d | a and d | b;
2. if c | a and c | b, then c ≤ d:
Example 12.
1. gcd(−12; 30) = 6
2. gcd(−5; 5) = 5
3. gcd(14; 25) = 1
4. gcd(−8; −36) = 4
23
The next theorem indicates that gcd(a; b) can be represented as a linear combination of a and b. By
a linear combination of a and b, we mean an expression of the form ax +by , where x and y are integers.
Theorem 8
Let a; b ∈ Z, not both zero. Then there exist integers x and y such that
d = gcd(a; b) = ax + by :
Example 13.
r = a − qd
= a − q(ax + by )
= a(1 − qx) + b(−qy )
Where r > 0, this representation would imply that r ∈ S. Which contradicts the assumptions that d
is the least integer in S since r < d: This forces r = 0, and so a = qd, or equivalently d | a. Similarly,
d | b. Hence, d is a common divisor of both a and b.
Now, if c is an arbitrary common divisor of a and b, then by Theorem 6.7, c | (ax + by ), or equivalently,
c | d: By Theorem 6.6, c = |c| ≤ |d| = d. Therefore, d = gcd(a; b):
24
Corollary 2
If a; b ∈ Z, not both zero, then the set
T = {ax + by | x; y ∈ Z}
Definition 4
Two integers a and b, not both zero, are said to be relatively prime whenever gcd(a; b) = 1:
Example 14.
3. gcd(1; 16) = gcd (−1; 16) = 1. In general, any nonzero integer is relatively prime with ±1.
Theorem 9
Let a and b be integers, not both zero. Then a and b are relatively prime if and only if there
exist integers x and y such that 1 = ax + by :
Proof. (=⇒) If gcd(a; b) = 1, then by Theorem 7, there exists integers x and y such that 1 = ax + by :
(⇐=) Suppose that 1 = ax + by for some integers x and y , and d = gcd(a; b). Since d | a and d | b;
then by Theorem 6.7, d | (ax + by ) or d | 1: Since d is a positive integer and by Theorem 6.2, this
forces d = 1.
Corollary 3
!
a b
If gcd(a; b) = d, then gcd ; = 1:
d d
−12 30
„ «
Example 15. If gcd(−12; 30) = 6, then gcd ; = gcd(−2; 5) = 1.
6 6
25
Corollary 4
Example 16. Given that 2 | 20; 5 | 20, and gcd(2; 5) = 1. Then 2 · 5 | 20 ⇐⇒ 10 | 20:
Proof. If a | c and b | c, then there exists integers r and s such that c = ar = bs: Now, gcd(a; b) = 1
implies that 1 = ax + by for some integers x and y . Thus,
c =c ·1
= c(ax + by )
= acx + bcy
= a(bs)x + b(ar )y
= ab(sx + r y )
Proof. By Theorem 7, there exists integers x and y such that gcd(a; b) = 1 = ax + by : Then
c =c ·1
= c(ax + by )
= acx + bcy
Let a and b be integers whose gcd is desired. Since gcd(|a|; |b|) = gcd(a; b), without loss of generality,
we can assume that a ≥ b > 0: By Division Algorithm, we have
a = q1 b + r1 ; 0 ≤ r1 < b:
26
If r1 = 0, then b | a and gcd(a; b) = b: Otherwise, if r1 6= 0; divide b by r1 to obtain q2 and r2 satisfying
b = q2 r1 + r2 ; 0 ≤ r2 < r1 :
If r2 = 0; then we stop and gcd(a; b) = r1 . Otherwise, proceed as before to obtain q3 and r3 satisfying
r1 = q3 r2 + r3 ; 0 ≤ r3 < r2 :
This division process continues until some zero remainder appears, say at the (n + 1)th step, where
rn−1 is divided by rn (a zero remainder occurs sooner or later since the decreasing sequence b > r1 >
r2 > : : : ≥ 0 cannot contain more than b integers). The result is the following system of equations:
a = q1 b + r1 ; 0 < r1 < b
b = q2 r1 + r2 ; 0 < r2 < r1
r1 = q3 r2 + r3 ; 0 < r3 < r2
.. ..
. .
rn−2 = qn rn−1 + rn ; 0 < rn < rn−1
rn−1 = qn+1 rn + 0
We argue that rn ; the last nonzero remainder which appears in this manner, is equal to gcd(a; b). Our
proof is based on the lemma below.
Lemma 1
If a = qb + r; then gcd(a; b) = gcd(b; r ):
27
Example 17. Determine the gcd(12378; 3054) and find x; y ∈ Z such that d = 12378x + 3054y :
) gcd(12378; 3054) = 6:
6 = 24 − 18
= 24 − (138 − 5 · 24)
= 6 · 24 − 138
= 6(162 − 138) − 138
= 6 · 162 − 7(3054 − 18 · 162)
= 132 · 162 − 7 · 3054
= 132(12378 − 4 · 3054) − 7 · 3054
= 132 · 12378 + (−535)3054:
Theorem 11
If k > 0, then gcd(ka; kb) = kgcd(a; b):
28
Definition 5: Least Common Multiple
The least common multiple of two nonzero integers a and b, denoted by lcm(a; b); is the positive
integer m satisfying
1. a | m and b | m
Example 18.
The next theorem provides the relationship between the gcd and lcm of any two positive integers.
Theorem 12
For positive integers a and b, we have gcd(a; b) · lcm(a; b) = ab:
ab
Proof. Let gcd(a; b) = d. Then there exists integers s and t such that a = dt and b = ds. If m = ;
d
then m = as = bt which implies that a | m and b | m:
Now, let c | a and c | b, that is, c = au = bv : Since gcd(a; b) = d, by Theorem 7, there exists integers
x and y such that d = ax + by : Then
c cd c(ax + by ) c c
= = = x + y = v x + uy ∈ Z:
m ab ab b a
This implies that m | c, and by Theorem 6.6, m ≤ c: Thus, lcm(a; b) = m; that is,
ab ab
lcm(a; b) = = :
d gcd(a; b)
12378 · 3054
lcm(12378; 3054) = = 6300402:
6
29
Corollary 5
Definition 6
An equation of the form ax + by = c, where a; b; c ∈ Z, is called a Linear Diophantine Equation
if its solutions are confined in Z.
Theorem 13
The Linear Diophantine Equation ax + by = c has a solution if and only if d | c; where
gcd(a; b) = d. If (x0 ; y0 ) is any particular solution of this equation, then all other solutions are
given by
b a
x = x0 + t and y = y0 − t; for varying integers t:
d d
Proof. Suppose that a solution (x0 ; y0 ) of the given equation is known. If (x 0 ; y 0 ) is any other solution,
then ax0 + by0 = c = ax 0 + by 0 ⇐⇒ a(x 0 − x0 ) = b(y0 − y 0 ):
a b
By Corollary 3, there exist relatively prime integers r and s such that r = and s = , or equivalently,
d d
a = dr and b = ds. Substituting these values we have
dr (x 0 − x0 ) = ds(y0 − y 0 ) ⇐⇒ r (x 0 − x0 ) = s(y0 − y 0 )
Then r | s(y0 − y 0 ); with gcd(r; s) = 1. By Euclid’s Lemma, it must be the case that
Then we have !
0 b
x = x0 + st = x0 + t
d
a
„ «
0
y = y0 − r t = y0 − t:
d
The reader can verify that these values satisfy the Diophantine Equation regardless of the choice of the
30
integer t. Hence, " ! #
b a
» „ « –
0 0
ax + by = a x0 + t + b y0 − t
d d
!
ab ab
= (ax0 + by0 ) + − t
d d
=c +0·t
=c
Thus, there are an infinite number of solutions of the given equation, one for each value of t.
Example 21. Find all integer solutions of 172x + 20y = 1000: Also, determine all positive solutions
of this equation, if it exists.
172 = 8 · 20 + 12
20 = 1 · 128
12 = 1 · 8 + 4
8=2·4+0
) gcd(172; 20) = 4:
Since 4 | 1000; a solution to this equation exists. By Theorem 7, we can write gcd(172; 20) = 4 as a
linear combination of 172 and 20. Thus,
4 = 12 − 8
4 = 12 − (20 − 12)
4 = 2 · 12 − 20
4 = 2(172 − 8 · 20) − 20
4 = 172(2) + 20(−17)
31
Hence, a particular solution will be x0 = 500 and y0 = −4250. All other solutions will be of the form
20
„ «
x = 500 + t ⇐⇒ x = 500 + 5t;
4
172
„ «
y = −4250 − ⇐⇒ y = −4250 − 43t; for some integert:
4
Now, to determine the positive solutions to the equation, suppose that x = 500 + 5t > 0 and
36
y = −43t − 4250 > 0. The reader can verify that −100 < t < −98 43 (Why?). This forces t = −99.
Therefore, the only positive solution is when x = 5 and y = 7.
Corollary 6
If gcd(a; b) = 1 and (x0 ; y0 ) is a particular solution of the Linear Diophantine Equation ax +by =
c; then all solutions are given by x = x0 + bt and y = y0 − at, for some integer t:
Example 22. Consider 5x + 22y = 18 which has a particular solution x0 = 8 and y0 = −1 and
gcd(5; 22) = 1. Therefore, by Corollary 6, x = 8 + 22t and y = −1 − 5t, for some integer t.
Example 23. A customer bought a dozen pieces of fruit: apples and oranges for P132. If an apple
costs P3 more than an orange, and more apples than oranges were purchased, how many pieces of each
kind were bought?
Solution: Let x := number of apples purchased, y := number of orange purchased, and z := cost of
an orange. Then
(z + 3)x + zy = 132
3x + (x + y )z = 32; but x + y = 12
3x + 12z = 132
(∗) x + 4z = 44 ←− Linear Diophantine Equation in x and z
Since gcd(1; 4) = 1 | 44, a solution to this equation exists. By Theorem 7, we can write gcd(1; 4) = 1
as a linear combination of 1 and 4. Thus,
1 = 1(−3) + 4 · 1
⇐⇒ 44 = 1(−132) + 4(44)
It follow that x0 = −132 and z0 = 44: By Corollary 6, all other solutions are of (∗) are x = −132 + 4t
32
and z = 44 − t; for some integer t. But 6 < x ≤ 12 so that 6 < −132 + 4t ≤ 12. Now,
1
−132 + 4t ≤ 12 =⇒ t ≤ 36 and 6 < −132 + 4t =⇒ t > 34
2
Thus, t = 35 and t = 36. If t = 35, we have 8 apples at P12 each and 4 oranges at P9 each.
If t = 36, we have 12 apples at P11 each.
Historical Note
The Linear Diophantine Equation ax + by = c was named after the Greek mathematician
Diophantus. He wrote Arithmetica, which is the earliest known book on Algebra; it contains the
first systematic use of mathematical notation to represent unknowns in equations and powers
of these unknowns. Almost nothing is known about Diophantus, other than that he lived in
Alexandria around 250 A.D. The only source of details about his life comes from an epigram
found in a collection called the Greek Anthology: “Diophantus passed one sixth of his life in
childhood, one twelfth in youth, and one seventh as a bachelor. Five years after his marriage was
born a son who died four years before his father, at half his father’s age.” From this the reader
can infer that Diophantus lived to the age of 84.
Exercise 2
I. Determine the greatest common divisor and least common multiple of the following pairs of
integers.
II. Do as indicated.
33
Chapter 3
OVERVIEW
The chapter will tackle basic theorem leading to and consequences of the Fundamental Theorem,
and will present the Sieve of Eratosthenes to determine prime numbers.
Learning Objectives
At the end of this chapter, the students are expected to:
2. State and exhibit the role of the Fundamental Theorem of Arithmetic; and
Definition 7
An integer p > 1 is called a prime number, or simply prime, if its only positive divisors are 1
and p. An integer greater than 1 that is not a prime is called composite.
Example 24.
34
Theorem 14
If p is a prime and p | ab; then either p | a or p | b:
Proof. If p | a, then we are done. Assume that p - a given that p | ab. Since the only positive divisors
of p are 1 and p itself, this implies that gcd(p; a) = 1. (Note: gcd(p; a) = p or gcd(p; a) = 1 whenever
p | a or p - a:) By Euclid’s Lemma, we get p | b.
Corollary 7
Corollary 8
Corollary 9
Any positive integer n > 1 can be written uniquely in a canonical form n = p1k1 p2k2 · · · piki ,
where each ki ∈ N and each pi is a prime with p1 < p2 < · · · < pi :
Example 25. Write n = 4725 and n = 17460 in their respective canonical form.
1. 4725 = 33 · 52 · 7
2. 17460 = 23 · 32 · 5 · 72
Theorem 16
√
The number p is irrational, where p is prime. (Pythagoras)
√ √ a
Proof. Suppose p is a rational number, say p= , where gcd(a; b) = 1. Squaring both sides of
b
√ a a2
p = , we get p = 2 ⇐⇒ a2 = pb 2 , so that b | a2 : If b > 1; then by Fundamental Theorem of
b b
Arithmetic, there exists a prime q such that q | b. It follows that q | a2 , and by Theorem 13, q | a:
35
Hence, gcd(a; b) ≥ q > 1. Which is a contradiction to the assumption that gcd(a; b) = 1, unless
b = 1. But if b = 1, then a2 = p, which is impossible.
Theorem 17
There are infinitely many primes. (Euclid)
Proof. Let p1 = 2; p2 = 3; p3 = 5; p4 = 7; : : : be the primes in ascending order, and suppose that there
is a last prime, say pn . Now consider the positive integer m = p1 p2 p3 · · · pn + 1. Since m > 1, by the
Fundamental Theorem of Arithmetic, m is divisible by some prime pk . But p1 ; p2 ; p3 ; : : : ; pn are the
only prime numbers, so that pk must be equal to one of p1 ; p2 ; p3 ; : : : ; pn . Then pk | p1 p2 p3 · · · pn
and pk | m. Thus, pk | (m − p1 p2 p3 · · · pn ), or equivalently, pk | 1 ⇐⇒ pk = ±1. Which is a
contradiction since pk is prime and pk > 1:
Theorem 18
√
If n is a composite integer, then n has a prime factor not exceeding n:
Proof. Since n is composite, we can write n = ab, where a and b are integers with 1 < a ≤ b < n.
√ √ √
Then it must be a ≤ n. Since if otherwise b ≥ a > n and ab > n · n = n. Now, by Corollary
7, a must have a prime divisor, which by Theorem 6.4 is also a prime divisor of n, and which is clearly
√
less than or equal to n.
Example 26.
36
2. Determine if 509 is prime or composite.
√
Solution: 22 < 509 < 23. Thus we need only to try out the primes 2, 3, 5, 7, 11, 13, 17, and
19 as possible divisors. Dividing 509 by each of these primes will conclude that 509 is prime.
Definition 8
The function ı(x), where x is a positive real number, denotes the number of primes not exceeding
x.
Example 27. From the illustration of Sieve of Eratosthenes in Example 23.1, we see that ı(10) = 4
and ı(100) = 25:
ı(x)
lim = 1:
x→∞ x= log x
f (x)
Note that in Calculus, if x→∞
lim = 1; we say that f (x) is asymptotic to g (x). Hence, Theorem 18
g (x)
x
implies that ı(x) is asymptotic to .
log x
37
Historical Note
Eratosthenes (c. 276-194 B.C.) was born in Cyrene, which was a Greek colony west of Egypt.
It is known that he spent some time studying at Plato’s school in Athens. King Ptolemy II invited
Eratosthenes to Alexandria to tutor his son. Later, Eratosthenes became the chief librarian of the
famous library at Alexandria, which was a central repository of ancient works of literature, art,
and science. He was an extremely versatile scholar, having written on mathematics, geography,
astronomy, history, philosophy, and literature. Besides his work in mathematics, Eratosthenes
was most noted for his chronology of ancient history and for his geographical measurements,
including his famous measurement of the size of the earth.
Exercise 3
Do as indicated.
3. Apply the Sieve Process to determine all prime numbers between 200 and 400.
√
4. Prove that 3 is irrational.
38
Chapter 4
Theory of Congruences
OVERVIEW
The chapter will entail the basic properties of the modular congruence relation and some of its
application. Also, basic theorems on the classical divisibility tests will be discussed.
Learning Objectives
At the end of this chapter, the students are expected to:
1. State and apply the basic theorems of the modular congruence relation;
Definition 9
Two integers a and b are said to be congruent modulo n, where n ∈ Z+ ; if n | a − b. In this
case, we write a ≡ b (mod n) (read as “a is congruent to b modulo n"). The number n is called
the modulus. The statement “a ≡ b (mod n)" is called a congruence.
39
Theorem 20
1. a ≡ b (mod n) if and only if a and b leave the same remainder when divided by n.
2. The integer r is the remainder when a is divided by n if and only if a ≡ r (mod n), where
r ∈ {0; 1; 2; 3; : : : ; (n − 1)}.
Remark:
2. Using least residues, the set of integers Z can be partitioned into n nonempty pairwise disjoint
classes, called congruence classes modulo n.
Example 29.
1. 117 leaves 7 as remainder when divided by 10. Therefore, 117 ≡ 7 ( mod 10)
Theorem 21
Let a; b; c ∈ Z.
1. a ≡ a (mod n) (Reflexive)
Note that every equivalence relation defined on a set gives rise to a partition on the set. For this case,
the partition is determined by the remainder r in the statement ”a ≡ r ( mod n) ”. The following are
40
the equivalence classes formed by the ≡-relation. These are called the residue classes.
[0]n = { nk | k ∈ Z }
[1]n = { nk + 1 | k ∈ Z }
[2]n = { nk + 2 | k ∈ Z }
..
.
[n − 1]n = { nk + (n − 1) | k ∈ Z } :
Example 30. Under congruence modulo 4, the residual classes on Z are as follows:
Theorem 22
Let a ≡ b (mod n) and c ≡ d (mod n). Then
1. a + c ≡ b + d (mod n)
2. ac ≡ bd (mod n)
Example 31.
41
Theorem 23
If ai ≡ bi ( mod n) for i = 1; 2; 3; : : : ; m, then
n
X n
X n
Y n
Y
1. ai ≡ bi ( mod n) 2. ai ≡ bi ( mod n)
i=1 i=1 i=1 i=1
Solution:
Initially, we have the following:
37 ≡ 2 ( mod 7)
45 ≡ 3 ( mod 7)
6 ≡ 6 ( mod 7)
15 ≡ 1 ( mod 7) :
Thus,
37 · 45 + 6 · 158 ≡ 2 · 3 + 6 · 18 ( mod 7)
37 · 45 + 6 · 158 ≡ 6 + 6 ( mod 7)
37 · 45 + 6 · 158 ≡ 12 ( mod 7)
37 · 45 + 6 · 158 ≡ 5 ( mod 7) :
Solution:
The remainder is 4.
42
Example 34. Find the unit’s digit 8253 .
Solution:
To determine the unit’s digit, one may perform congruence modulo 10.
Now,
8 ≡ 8 ( mod 10)
82 ≡ 64 ( mod 10) implies82 ≡ 4 ( mod 10)
83 ≡ 512 ( mod 10) implies83 ≡ 2 ( mod 10)
84 ≡ 4096 ( mod 10) implies84 ≡ 6 ( mod 10)
85 ≡ 32768 ( mod 10) implies85 ≡ 8 ( mod 10) :
Hence, the remainders occurs in the manner congruence modulo 4 work on Z. Thus, 253 ≡ 1 ( mod 4) .
Therefore, 8 is the unit’s digit.
Example 35.
3. 1900 was not a leap year because 1900 ≡ 0 (mod 100) but 1900 6≡ 0 (mod 400)
4. 2000 was a leap year because 2000 ≡ 0 (mod 100) and 2000 ≡ 0 (mod 400)
5. 2100 was not a leap year because 2100 ≡ 0 (mod 100) but 2100 6≡ 0 (mod 400)
43
The formula that gives the day of the week for any date on the Gregorian calendar, known as Zeller’s
congruence, is given by
$ % $ % $ % !
13m − 1 y c
x≡ + + + d + y − 2c (mod 7)
5 4 4
where:
• x is the day of the week (x = 0 means the day is Sunday, x = 1 means the day is Monday, ...,
x = 6 means the day is Saturday);
• m is the month (m = 1 for March, m = 2 for April, m = 3 for May, ..., m = 10 for December,
m = 11 for January, and m = 12 for February);
• y is the last two digits of the year if the month is March through December; last two digits of
the year minus 1 if the month is January or February;
d = 4; m = 9; y = 87 and c = 19.
Thus,
13m − 1 y c
„— — — «
x ≡ + + + d + y − 2c ( mod 7)
$
5 4
% — —
4 !
13(9) − 1 87 19
x ≡ + + + (4) + (87) − 2(19) ( mod 7)
5 4 4
116 87 19
„— — — «
x ≡ + + + 4 + 87 − 38 ( mod 7)
5 4 4
x ≡ ( 23 + 21 + 4 + 4 + 87 − 38 ) ( mod 7)
x ≡ ( 101 ) ( mod 7)
x ≡ ( 3 ) ( mod 7) :
Since x ≡ ( 3 ) ( mod 7) , then November 4, 1987 was a Wednesday.
44
4.2.3 Cryptology
Cryptology is the study of making and breaking secret codes. A plaintext is a message before it is
coded. A ciphertext is the message after it has been written in codes. The process of changing from
plaintext to ciphertext is called encryption. To decrypt a message means to take the ciphertext and
write it in plaintext. A cyclical coding scheme is a process of encrypting a plaintext to a ciphertext
by shifting each letter in the alphabet to some number of positions to obtain a substitute alphabet.
The following correspondence is the conventional assignment of the letters of the English alphabet with
the least residual classes of Z over congruence modulo 26.
A 7→ 1 G 7→ 7 M 7→ 13 S 7→ 19 Y 7→ 25
B 7→ 2 H 7→ 8 N 7→ 14 T 7→ 20 Z 7→ 0
C 7→ 3 I 7→ 9 O 7→ 15 U 7→ 21
D 7→ 4 J 7→ 10 P 7→ 16 V 7→ 22
E 7→ 5 K 7→ 11 Q 7→ 17 W 7→ 23
F 7→ 6 L 7→ 12 R 7→ 18 X 7→ 24
Example 37. Use the cyclical alphabetic encrypting code that shifts each letter 11 positions to
Solution:
Let p and c be the respective corresponding values of a letter in the plaintext and the ciphertext.
1. To encode, shift the letters 11 positions ’forward.’ Thus, we can use c ≡ (p + 11) ( mod 26) .
For the plaintext CATHERINE THE GREAT, start with the letter C by using p = 3. Hence,
c = 14 implying that letter N will take its place.
For the last letter T, use p = 20. Hence, c ≡ 31 ( mod 26) implies c ≡ 5 ( mod 26) . Thus, E
will take its place.
Verify that the ciphertext is NLESPCTYP ESP RCPLE.
2. To decode, use p ≡ (c − 11) ( mod 26) to represent the ’backward’ shift. Be able to decode
TGLY ESP EPCCTMWP as IVAN THE TERRIBLE.
In addition, subtraction can be replaced by addition to represent a ’backward’ shift. Consider a
positive integer so that when added to 11, it becomes 0 under congruence modulo 26. A little
trial and error shows that it will be 15. Thus, one can use p ≡ (c + 15) ( mod 26) to decode.
45
Example 38. Use the congruence c ≡ (5p + 2) (mod 26) to encode the plaintext LASER PRINTER
and to decode the ciphertext QGN NGQAN.
Solution:
Thus, it will be letter J. Continuing this, the ciphertext should become JGSAN DNUTXAN.
To decode, we will use a little of algebra for the linear equation c = 5p + 2. We have to counter
addition by 2 and multiplication by 5. Note that under addition modulo 26, the sum of 2 and 24 is 0.
Likewise, under multiplication modulo 26, the product of 5 and 21 is 1. Hence, we have
5p + 2 ≡ c ( mod 26)
(5p + 2) + 24 ≡ (c + 24) ( mod 26)
5p + (2 + 24) ≡ (c + 24) ( mod 26)
5p + 0 ≡ (c + 24) ( mod 26)
5p ≡ (c + 24) ( mod 26)
21 · 5p ≡ 21 · (c + 24) ( mod 26)
p ≡ 21 · (c + 24) ( mod 26) :
Use p ≡ 21(c + 24) ( mod 26) To decode QGN NGQAN as CAR RACER.
46
Theorem 24
n
ci x i be a polynomial function of x with integral coefficients ci ; ∀i.
X
Let f (x) =
i=0
If a ≡ b ( mod m) , then f (a) ≡ f (b) ( mod m) .
Corollary 10
Theorem 25
m
ai 10i . Then
X
Let N =
i=0
m
ai 10i .
X
Proof. Let N =
i=0
1. We have
3. We have
47
Note that 10 ≡ 1 ( mod 3) . Thus,
“ ”
N ≡ an 10n + an−1 10n−1 + an−2 10n−2 + : : : + a2 102 + a1 10 + a0 ( mod 3)
N ≡ (an (1) + an−1 (1) + an−2 (1) + : : : + a2 (1) + a1 (1) + a0 ) ( mod 3)
N ≡ (a0 + a1 + a2 + : : : + an ) ( mod 3) :
Thus, 3|(a0 + a1 + a2 + : : : + an ).
5. We have
Exercise 4
1. Use the congruence c ≡ (3p + 5) (mod 26) to encode DANCE ALL NIGHT and decode ACXUT
CXRT.
2. Use the congruence c ≡ (7p + 11) (mod 26) to encode MATHEMATICS and decode
NURUVNUVFN.
48
4. Find the remainder when 1! + 2! + 3! + 4! + : : : + 99! + 100! is divided by 12.
a. 1653 is divided by 7.
b. 4220 is divided by 65.
a. 3103
b. 778
c. 2512
d. 8456
e. 91019
m
ai 10i . Prove that if 8|N, then 8|(4a2 + 2a1 + a0 ).
X
10. Let N =
i=0
49
Chapter 5
Number-Theoretic Functions
OVERVIEW
This chapter will contain discussions on some number theoretic functions: ff; fi and Euler-ffi
functions.
Learning Objectives
At the end of this chapter, the students are expected to:
Definition 10
Given a positive integer n, let fi (n) denote the number of positive divisors of n and ff(n) denote
the sum of these divisors.
Example 39.
50
Notation:
X
1. f (d) := “Sum of the values f (d) as d runs over all the positive divisors of n."
d|n
X
Example: f (d) = f (1) + f (2) + f (4) + f (5) + f (20)
d|20
X X
2. fi (n) = 1 and ff(n) = d
d|n d|n
Theorem 26
If n = p1k1 p2k2 · · · prkr is the prime factorization of n > 1, then the positive divisors of n are precisely
those integers d of the form
d = p1a1 p2a2 · · · prar ;
where 0 ≤ ai ≤ ki (i = 1; 2; : : : ; r ):
Example 40. Let n = 12 = 22 · 3. By Theorem 26, the following divisors of 12 are presented as
1 = 20 · 30
2 = 21 · 30
3 = 20 · 31
4 = 22 · 30
6 = 21 · 31
12 = 22 · 31 :
Theorem 27
If n = p1k1 p2k2 · · · prkr is the prime factorization of n > 1, then
p1k1 +1 − 1 p2k2 +1 − 1 p kr +1 − 1
! ! !
2. ff(n) = ··· r
p1 − 1 p1 − 1 pr − 1
51
Example 41. Let n = 12 = 22 · 3. By Theorem 27, we have
and
22+1 − 1 31+1 − 1
! !
ff(12) = ·
2−1 3−1
7 8
„ « „ «
ff(12) = ·
1 2
ff(12) = 28:
Definition 11
A number-theoretic function f is said to be multiplicative if and only if
whenever gcd(m; n) = 1:
Theorem 28
The functions fi and ff are both multiplicative functions.
fi (4) · fi (3) = (2 + 1) · (1 + 1)
fi (4) · fi (3) = 3 · 2
fi (4) · fi (3) = 6
fi (4) · fi (3) = fi (12);
and
22+1 − 1 31+1 − 1
! !
ff(4) · ff(3) = ·
2−1 3−1
7 8
„ « „ «
ff(4) · ff(3) = ·
1 2
ff(4) · ff(3) = 28
ff(4) · ff(3) = ff(12):
52
Lemma 2
If gcd(m; n) = 1; then the set of positive divisors of mn consists of all products d1 d2 ; where
d1 |n; d2 |m; and gcd(d1 ; d2 ) = 1; furthermore, these products are all distinct.
Theorem 29
If f is a multiplicative function and F is defined by
X
F (n) = f (d);
d|n
Definition 12
For n ≥ 1; let ffi(n) denote the number of positive integers not exceeding n that are relatively
prime to n:
Example 44.
2. For 30, the integers 1, 7, 11, 13, 17, 19, 23, 29 are all relatively prime with 30. Thus, ffi(30) = 8.
53
Theorem 30
If p is prime and k > 0, then
!
k k k−1 k 1
ffi(p ) = p − p =p 1−
p
Example 45. We have ffi(27) = ffi(33 ) = 33 − 32 = 18. Thus, there are 18 integers that are less than
27 and relatively prime with it, namely: 1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25 and
26.
Lemma 3
Given integers a; b; and c: gcd(a; bc) = 1 if and only if gcd(a; b) = 1 and gcd(a; c) = 1:
Theorem 31
The function ffi is a multiplicative function.
Theorem 32
If n = p1k1 p2k2 · · · prkr is the prime factorization of n > 1, then
Solution:
Since 360 = 23 · 32 · 5, then
1 1 1
„ «„ «„ «
ffi(360) = 360 1 − 1− 1−
2 3 5
1 2 4
„ «„ «„ «
ffi(360) = 360
2 3 5
ffi(360) = 96:
54
Theorem 33
For n > 2; ffi(n) is an even integer.
This is due to the fact that (piki − piki −1 ) is always even, for any i.
Lemma 4
Let n > 1 and gcd(a; n) = 1. If a1 ; a2 ; : : : ; affi(n) are the positive integers less than n and relatively
prime to n, then
aa1 ; aa2 ; : : : ; aaffi(n)
55
Theorem 35: Gauss’ Theorem
For each positive integer n ≥ 1,
X
n= ffi(d);
d|n
Exercise 5
1. 90 4. 840
2. 150 5. 1200
3. 450
II. Do as indicated.
56
Chapter 6
OVERVIEW
This chapter contains discussions on modular order, primitive roots for prime and composites and
theory of indices.
Learning Objectives
At the end of this chapter, the students are expected to:
Definition 13
Let n > 1 and gcd(a; n) = 1. The order of a modulo n is the smallest positive integer k such
that ak ≡ 1 (mod n)
Example 49. Consider the integers 1, 3, 5 and 7 that are all relatively prime with 8.
a ak ≡ 1 ( mod 8) order of a
1
1 (1) ≡ 1 ( mod 8) 1
3 (3)2 ≡ 1 ( mod 8) 2
2
5 (5) ≡ 1 ( mod 8) 2
7 (7)2 ≡ 1 ( mod 8) 2
57
Theorem 36
Let the integer a have order k modulo n. Then ah ≡ 1 (mod n) if and only if k | h; in particular,
k | ffi(n):
1
„ «
Example 50. In reference to the previous example, ffi(8) = 8 1 − = 4. Observe that the orders
2
of 1, 3, 5 and 7 are divisors of 4.
Theorem 37
If a has order k modulo n, then ai ≡ aj (mod n) if and only if i ≡ j (mod k).
Corollary 12
Example 52. Note that 5 has order 2 modulo 8. With 52 = 25 and 53 = 125, then 25 6≡ 125 mod 8.
Theorem 38
k
If a has order k modulo n and h > 0, then ah has order modulo n:
gcd(h; k)
Corollary 13
Let a have order k modulo n. Then ah also has order k if and only if gcd(h; k) = 1:
58
6.2 Primitive Roots for Primes
Definition 14
If gcd(a; n) = 1 and a is of order ffi(n) modulo n, then a is a primitive root of n
Example 54. Consider the integers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12 under congruence modulo
13.
a order of a a order of a a order of a
1 1 5 4 9 3
2 12 6 12 10 6
3 3 7 12 11 12
4 6 8 4 12 2
Theorem 39
Let gcd(a; n) = 1 and let a1 ; a2 ; : : : ; affi(n) be the positive integers less than n and relatively prime
to n. If a is a primitive root of n, then
a; a2 ; : : : ; affi(n)
Example 55. Consider 2 as a primitive root of 13. The powers of 2 are expressed as follows:
59
Corollary 14
f (x) ≡ 0 (mod p)
Corollary 15
x d − 1 ≡ 0 (mod p)
Example 58. Given the prime number 7. Take 2 and 3 as the divisors d of 6 = 7 − 1.
The congruence x 2 − 1 ≡ 0 ( mod 7) has exactly two solutions, namely 1 and 6.
The congruence x 3 − 1 ≡ 0 ( mod 7) has exactly three solutions, namely 1, 2 and 4.
60
Theorem 41
If p is a prime number and d | p − 1, then there are exactly ffi(d) incongruent integers having
order d modulo p:
Example 59. Given the prime number 7. Take 2 and 3 as the divisors d of 6 = 7 − 1.
For d = 2, we have ffi(2) = 1. There is a unique integer with order 2 modulo 7, namely 6.
For d = 3, we have ffi(3) = 2. There is are two incongruent integers with order 3 modulo 7, namely 2
and 4.
Corollary 16
Theorem 42
For k ≥ 3; the integer 2k has no primitive roots.
Example 61. Consider 23 = 8. The only integers that are relatively prime with 8 and less than 8 are
1, 3, 5 and 7. Also,
1 ≡ 1 ( mod 8)
32 ≡ 1 ( mod 8)
52 ≡ 1 ( mod 8)
72 ≡ 1 ( mod 8) :
1
„ «
But, ffi(8) = 8 1 − = 4. Since, none of the four integers have an order 4, then 8 has no primitive
2
roots.
61
Theorem 43
If gcd(m; n) = 1, where m > 2 and n > 2, then the integer mn has no primitive roots.
Corollary 17
The integer n fails to have a primitive root if either
Example 62.
1. Consider the integer 15 = 3 · 5. The only integers that are relatively prime with 15 and less than
15 are 1, 2, 4, 7, 8, 11, 13 and 14. Also,
1 ≡ 1 ( mod 15)
24 ≡ 1 ( mod 15)
42 ≡ 1 ( mod 15)
74 ≡ 1 ( mod 15)
84 ≡ 1 ( mod 15)
112 ≡ 1 ( mod 15)
134 ≡ 1 ( mod 15)
142 ≡ 1 ( mod 15) :
1 1
„ «„ «
Since, ffi(15) = 15 1 − 1− = 8. None of these integers have order 8. Therefore, 15
3 5
has no primitive roots.
2. Consider the integer 12 = 22 · 3. The only integers that are relatively prime with 12 and less than
12 are 1, 5, 7 and 11. Also,
1 ≡ 1 ( mod 12)
52 ≡ 1 ( mod 12)
72 ≡ 1 ( mod 12)
112 ≡ 1 ( mod 12) :
1 1
„ «„ «
Since, ffi(12) = 12 1 − 1− = 4. one of these integers have order 4. Therefore, 12 has
2 3
no primitive roots.
62
Lemma 5
If p is an odd prime, then there exists a primitive root r of p such that r p−1 6≡ 1 (mod p 2 ):
Corollary 18
If p is an odd prime, then p 2 has a primitive root; in fact, for a primitive root r of p, either r or
r + p is a primitive root of p 2 :
Example 63. Consider p = 7 and p 2 = 49. It is exhibited earlier that 3 and 5 are primitive roots of 7.
It can be validated that 37−1 6≡ 1 mod 49 and 57−1 6≡ 1 mod 49, as guided by the previous lemma.
Moreover, it can be verified that 3, 5, 3 + 7 = 10 and 5 + 7 = 12 are primitive roots of 49 as guided
by the previous corollary.
Lemma 6
Let p be an odd prime and r be a primitive root of p such that r p−1 6≡ 1 (mod p 2 ): Then for
each positive integer k ≥ 2;
k−2
r p (p−1) 6≡ 1 (mod p k ):
Theorem 44
If p is an odd prime and k ≥ 1, then there exists a primitive root for p k :
Corollary 19
Example 64.
1
„ «
1. Consider 27 = 33 . Since, ffi(27) = 27 1 − = 18, it can be verified that 21 8 ≡ 1 ( mod 27) .
3
Thus, 2 is a primitive root of 27.
1 1
„ «„ «
2. Consider 18 = 2 · 32 . Since, ffi(18) = 18 1 − 1− = 6, it can be verified that 56 ≡
2 3
1 ( mod 18) . Thus, 5 is a primitive root of 18.
63
Theorem 45
An integer n > 1 has a primitive root if and only if
n = 2; 4; p k ; or 2p k
Example 65.
2. 30 has no primitive root since it is neither a power of an odd prime nor a product of 2 and a
power of an odd prime.
Definition 15
Let r be a primitive root of n. If gcd(a; n) = 1, then the smallest positive integer k such that
a ≡ r k (mod n) is called the index of a relative to r .
Example 66. Recall that 13 has the following primitive roots: 2, 6, 7 and 11. Consider the integer 5
being relatively prime with 13. Note that 5 ≡ 29 ( mod 13) , 5 ≡ 69 ( mod 13) , 5 ≡ 73 ( mod 13) and
5 ≡ 113 ( mod 13) . Thus, the index of 5 is 9 relative to 2 and 6. Also, the index of 5 is 3 relative to 7
and 11.
Theorem 46
If n has a primitive root r and ind a denotes the index of a relative to r , then
Example 67. Recall that 2 is a primitive root of 13. Consider that 5 and 9 are relatively prime with
13. Verify that 5 ≡ 29 ( mod 13) , 9 ≡ 28 ( mod 13) and ffi(13) = 12. Hence, ind 5 = 9 and ind 9 = 8
relative to 2.
64
We have the following
Theorem 47
Let n be an integer possessing a primitive root and let gcd(a; n) = 1. Then the congruence
x k ≡ a (mod n) has a solution if and only if
where d =gcd(k; ffi(n)); if it has a solution, there are exactly d solutions modulo n:
Let p be a prime and gcd(a; p) = 1. Then the congruence x k ≡ a (mod p) has a solution if and
only if a(p−1)=d ≡ 1 (mod p) where d =gcd(k; p − 1):
65
Example 68. Recall that 13 has primitive roots, namely: 2, 6, 7 and 11. Also, ffi(13) = 12.
Let a = 5. Note that g cd(5; 13) = 1. By Theorem 47, the congruence x 9 ≡ 5 ( mod 13) has a solution
ffi(13)
if and only if 5 3 = 54 ≡ 1 ( mod 13) , where 3 = gcd(9, 12).
Moreover, there are exactly three solutions to x 9 ≡ 5 ( mod 13) , namely: 2, 5 and 6.
Exercise 6
I. Determine the order of the given integer a under the indicated the congruence modulo n.
1. a = 6; n = 9 4. a = 12; n = 16
2. a = 8; n = 11 5. a = 11; n = 18
3. a = 5; n = 14
1. 19 4. 50
2. 24 5. 81
3. 25
66
Chapter 7
OVERVIEW
This chapter discusses the quadratic residues and nonresidues, and relates its concepts with the
Legendre function and the quadratic reciprocity.
Learning Objectives
At the end of this chapter, the students are expected to:
Definition 16
Let p be an odd prime and gcd(a; p) = 1: If the congruence x 2 ≡ a (mod p) has a solution, then
a is said to be a quadratic residue of p. Otherwise, a is called a quadratic nonresidue of p:
Thus, 1, 2 and 4 are quadratic residues of 7. Also, 3, 5 and 6 are quadratic nonresidues of 7.
67
Theorem 48: Euler’s Criterion
Let p be an odd prime and gcd(a; p) = 1: Then a is a quadratic residue of p if and only if
a(p−1)=2 ≡ 1 (mod p):
Corollary 21
Solution:
By corollary of Euclid’s criterion,
7−1
1 2 = 1 ≡ 1 ( mod 7)
7−1
2 2 = 8 ≡ 1 ( mod 7)
7−1
3 2 = 27 ≡ 6 ≡ −1 ( mod 7)
7−1
4 2 = 64 ≡ 1 ( mod 7)
7−1
5 2 = 125 ≡ 6 ≡ −1 ( mod 7)
7−1
6 2 = 216 ≡ 6 ≡ −1 ( mod 7) :
Thus, by corollary of Euclid’s Criterion, 1, 2 and 4 are the quadratic residues of 7, while, 3, 5 and 6 are
the quadratic nonresidues of 7.
68
7.2 Legendre Symbol
Example 71.
Theorem 49
Let p be an odd prime and a and b be integers which are relatively prime to p: Then the Legendre
symbol has the following properties:
2. (a2 =p) = 1
4. (ab=p) = (a=p)(b=p)
1. We have 7−1
2 2 = 8 ≡ 1 ( mod 7) ; and
7−1
(−5) 2 = −125 ≡ 1 ( mod 7) :
Thus, (2=7) = (−5=7):
7−1
2. Observe that 42 = 16 and 16 2 = 4096 ≡ 8 ≡ 1 ( mod 7) . Thus, (42 =7) = 1.
69
3. Note that
7−1
(2 · (−5)) 2 ≡ (−10)3 ( mod 7)
7−1
(2 · (−5)) 2 ≡ −1000 ( mod 7)
7−1
(2 · (−5)) 2 ≡ 1 ( mod 7) :
Also, (2=7)(−5=7) = 1 · 1 = 1 = ((2 · −5)=7).
7−1 7−1
4. We have 1 2 ≡ 1 ( mod 7) and (−1) 2 ≡ −1 ( mod 7) . (1=7) = 1 and (−1=7) = −1.
Corollary 22
if p is an odd prime, then
8
>
< 1; if p ≡ 1 (mod 4)
(−1=p) = >
:−1; if p ≡ 3 (mod 4)
Example 73.
Theorem 50
There are infinitely many primes of the form 4k + 1.
Theorem 51
If p is and odd prime, then
p−1
X
(a=p) = 0:
a=1
hence, there are precisely (p − 1)=2 quadratic residues and (p − 1)=2 quadratic nonresidues of p:
70
Example 74. Let p = 7. Thus, (1=7) = (2=7) = (4=7) = 1 and (3=7) = (5=7) = (6=7) = −1. Thus,
6
X
(a=7) = (1=7) + (2=7) + (3=7) + (4=7) + (5=7) + (6=7)
a=1
X6
(a=7) = (1) + (1) + (−1) + (1) + (−1) + (−1)
a=1
X6
(a=7) = 0:
a=1
Corollary 23
The quadratic residues of an odd prime p are congruent modulo p to the even powers of a
primitive root r of p; the quadratic nonresidues are congruent to the odd powers of r:
Thus, the quadratic residues of 7 are the even powers of 3, namely: 2, 4 and 1. Also, the quadratic
nonresidues of 7 are the odd powers of 3, namely: 3, 6 and 5.
p−1
„ « ff
S = a; 2a; 3a; : : : ; a
2
(a=p) = (−1)n :
Example 76. Let p = 13 and a = 5: Then (p − 1)=2 = 6; so that S = {5; 10; 15; 20; 25; 30}. By
modulo 13, then S = {5; 10; 2; 7; 12; 4}. Three of these are greater than (p −1)=2 = 13=2 = 6. Hence,
n = 3 and by Theorem 43, (5=13) = (−1)3 = −1.
71
Theorem 53
If p is an odd prime, the
8
>
< 1; if p ≡ 1 (mod 8) or p ≡ 7 (mod 8)
(2=p) = >
:−1; if p ≡ 3 (mod 8) or p ≡ 5 (mod 8):
Example 77.
Corollary 24
2 −1)=8
If p is an odd prime, then (2=p) = (−1)(p .
Example 78.
112 −1
1. Let p = 11. Since, (2=11) = (−1) 8 = −1
132 −1
2. Let p = 13. Since, (2=13) = (−1) 8 = −1.
172 −1
3. Let p = 17. Since, (2=17) = (−1) 8 = 1.
312 −1
4. Let p = 31. Since, (2=31) = (−1) 8 = 1.
Theorem 54
If p and 2p + 1 are both odd primes, then the integer (−1)(p−1)=2 2 is a primitive root of 2p + 1:
Theorem 55
There are infinitely many primes of the form 8k − 1.
72
7.3 Quadratic Reciprocity
p−1 q−1
(p=q)(q=p) = (−1) 2 2 :
Corollary 25
If p and q are distinct odd primes, then
8
1; if p ≡ 1 (mod 4) or q ≡ 1 (mod 4)
>
<
(p=q)(q=p) = >
:−1; if p ≡ q ≡ 3 (mod 4):
Corollary 26
If p and q are distinct odd primes, then
8
>
< (q=p); if p ≡ 1 (mod 4) or q ≡ 1 (mod 4)
(p=q) =
:−(q=p);
>
if p ≡ q ≡ 3 (mod 4):
Example 82. Consider the Legendre symbol (29=53): Since 29 ≡ 1 (mod 4) and 53 ≡ 1 (mod 4), we
see that
(29=53) = (53=29)
= (24=29)
= (2=29)(3=29)(4=29)
= (2=29)(3=29)
73
By Theorem 44, (2=29) = −1, while inverting again, (3=29) = (29=3) = (2=3) = −1, where we used
the congruence 29 ≡ 2 (mod 3). Therefore, (29=53) = (2=29)(3=29) = (−1)(−1) = 1:
Theorem 57
If p 6= 3 is an odd prime, the
8
>
< 1; if p ≡ ±1 (mod 12)
(3=p) =
:−1;
>
if p ≡ q ≡ ±5 (mod 12):
Example 83. Let p = 23. Since, 23 ≡ −1 ( mod 12) , then (3=23) = 1. Note that
23−1
3 2 = 31 1 ≡ 1 ( mod 23) .
Exercise 7
1. 13 4. 23
2. 17 5. 29
3. 19
1. (2/11) 6. (5/19)
2. (8/11) 7. (-7/23)
3. (7/13) 8. (11/23)
4. (12/13) 9. (6/31)
5. (-43/17) 10. (66/89)
74
First Quiz
Date:
I 22
II 18
II 15
Total 55
75
I. Write O if the statement is true and X if otherwise, on the space provided. [2 points each]
II. Mechanical. Show all necessary solutions for full credit and ENCLOSE YOU FINAL AN-
SWER.
76
(b) 1024 and 15625
2. Find the general solution using Euclidean Algorithm and Backward Euclidean Algorithm.
(a) 2076x + 1776y = 108 [5 points]
77
(b) 2024x + 1024y = 96 [5 points]
78
Second Quiz
Date:
I 18
II 22
III 10
Total 50
79
I. Write O if the statement is true and X if otherwise, on the space provided. [2 points each]
1. Find the remainder when 1! + 2! + 3! + ::: + 98! + 99! + 100! is divided by 15. [3 points]
80
2. Find the remainder when 72002 is divided by 19. [3 points]
81
4. Solve the linear congruence 12x ≡ 48(mod 18). [4 points]
82
Third Quiz
I 20
II 24
III 16
Total 60
83
I. Write O if the statement is true and X if otherwise, on the space provided. [2 points each]
(b) ff(6120)
(c) ffi(6120)
84
2. Let n = p1 p2 p3 · · · pr be a product of r distinct primes. Determine the ff.: [3 points each]
(a) fi (n)
(b) ff(n)
(c) ffi(n)
85
III. Prove.
86
Final Examination
Student number:
General Instructions: Encircle the letter that corresponds to your choice of answer. Use only black
or blue-inked pen. Any form of ERASURE is considered INCORRECT. If your answer is NOT
among the choices, then write your preferred answer on the left side of the item number. Use the back
pages for scratch. You may use your calculator in this exam. [2 points each]
a
1. “Let a and b be any positive integers. Then there is a positive integer n such that n ≥ ."
b
is commonly known as
(a) Well-Ordering Principle (c) Archimedean Property
87
3. Let gcd(a; b) = d, where a; b ∈ Z; a; b 6= 0. Which of the following is FALSE?
(a) d|a and d|b. (c) d = ax + by , for some x; y ∈ Z.
!
a b
(b) If c|a and c|b, then c ≥ d. (d) gcd ; = 1.
d d
4. Euclid’s Lemma states that:
7. A man lost his wallet that contains Php5 and Php10 bills amounting to Php45. Suppose we
want to know how many of each kind of bill will produce the given amount. What is the general
solution? Assume x and y is the number of Php5 and P10 bill, respectively.
8. From the previous problem, which of the following are the solutions of the form (x; y )?
(a) {(1; 3); (3; 4); (5; 2); (7; 1)} (c) {(1; 4); (3; 3); (5; 2); (7; 1)}
(b) {(1; 2); (3; 3); (5; 3); (7; 1)} (d) {(1; 1); (3; 2); (5; 3); (7; 4)}
88
10. Find the remainder when 1! + 2! + ::: + 50! is divided by 8.
(a) 1 (b) 3 (c) 5 (d) 7
12. The following are equivalent to two of the other three, EXCEPT:
(a) x | (y + z) (c) y + z = xk, k ∈ Z
13. Let a; b; c; n ∈ Z where n > 0. Which of the following does NOT hold?
(a) Every integer is congruent to exactly one of the least residues 0; 1; 2; :::; n − 1 modulo n.
(b) The set of integers Z can be partitioned into n nonempty pairwise disjoint classes, called
congruence classes modulo n.
(c) Every palindrome number is divisible by 11.
89
(d) The square of every odd integer is congruent to 1 modulo 4.
(a) The product of the positive divisors of n > 1 is equal to nfi (n) .
(b) An integer n > 0 is said to be per f ect if n is equal to the sum of all its positive divisors.
n
(c) If n = 2k ; where k > 0, then ffi(n) = .
2
(d) Let n ∈ N. Then fi (n) is odd if and only if n is a perfect number.
(a) Let n ∈ N. Then ff(n) is odd if and only if n is a perfect square or twice a perfect square.
(b) The product of the positive divisors of n > 1 is equal to nfi (n) .
(c) If f is multiplicative, then f (mn) = f (m)f (n) for every m; n ∈ N:
m ffi(m)
„ «
(d) Let m; n ∈ N: Then ffi = where m = nk; k ∈ N:
n ffi(n)
24. Let n = p1 p2 p3 · · · pr be a product of r distinct primes. Which of the following is FALSE?
25. This is a bonus item. You have to send the three quizzes and this Examination back to PUP via
its official courier service partner before January 2021 ends.
90
References:
11. Precalculus Learner’s Material, First Edition 2016, Department of Education, Republic of the
Philippines
91