Chapter2 - Divisibility and Factorization - 211026 - 150908 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Chapter 2

Divisibility and Factorization

2.1 Division Algorithm and Divisibility


The goal of this section is to prove the following important result. It says
that an integer a can be ”divided” by a positive integer b in such a way that
the remainder is smaller than b.

Theorem 2.1 (The Division Algorithm). If a and b are integers and


b > 0 then there exist unique integers q and r satisfying the two conditions:

(2.1) a = bq + r and 0 ≤ r < b.

In this situation q is called the quotient and r is called the remainder in the
division of a by b. Note that there are two parts to this result. One part is
the existence of integers q and r satisfying (2.1) and the second part is the
uniqueness of the integers q and r satisfying (2.1).

Proof. Consider the set

S = {a − bx : x an integer and a − bx ≥ 0}.

First, we prove that S is nonempty. Indeed, since b ≥ 1, we have b|a| ≥ |a|,


and so
a − b(−|a|) = a + b|a| ≥ a + |a| ≥ 0.
We choose x = −|a|, we get a − bx ∈ S, and S is nonempty. Now by the
Well-Ordering Principle (see Chapter 1), we conclude that S has a smallest

1
2 MAT 222

integer r. Thus there is an integer q such that r = a − bq ≥ 0. Then,


a = bq + r with r ≥ 0. We show that r < b. Suppose, to the contrary, that
r ≥ b. Then
a − b(q + 1) = (a − bq) − b = r − b ≥ 0.
This implies that a−b(q +1) ∈ S, but a−b(q +1) = r −b ≤ r, a contradiction
since r is the smallest element of S. Hence r < b.
Therefore, there exist integers q and r such that a = bq + r, with 0 ≤ r < b.

We still have to prove that q and r are uniquely determined. To do this


we assume that
a = bq1 + r1 and 0 ≤ r1 < b,
and
a = bq2 + r2 and 0 ≤ r2 < b.
We must show that r1 = r2 and q1 = q2 . If r1 ̸= r2 , we can assume that
r1 < r2 . Subtracting these two equations we obtain

0 = a − a = (bq1 + r1 ) − (bq2 + r2 ) = b(q1 − q2 ) + (r1 − r2 ).

This implies that

(2.2) r2 − r1 = b(q1 − q2 ).

This gives |r2 − r1 | = b|q1 − q2 |. Using the fact that −b < −r1 ≤ 0 and
0 ≤ r2 < b, by adding we obtain −b < r2 −r1 < b, or equivalently, |r2 −r1 | < b.
Thus, b|q1 −q2 | < b, and so 0 ≤ |q1 −q2 | < 1. But |q1 −q2 | is a natural number,
then we must conclude that |q1 − q2 | = 0. Hence q1 = q2 . Now from (2.2) we
have r2 − r1 = 0, that is, r1 = r2 . This completes the proof of the uniqueness
of r and q in (2.1).

Corollary 2.1. If a and b are integers, with b ̸= 0, then there exist unique
integers q and r such that a = bq + r, 0 ≤ r < |b|.

Example (The Division Algorithm when b < 0). Let b = −7 and a =


1, −2, 61, −59. We have
1 = 0(-7) + 1, -2 = 1(-7) + 5, 61 = (-8)(-7) + 5, -59= 9(-7) + 4.

Definition 2.1. An integer n is even if n = 2k for some k, and is odd if


n = 2k + 1 for some k.
MAT 222 3

Definition 2.2. By the parity of an integer we mean whether it is even or


