Advanced Algorithms and Complexity: Divisibility and GCD, Lecture notes of Advanced Algorithms

Randomized Advance Algorithms Randomized Advance Algorithms

Typology: Lecture notes

2017/2018

Uploaded on 10/08/2018

nflsblgk
nflsblgk 🇮🇳

4 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Advanced Algorithms and Complexity :
Lecture 20
Divisibility and GCD
September 26, 2018
Divisibility
An integer bis divisible by an integer a6= 0, if xZsuch that b=ax,
and we write this as a|b. In case bis not divisible by a, we write this
as a6 |b.Z= set of integers = {..., 3,2,1,0,1,2,3, ...}. If a|band
0< a < b,then ais called a proper divisor of b.aZ {0}, a|0
ak||b ak|b, ak+1 6 |b,
1. cZ, a|b=a|bc
2. a|band b|c=a|c
3. x, y Z, a|band a|c=a|(bx +cy)
4. a|band b|a=a=±b
5. a|b, a > 0, b > 0 =ab
6. mZ {0}, a|b ma|mb
The Division Algorithm
Give any integers aand b, with a > 0, there exist unique integers qand
rsuch that b=qa +r, 0r < a. If a6 |b, then rsatisfies the stronger
1
pf3
pf4

Partial preview of the text

Download Advanced Algorithms and Complexity: Divisibility and GCD and more Lecture notes Advanced Algorithms in PDF only on Docsity!

Advanced Algorithms and Complexity :

Lecture 20

Divisibility and GCD

September 26, 2018

Divisibility

An integer b is divisible by an integer a 6 = 0, if ∃ x ∈ Z such that b = ax, and we write this as a|b. In case b is not divisible by a, we write this as a 6 |b. Z = set of integers = {..., − 3 , − 2 , − 1 , 0 , 1 , 2 , 3 , ...}. If a|b and 0 < a < b,then a is called a proper divisor of b. ∀a ∈ Z − { 0 }, a| 0 ak||b ⇐⇒ ak|b, ak+1^6 |b,

  1. ∀c ∈ Z, a|b =⇒ a|bc
  2. a|b and b|c =⇒ a|c
  3. ∀x, y ∈ Z, a|b and a|c =⇒ a|(bx + cy)
  4. a|b and b|a =⇒ a = ±b
  5. a|b, a > 0 , b > 0 =⇒ a ≤ b
  6. ∀m ∈ Z − { 0 }, a|b ⇐⇒ ma|mb

The Division Algorithm

Give any integers a and b, with a > 0, there exist unique integers q and r such that b = qa + r, 0 ≤ r < a. If a 6 |b, then r satisfies the stronger

inequalities 0 < r < a. Proof: Let Za,b = {b − qa|q ∈ Z} = {..., b − 2 a, b − a, b, b + a, b + 2a, ...}. Let r be the least non-negative element of Za,b. We should have 0 ≤ r < a, otherwise some other r′^ < r will be the least non negative element of Za,b. Let r = b − qa =⇒ b = q′a + r′^ with 0 ≤ r′^ < r < a. =⇒ qa + r = q′a + r′^ =⇒ (r − r′) = (q′^ − q)a > 0 =⇒ r − r′^ ≥ a =⇒ r ≥ a + r′^ ≥ a, a contradiction. This proves the uniqueness of r and q. r′^ = r =⇒ q′^ = q. a 6 |b and r = 0 =⇒ b = qa =⇒ a|b. Therefore, 0 < r < a.

Greatest Common Divisor (GCD)

An integer a is called a common divisor of b and c if a|b and a|c. Since there is only a finite number of divisors of any non zero integer, there is only a finite number of common divisors of b and c, except in the case when b = c = 0. If at least one of b and c is not 0, the greatest among their common divisors is called the greatest common divisor (GCD) of b and c, and is denoted by (b, c). Similarly, we denote the greatest common divisor g of the integers b 1 , b 2 , ..., bn, not all zero, by (b 1 , b 2 , ..., bn). (b, c) is defined for every pair of integers b, c except for b = c = 0, and we note that (b, c) ≥ 1.

∃x 0 , y 0 ∈ Z such that (b, c) = bx 0 + cy 0

Proof is similar to the proof of the division algorithm. Let Zb,c = {bx + cy | x ∈ Z, y ∈ Z}. Let g be the smallest positive element of Zb,c : g = bx 0 + cy 0. claim: g = (b, c) Proof: Applying the division algorithm (dividing b by g): b = gq + r =⇒ r = b − ga = b − (bx 0 + cy 0 )q = b(1 − qx 0 ) + c(1 − yq 0 ) ∈ Zb,c. 0 ≤ r < g =⇒ r = 0. =⇒ g|b. Similarly, applying the division algorithm (dividing c by g), we get the result that g|c. =⇒ g is a common divisor of b and c. If g is not the gcd, then let g′^ > g be the gcd of b and c. We have : g′|b and g′|c =⇒ g′|(bx 0 + cy 0 ) =⇒ g′|g =⇒ g′^ ≥ g a contradiction. =⇒ g = (b, c).

a 1 , a 2 , ..., an are relatively prime in pairs in case (ai, bj ) = 1 for all i = 1 , 2 , ..., n and j = 1, 2 , ..., n with i 6 = j. The fact that (a, b) = 1 is some- times expressed by saying that a and b are coprime, or by saying that a is prime to b.

∀x ∈ Z, (a, b) = (b, a) = (a, −b) = (a, b + ax)

Proof: (a, b) = minx′,y′∈Z{|ax′^ + by′|} = minx′,y′∈Z{|by′^ + ax′|} = (b, a) (a, b) = minx′,y′∈Z{|ax′^ + by′|} = minx′,y′∈Z{|ax′^ + (−b)(−y′)|} = minx′,y′′∈Z{|ax′^ + (−b)y′′|} = (a, −b) (a, b + ax) = minx′,y′∈Z{|ax′^ + (b + ax)y′|} = minx′,y′∈Z{|a(x′^ + xy′) + by′|} =⇒ (a, b + ax) ≥ (a, b) (a, b) = minx′,y′∈Z{|ax′^ + by′|} = minx′,y′∈Z{|a(x′^ − xy′) + (b + ax)y′|} =⇒ (a, b) ≥ (a, b + ax) =⇒ (a, b) = (a, b + ax)

c|ab, (b, c) = 1 , =⇒ c|a

Proof: bx + cy = 1 =⇒ a = abx + cy c|ab, c|ac =⇒ c|(abx + acy) =⇒ c|a