16
Divisibility October 8, 2014 1

Divisibility October 8, 2014 1 Divisibility If a and b are integers and a 0, then the statement that a divides b means that there is an integer c such

Embed Size (px)

Citation preview

Slide 1

DivisibilityOctober 8, 20141

DivisibilityIf a and b are integers and a 0, then the statement that a divides b means that there is an integer c such that b = ac. The notation is a | b.If a does not divide b, we write a | b.Note that every integer divides 0, 1 divides every integer and every integer divides itself.2

DivisibilityFor all integers a, b and c, if c | a and c | b, then c | (a + b). Why?For all integers a, b and c, if a | b, then a | bc. Why?For all integers a, b and c, if a | b and b | c, then a | c. Why?

3a = cx; b = cyThen, a + b = c(x + y)So, c divides (a + b)

Division TheoremLet a be an integer and d be a positive integer. Then, there exists unique integers q and r with 0 r < d such that a = dq + r.r is called the remainder of a divided by d and q is called the quotient.4

Greatest Common DivisorSuppose that a and b are integers and not both zero. The largest integer d such that d | a and d | b is called the greatest common divisor of a and b. We write d = gcd (a, b)If gcd(a, b) = 1, then a and b are relative prime of each other.5

Properties of gcdSome properties of gcd:gcd(a, b) = gcd (b, a)gcd(a, b) = gcd (-a, b)gcd(a, b) = gcd (|a|, |b|)gcd(a, 0) = |a|gcd(a, ka) = |a| where k is an integerWhy each of the above?

6

Properties of gcdIf a = bq + r for integers a, b, q and r, then gcd(a, b) = gcd(b, r)Why? (Hint: Try to show that every common divisor of a and b is also a common divisor of b and r and vice versa.)7Let x = cd(a, b)a = xh; b = xkThen, r = a bq = x(h kq)So, x | r and x = cd(a, r)Let y = cd(b, r)b = ys; r = ytThen, a = bq + r = y(qs + t)So, y | a and y = cd(a, b)

Euclids Algorithmgcd(a, b)if a = 0 return |b|if b = 0 return |a|repeatr := a mod ba := bb := runtil r = 0return aWhy is this algorithm correct(i.e., will terminate and give a correct answer)?(Try to show that when a or b is 0, it is correct. Otherwise, the steps taken in the repeat-until loop reduce the value of b and keep the gcd between a and b invariant.)8

GCD IdentityIf gcd(a, b) = d, then there exists integers m and n such that d = am + bn.That is, the gcd of two numbers can be written as a linear combination of the two numbers.This is found by a French mathematician called tienne Bzout. Thus, this is also called the Bzouts Identity.9

A Game on Water JugsSuppose you are given two jugs, one of 5 gallons and one 3 gallons. Now you are standing beside a fountain and is asked to fill one of the jugs with exactly 4 gallons of water. Can you do it? If so, how?How about making 9 gallons of water from 2 jugs of 10 gallons and 14 gallons? Can you do it? How or why?10Any volume one can measure using the 2 jugs is a linear combination of the sizes of the 2 jugs. E.g., here, any volume measurable x can be written as 10m + 14n. Since the gcd(10, 14) = 2, x must also be divisible by 2. But now, we want to measure 9. So, this is impossible.

Prime NumbersAn integer n > 1 is a prime number means that if n = rs for positive integers r and s, then r = 1 or s = 1.That is, the only divisors of n are 1 and itself.2, 3, 5, 7, , 19, , 257,885,161-1, Discovered in 2013. This number has 17,425,170 digits. Till January 2014, its still the largest one found.11

Fundamental Theorem of ArithmeticEvery positive integer greater than 1 can be written uniquely as the product of primes.That is, any positive integer n can be written as p1e1 p2e2 pkekFor example, 540 =2233512

Composite NumbersAn integer n > 1 is composite means that n is not a prime.

Theorem: If p is a prime and p|ab, then p|a or p|b.Theorem: If p is a prime and p|a1a2an, then p|ai for some i.

13

Modulus OperationsIf a and m are integers with m > 0, then the remainder of a divided by m is denoted by a mod m. That is, when a = qm + r for 0 r < m, then r = a mod m.Easy to see that the only possible values for a mod m for any integer a is 0, 1, , m-1.a -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10a mod 7 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 314

Modulus OperationsFor any integers a and b and positive integer m, if a mod m = b mod m, we say that a is congruent to b modulo m, or a and b are in the same congruence class. We can also write a b mod m.This is equivalent to the fact that m divides a-b. Why?15

Modulus Operationsa a (mod m)If a b (mod m), then b a (mod m)If a b (mod m) and b c (mod m) , then a c (mod m)a b (mod m) iff a + k b + k (mod m)If a b (mod m), then ak bk (mod m)If a b (mod m) and c d (mod m) , then a + c b + d (mod m)

16