odd.
Exercise. Prove n and n2 always have the same parity. That is, n is even if
and only if n2 is even.
Exercise. Find the q and r of the Division Algorithm for the following values
of a and b:
1. Let b = 3 and a = 0, 1, −1, 10, −10.
2. Let b = 345 and a = 0, −1, 1, 344, 7863, −7863.
Remark.
1. Note that with b = 2, the possible remainders are r = 0 and r = 1.
When r = 0, then a = 2q, i.e., a is even, and when r = 1, the integer
a has the form a = 2q + 1, i.e., a is odd. Now a2 is either of the form
(2q)2 = 4k or (2q + 1)2 = 4(q 2 + q) + 1 = 4k + 1. This implies that the
square of an integer leaves the remainder 0 or 1 upon division by 4.
2. We also can show that the square of any odd integer is of the form 8k+1.
Indeed, by the Division Algorithm, any integer is representable as one
of the four forms: 4q, 4q +1, 4q +2, 4q +3, and only those integers of the
forms 4q +1 and 4q +3 are odd. Thus, (4q +1)2 = 8(2q 2 +q)+1 = 8k+1
and (4q + 3)2 = 8(2q 2 + 3q + 1) + 1 = 8k + 1. As examples, the square
of the odd integer 5 is 52 = 25 = 8.3 + 1, and the square of 11 is 112
= 121 = 8.15 + 1.
Exercise. Use the Division Algorithm by 3 to show that a(a2 + 2)/3 is an
integer for any a ≥ 1.
Definition 2.3. We say that d divides n, and we write d | n, if there is an
integer k such that n = dk.
d - n means that d does not divide n.
Note that d | n ̸= d/n. Recall that d/n represents the fraction nd .
The expression d | n may be also read in any of the following ways:
(d is a divisor of n); (d is a factor of n); (n is a multiple of d).

Example. The following five statements are equivalent, that is, they are
all different ways of saying the same thing:
2 | 6 or (2 divides 6) or (2 is a divisor of 6) or (2 is a factor of 6) or (6 is a
multiple of 2).
4 MAT 222

Definition 2.4. d | n iff there is k such that n = dk.


Note that ⇐⇒ , iff, and if and only if, all mean the same thing.
Keep in mind that here we are assuming that all letters a, b, . . . , z represent
integers. One might also see the following definition sometimes.
Definition 2.5. d | n if n = dk for some k.
Theorem 2.2 (Divisibility Properties). If n, m, and d are integers then the
following statements hold:
1. n | n (everything divides itself )
2. d | n and n | m =⇒ d | m (transitivity)

3. d | n and d | m =⇒ d | an + bm for all a and b (linearity property)

4. d | n =⇒ ad | an (multiplication property)

5. ad | an and a ̸= 0 =⇒ d | n (cancellation property)


6. 1 | n (one divides everything)

7. n | 1 =⇒ n = ±1 (1 and −1 are the only divisors of 1)


8. d | 0 (everything divides zero)

9. 0 | n =⇒ n = 0 (zero divides only zero)


10. If d and n are positive and d | n then d ≤ n (comparison property)
Proof. The proof is left as an exercise.
Definition 2.6. If c = ax + by for some integers x and y we say that c is a
linear combination of a and b.
Remark. Statement 3 in Theorem 2.2 says that if d divides a and b, then d
divides all linear combinations of a and b. In particular, d divides a + b and
a − b. This can be extended by induction to sums of more than two terms.
Exercise.
1- Prove that if d | a and d | b then d | a − b.
2- Prove that if a ∈ Z then the only positive divisor of both a and a + 1 is 1.
MAT 222 5

2.2 Greatest Common Divisor


Definition 2.7. If a and b are arbitrary integers, then an integer d is said
to be a common divisor of a and b if both d | a and d | b.
Remark. It is clear that 1 is a divisor of every integer, so 1 is a common
divisor of a and b. Hence, their set of positive common divisors is nonempty.
Definition 2.8. (Greatest Common Divisor). Let a, b ∈ Z. If a ̸= 0 or b ̸= 0,
we define gcd(a, b) to be the greatest common divisor d of a and b, that is,
d | a and d | b, and if c | a and c | b, then c ≤ d. We define gcd(0, 0) = 0.
Example. gcd(−12, 30) = 6, gcd(−5, 5) = 5, gcd(8, 17) = 1, gcd(−8, −36) =
4.
Remark. One can also define the greatest common divisor of three nonzero
integers a, b and c. As example, gcd(39, 42, 54) = 3.
Theorem 2.3. (Bezout’s Identity). Given integers a and b, not both zero,
there exist integers x and y such that gcd(a, b) = ax + by.
Proof. See David M. Burton (Elementary Number Theory).
Example.
1. gcd(−12, 30) = 6 = (−12)2 + 30.1, gcd(−8, −36) = 4 = (−8)4 +
(−36)(−1).
2. gcd(2, 3) = 1 = (−1)2 + 1.3 = 2.2 + (−1)3.
So the numbers x and y in Bezout’s Identity are not uniquely determined.
In fact, as we will see later there are infinitely many choices for x and y for
each pair a, b.

Using Bezout’s identity, we will prove the following interesting result.



Theorem 2.4. The number 2 is irrational.

