Math 393 Chapter 3
Math 393 Chapter 3
• Definition: An integer greater than 1 is a prime if it has exactly two positive divisors: 1 and itself; an
integer greater than 1 is a composite if it is not a prime.
Remark: By definition, 1 is neither a prime nor a composite.
1
Theorem 3.1 (Euclid’s theorem). There are infinitely many primes.
p
Theorem 3.2. If n is a composite, then n has a prime factor not exceeding n.
• Sieve of Eratosthenes: a procedure to find all of the primes less than or equal to a given positive integer n.
2
3.3 Greatest Common Divisors and Their Properties
Remark: Theorem 3.6 states that if you divide two integers by their greatest common divisor, the resulting
numbers are relatively prime.
3
• Definition. A linear combination of integers a and b is a number of the form ma + nb, where m, n 2 Z.
Theorem 3.8. If a and b are integers, not both 0, then (a, b) is the smallest positive linear combination of a
and b. In particular, there exist m, n 2 Z such that (a, b) = ma + nb.
Corollary. Two integers a and b are relatively prime if and only if there exist m, n 2 Z such that ma+nb = 1.
4
Corollary. The set of all linear combinations of integers a and b is the set of all multiples of (a, b).
Eg 6: All linear combinations of 12 and 18 are 0, ±6, ±12, · · · , which are exactly all multiples of (12, 18) = 6.
Corollary. The set of all common divisors of integers a and b is the set of all divisors of (a, b).
Eg 7: All common divisors of 12 and 18 are ±1, ±2, ±3, ±6, which are exactly all divisors of (12, 18) = 6.
• Definition. Let a1 , a2 , · · · , an be integers, not all 0. The greatest common divisor of these integers,
written as (a1 , a2 , · · · , an ), is the largest integer that divides all of these integers.
Remark: To compute the GCD of more than two integers, you can compute the GCD two integers at a time.
5
3.4 The Euclidean Algorithm
1. (a, b) = (b, a)
2. (a, b) = (|a|, |b|)
3. (a, 0) = |a|
Remark: Due to facts (2) and (3), it suffices to understand the GCD of positive integers.
• Lemma 3.3: Let a and b be integers. If a = bq + r for some q, r 2 Z, then (a, b) = (b, r).
Ca , b) = ( a- bq , b)
=
( r
, b) .
• How to find GCD (The Euclidean Algorithm): If r0 = a and r1 = b are positive integers with a b,
then (a, b) = rn , the last nonzero remainder below by successively applying the division algorithm.
r0 = r1 q 1 + r2 , where 0 < r2 < r1 ,
r1 = r2 q 2 + r 3 , where 0 < r3 < r2 ,
r2 = r3 q 3 + r 4 , where 0 < r4 < r3 ,
..
.
rn 3 = rn 2 qn 2 + rn 1, where 0 < rn 1 < rn 2,
rn 1 = rn qn + 0.
j rj qj 408=18712 ) + 34
0 408
1 187 2
187 =
34 (5) + IF
2 34 5
3 17 2
4 ◦
34 =
1712 ) +0
5
6
• How to express (a, b) as a linear combination of a and b (The Extended Euclidean Algorithm):
If r0 = a and r1 = b are positive integers with a b, then
(a, b) = sn a + tn b,
where sn and tn are the n-th terms of the sequences defined recursively by
s0 = 1, t0 = 0,
s1 = 0, t1 = 1,
and
sj = sj 2 qj 1 sj 1 , t j = tj 2 qj 1 tj 1
for j 2, where the qj ’s are the quotients found in the Euclidean algorithm.
Eg 2: Use the extended Euclidean algorithm to find (187, 408) and express it as a linear combination of 187
and 408.
408 -
(1) 408 + 10 ) 187 =
0 408 1 0
34 = (1) 408 + C- 2) 187
1 187 2 0 1
2 34 5 I -2
187 = CO) 408 + 4) 187
3 17 2 -5 11
-
5
17=(-57408+41) 187 .
Eg 3: Use the extended Euclidean algorithm to find (246, 194) and express it as a linear combination of 246
and 194.
j rj qj sj tj
0 246
( 246 , 194 ) =L
' °
1 194 I 0 I
2 52 3 I -
I
3 38 I -
3 4
4 14 2 4 -5 I = -41 (2461 + 52494) .
5 10 I - 11 14
6 4 2 15 -19
7 2 2 -
41 52
8 0
7
3.5 The Fundamental Theorem of Arithmetic
be then be (r 2) since ( cm + rn ) EZ
since a
/ ,
=
age c- .
since la , b) =L then ma +
nb = 1 then a / c.
Cma + crib = C
Cma + ann = C
atom + Rn ) = C
Lemma 3.5. Let a1 , a2 , · · · , an 2 N and let p be a prime. If p|a1 a2 · · · an , then p|ai for some i (1 i n).
proof :
Assume plat Akel
' "
het aiiaj , i -
i
, an
E N and let p be a
prime .
pla ,
* Case 1 : assume P lake ,
consider n = 1 .
If
,
then play .
for some k c- Z
,
assume
pla, ay . . .
ah
then play . *
Case 2 : assume
p fake ,
then (p ,
ah + , ) = 1
for some 1 ≤ i ≤ k .
ah )ah+ ,
plain
'
ah ,,
then play .
lemma 3- 4 plain ah
By ,
-
, pla , ,
i . .
plate .
• The Fundamental Theorem of Arithmetic. Every integer n 2 can be written in the form of
where the ni ’s are positive integers and the pi ’s are distinct primes. Furthermore, the factorization is unique
except for the order of the factors.
8
Proposition. If a = pa11 pa22 · · · pakk is the prime factorization of a, then
N = (1 + a1 )(1 + a2 ) · · · (1 + ak ).
2000000
g-
2
"
/ \ =L (2×5)
2 100
N ( ' + 3) (1+2)
27
=
,, =
.
56
250 = 12 .
''
55
Proposition. If a = pa11 pa22 · · · pakk and b = pb11 pb22 · · · pbkk are prime factorizations of a and b, where some
exponents may be zero, then
a = 23 .
31.57
N= ( 1+3 )( It 1) (1+0)
b- -
24.32.50
( a. b) =L ? 31.50 =
^ ^
7 6 25
^
9
23
Definition. Let a and b be nonzero integers. The least common multiple of a and b, denoted by [a, b], is
the smallest positive integer that is divisible by both a and b.
• Proposition. If a = pa11 pa22 · · · pakk and b = pb11 pb22 · · · pbkk are prime factorizations of a and b, where some
exponents may be zero, then the least common multiple
Mk
[a, b] = pM 1 M2
1 p2 · · · pk , where Mi = max(ai , bi ) for i = 1, 2, · · · , k.
F
A =
23 31. .
g-
2? 3? g-
b =
[ a b)
,
= 2 ? 5.57
Theorem 3.16. If a and b are positive integers, then (a, b) · [a, b] = ab.
( 2220,2225) [ 2220,2225 ] .
=
(2220×2225)
( 2220 ) ( 2225)
[ 2220,2225 ] =
( 2220 , 2225 )
(2220 ) ( 2225)
=
10 = 987 900 .
3.6 Factorization Methods
• Factoring by trial division: By Theorem 3.2, a positive integer n 2 is either a prime or has a prime
p
factor not exceeding n. We can use the following steps to completely factor n.
p
1. Divide n by all primes p n (starting from the smallest and not skipping any).
(a) If none yields an integer answer, then n is a prime and we are done.
(b) Otherwise we have a prime factor p1 . Repeatedly divide by p1 until the answer is no longer an integer
so that
n = pa11 n1 , where n1 is not divisible by p1 .
p
2. Divide n1 by all primes p such that p1 < p n1 (starting from the smallest and not skipping any).
(a) If no such p exists or none yields an integer answer, then n1 is a prime and we are done.
(b) Otherwise we have a prime factor p2 . Repeatedly divide by p2 until the answer is no longer an integer
so that
n1 = pa22 n2 and n = pa11 pa22 n2 , where n2 is not divisible by p2 .
3. If necessary, repeat step 2 with n1 replaced by n2 and p1 replaced by p2 , and so on.
11
Lemma 3.9. If n is an odd integer, then there is a one-to-one correspondence between expressions of n as a
product of two integers and expressions of n as a di↵erence of two perfect squares.
Eg 4: 77 = (9)2 (2)2 = (11)(7) and 77 = (39)2 (38)2 = (77)(1). Note how the first expression of 77 as a
di↵erence of two squares helps with the prime factorization of 77, but the second one does not.
12
3.7 Linear Diophantine Equations
• Diophantine equations: A Diophantine equation is an equation which is to be solved over the integers.
A linear Diophantine equation in two variables is an equation ax + by = c, where a, b, and c are integers.
Eg 1: The Diophantine equation 3x + 5y = 2 has at least one solution x = 1 and y = 1. (In fact, it has
infinitely many solutions.)
Eg 2: The Diophantine equation 2x + 4y = 1 has no solutions since for all integers x and y, the left side of
the equation is always even, which will never be equal to 1.
Eg 3 (Eg 1 revisited): Consider the Diophantine equation 3x+5y = 2. Since a = 3 and b = 5, d = (3, 5) = 1,
which divides c = 2. Thus, the equation has infinitely many solutions. Since x = 1 and y = 1 is a particular
solution, all solutions of the equation are
x= 1 + 5t, y = 1 3t, where t 2 Z.
Eg 4 (Eg 2 revisited): Consider the Diophantine equation 2x+4y = 1. Since a = 2 and b = 4, d = (2, 4) = 2,
which does not divide c = 1. Thus, the equation has no solutions.
13
How to find a particular solution: Basically there are two di↵erent ways:
1. By inspection.
2. Use the extended Euclidean algorithm to find m and n such that ma + nb = (a, b) = d. Then, a particular
solution of ax + by = c (when d | c) is
c c
x0 = m and y0 = n.
d d
j rj qj sj tj
0
1
2
3
4
5
14
Eg 7: Solve the Diophantine equation 98x 21y = 35.
j rj qj sj tj
0
1
2
3
4
5
Eg 8: Each adult ticket for a theme park costs $194 and each child ticket costs $178. If more child tickets
were sold than adult tickets and the total sale was $37, 000, how many tickets were sold for each type?
j rj qj sj tj
0
1
2
3
4
5
15