Proof. Suppose, to the contrary, that 2 is a rational number. So let
√ a
2 = , for some integers a, b with gcd(a, b) = 1. Then by Bezout’s identity,
b √
there
√ exist integers x and y such that 1 = ax + by. Now since 2a = 2b and
2b = a, we get
√ √ √ √
2 = 2(ax + by) = ( 2a)x + ( 2b)y = 2bx + ay.
6 MAT 222

√ √
This implies that 2 is an integer, which is a contradiction. Therefore 2 is
an irrational number.
Remark. There are interesting well-known variations on the proof of the
previous theorem either involving the next fundamental theorem of arith-
metic or based on the parity of a2 and b2 .
Corollary 2.2. If a and b are given integers, not both zero, then the set

T = {ax + by : x, y are integers}

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


Proof. Since d | a and d | b, then d | (ax + by) for all integers x, y. Thus,
every member of T is a multiple of d. Conversely, we have d = ax0 + by0 for
some integers x0 and y0 . Then, any multiple nd of d is

nd = n(ax0 + by0 ) = a(nx0 ) + b(ny0 ).

Hence, nd ∈ T.
Definition 2.9. Two integers a and b, not both zero, are said to be relatively
prime whenever gcd(a, b) = 1.
Theorem 2.5. 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 a and b are relatively prime, then gcd(a, b) = 1. Hence by the
previous theorem, there exist x and y such that 1 = ax + by. Conversely,
suppose that 1 = ax + by for some integers x and y, and that d = gcd(a, b).
Since d | a and d | b, then by Theorem 2.2, d | ax + by, so d | 1. Hence
d = 1.
Corollary 2.3.
1. If gcd(a, b) = d, then gcd(a/d, b/d) = 1.
2. If a | c and b | c, with gcd(a, b) = 1, then ab | c.
Example. We have gcd(−12, 30) = 6, and indeed gcd(−12/6, 30/6) =
gcd(−2, 5) = 1.
Theorem 2.6. (Euclid’s lemma). If a | bc, with gcd(a, b) = 1, then a | c.
MAT 222 7

Proof. Since gcd(a, b) = 1, there exist integers x, y such that 1 = ax + by.


Multiplying this by c gives c = (ax + by)c = acx + bcy. Now because a | ac
and a | bc, then a | acx + bcy, so a | c.
Definition 2.10. (Least Common Multiple). The least common multiple
(lcm) of two nonzero integers a and b, denoted by lcm(a, b), is the smallest
positive integer that is divisible by both a and b.
Remark. If m= lcm(a, b) iff a | m and b | m, and if a | c and b | c, with
c > 0, then m ≤ c.

Example.
(1) lcm(3, 5)=15, lcm(4,6)=12, lcm(7, 9)= 63, lcm(36, 48)=144.

(2) The positive common multiples of the integers -12 and 30 are 60, 120, 180, . . . .
Hence, lcm( -12, 30) = 60.
Theorem 2.7. Let a and b be two integers. We have

gcd(a, b). lcm(a, b) = |a||b|.

Proof. See David M. Burton (Elementary Number Theory).


Corollary 2.4. Let a and b be two positive integers. Then, lcm(a, b) = ab
iff gcd(a, b) = 1.
Example. lcm(4, 6) = 4.6/ gcd(4, 6) = 24/2 = 12 and lcm(3, 8) = 3.8 = 24
since gcd(3, 8) = 1.

2.3 The Euclidean Algorithm


Unlike the Division Algorithm, the Euclidean Algorithm is an algorithm
(a process or a method) to compute gcd(a, b) of two nonzero integers a and
b. Since we have gcd(0, 0) = 0, gcd(a, b) = gcd(|a|, |b|), gcd(a, b) = gcd(b, a),
and (if a > 0, then gcd(a, 0) = a and gcd(a, a) = a), it suffices to compute
gcd(a, b) when a > b > 0.
Lemma 2.1. Let a > b > 0. If a = bq + r, then

gcd(a, b) = gcd(b, r).


8 MAT 222

Proof. If d = gcd(a, b), then d | a and d | b, and so d | (a − qb), or d | r. Thus,


d is a common divisor of both b and r. Now, if c is an arbitrary common
divisor of b and r, then c | (qb + r), hence c | a. This implies that c a common
divisor of a and b, so that c ≤ d and d = gcd(b, r).

Remark. The Euclidean Algorithm is the process which involves repeated


application of the Division Algorithm to compute gcd(a, b) when a > b > 0.
This division process continues until some zero remainder appears.

We will give an example to show how the algorithm goes.


Example. Let’s compute gcd(803, 154).

gcd(803, 154) = gcd(154, 33) since 803 = 154 · 5 + 33


gcd(154, 33) = gcd(33, 22) since 154 = 33 · 4 + 22
gcd(33, 22) = gcd(22, 11) since 33 = 22 · 1 + 11
gcd(22, 11) = gcd(11, 0) since 22 = 11 · 2 + 0
gcd(11, 0) = 11.

Hence gcd(803, 154) = 11.

Remark. Note that we have formed the gcd of 803 and 154 without fac-
toring 803 and 154. This method is generally much faster than factoring and
can find gcd’s when factoring is not feasible.
Exercise. Find gcd(a, b) using the Euclidean Algorithm for each of the val-
ues: (1) a = 37, b = 60 and (2) a = 377, b = 233.

An important consequence of the Euclidean Algorithm is the following the-


orem.

Theorem 2.8. If k > 0, then gcd(ka, kb) = k gcd(a, b).

Proof. See David M. Burton (Elementary Number Theory).

Corollary 2.5. For any integer k ̸= 0, gcd(ka, kb) = |k| gcd(a, b).

Example. gcd(12, 30) = 3 gcd(4, 10) = 3.2 gcd(2, 5) = 6.1 = 6.


MAT 222 9

2.4 Prime Numbers and the Fundamental The-


orem of Arithmetic
Definition 2.11. An integer p is prime if p ≥ 2 and the only positive
divisors of p are 1 and p. An integer n is composite if n ≥ 2 and n is not
prime.

Remark. The number 1 is neither prime nor composite.


Example. Among the first ten positive integers, 2, 3, 5, 7 are primes and 4,
6, 8, 9, 10 are composite numbers. Note that the integer 2 is the only even
prime.

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

Proof. If p - a, then gcd(p, a) = 1. Hence by Euclid’s lemma in page 6, we


get p | b.

Corollary 2.6. If p is a prime and p | a1 a2 . . . an , then p | ak for some k,


where 1 ≤ k ≤ n.

Exercise. Prove that if p, q1 , q2 , . . . , qn are all primes and p | q1 q2 . . . qn , then


p = qk for some k, where 1 ≤ k ≤ n.

Theorem 2.10. (Fundamental Theorem of Arithmetic). Every posi-


tive integer n > 1 can be expressed as a product of primes; this representation
is unique, apart from the order in which the factors occur.

Proof. See David M. Burton (Elementary Number Theory).

Example. 12=2.2.3, 15=3.5, 27= 3.3.3, 360 = 2.2.2.3.3.5.

Corollary 2.7. Any positive integer n > 1 can be written uniquely in a


canonical form n = pk11 pk22 . . . pkr r where, for i = 1, 2, . . . , r, each ki is a posi-
tive integer and each pi is a prime, with p1 < p2 < . . . < pr

Example. 12 = 22 .3, 15 = 31 .5, 27 = 33 , 360 = 23 .32 .5, 4725 = 33 .52 .7 and


17460 = 23 .32 .5.72 .

Theorem 2.11 (Euclid’s Theorem). There are infinitely many prime


numbers.
10 MAT 222

Proof. Assume, by way of contradiction, that there are only a finite number
of prime numbers, say:
p1 , p 2 , . . . , p n .
Define
N = p1 p2 · · · pn + 1.
Since p1 ≥ 2, clearly N ≥ 3. So by the Fundamental Theorem of Arithmetic
N has a prime divisor p. By assumption p = pi for some i = 1, . . . , n since
p1 , p2 , . . . , pn are the only prime numbers. Let a = p1 · · · pn . Note that

a = pi (p1 p2 · · · pi−1 pi+1 · · · pn ) ,

so pi | a. Now N = a + 1 and by assumption pi | a + 1. So pi | (a + 1) − a,


that is pi | 1. This implies that pi = 1. This contradicts the fact that primes
are > 1. It follows that the assumption that there are only finitely many
primes is not true.
Definition 2.12. Let x ∈ R, x > 0. π(x) denotes the number of primes p
such that p ≤ x.
For example, since the only primes p ≤ 10 are 2, 3, 5, and 7 we have π(10) =
4.

2.5 The Sieve of Eratosthenes


The Sieve of Eratosthenes is a very simple and popular technique for finding
all the prime numbers in the range from 2 to a given number n. It is one of
the most efficient ways to find small prime numbers.
The algorithm takes its name from the process of sieving–in a simple way
we remove multiples of consecutive numbers. Initially, we have the set of all
the numbers 2, 3, . . . , n. At each step we choose the smallest number in the
set and remove all its √ multiples. Notice that every composite number has
a divisor of at most n (This can be easily shown). In particular, it has a
divisor which is a prime number. √ It is sufficient to remove only multiples of
prime numbers not exceeding n. In this way, all composite numbers will be
removed.
(Starting from 2. Once all multiples of 2 have been marked composite, the
muliples of√next prime, i.e., 3 are marked composite. This process continues
until p ≤ n, where p is a prime number.)
MAT 222 11

The following illustration shows steps of sieving for n = 17. The elements of
the processed set are not bold, and removed composite numbers are in bold.
First, we remove multiples of the smallest element in the set, which is 2. The
next element
[ remaining in the set is 3, and we also remove
√ its 2multiples, and
so on. Here the next element
] is 5 (a prime), but 5 > 17, (5  17), so the
process stops at this step

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Hence, all the prime numbers in the range from 2 to 17 are: 2, 3,5, 7, 11, 13,
17.
Exercise. Find all the prime numbers less than or equal to 30.

2.6 Linear Diophantine Equation


The simplest type of Diophantine equation that we shall consider is the linear
Diophantine equation in two unknowns x, y : ax + by = c, where a, b, c are
given integers where a, b are not both zero. A solution of this equation is a
pair of integers x0 , y0 such that ax0 + by0 = c.

Remark.
(1) A linear Diophantine equation can have a number of solutions. As
example, consider the equation 3x + 6y = 18. Then x = 4, y = 1 is a
solution since 3.4 + 6.1 = 18, x = −6, y = 6 and x = 10, y = −2 are
also solutions since 3(-6) + 6.6 = 18, 3.10 + 6(-2) = 18.
(2) Also, a linear Diophantine equation can have no solutions. As example,
the equation 2x + 10y = 17 has no solution since the left-hand side is
even for all x, y while 17 is odd.
Theorem 2.12. The linear Diophantine equation ax + by = c has a solution
if and only if d | c, where d = gcd(a, b). Further, if x0 , y0 is any particular
solution of this equation, then all other solutions are given by
(b) (a)
x = x0 + t, y = y0 − t
d d
where t is an arbitrary integer.
12 MAT 222

Proof. See David M. Burton (Elementary Number Theory).


Example. Consider the linear Diophantine equation 172x + 20y = 1000. We
show that this equation has a solution and will give all the other solutions.
Indeed, let’s compute gcd(172, 20) by applying Euclidean’s Algorithm. We
have

gcd(172, 20) = gcd(20, 12) since 172 = 8.20 + 12


gcd(20, 12) = gcd(12, 8) since 20 = 1.12 + 8
gcd(12, 8) = gcd(8, 4) since 12 = 1.8 + 4
gcd(8, 4) = gcd(4, 0) since 8 = 2.4 + 0
gcd(4, 0) = 4.

Hence gcd(172, 20) = 4. Thus, by the previous theorem and since 4 | 1000, a
solution to this equation exists.
Let us now find a particular solution. From the previous calculations, we have
4 = 12−8 = 12−(20−12) = 2.12−20 = 2.(172−8.20)−20 = 2.172+(−17).20
Hence, 4 = 2.172 + (−17).20. Multiplying by 250 gives

1000 = 250.4 = 250[2.172 + (−17)20] = 500.172 + (−4250)20.

So that, so that x0 = 500 and y0 = −4250 is a (particular) solution to


our Diophantine equation. Therefore all the other solutions are given by
x = 500 + (20/4)t = 500 + 5t and y = −4250 − (172/4)t = −4250 − 43t for t
an arbitrary integer.

Corollary 2.8. If gcd(a, b) = 1 and if x0 , y0 is a particular solution of the


linear Diophantine equation ax + by = c, then all solutions are given by

x = x0 + bt y = y0 − at

for t an arbitrary integer.

Example. For the equation 5x + 22y = 18, it is easy to check that x0 =


8, y0 = −1 is one solution. Further, since gcd(5, 22) = 1, from the corollary,
all the other solutions are given by x = 8 + 22t, y = −1 − 5t for arbitrary t.

You might also like