Divisibility and Modular Arithmetic - Discrete Mathematics - Lecture Slides, Slides of Discrete Mathematics

During the study of discrete mathematics, I found this course very informative and applicable.The main points in these lecture slides are:Divisibility and Modular Arithmetic, Number Theory, Integers and Their Properties, Branch of Mathematics, Positive Integers, Theorem and Corollary, Division Algorithm, Unique Integers, Congruent Modulo

Typology: Slides

2012/2013

Uploaded on 04/27/2013

aslesha
aslesha 🇮🇳

4.4

(14)

160 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE115/ENGR160 Discrete Mathematics
03/13/12
1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Divisibility and Modular Arithmetic - Discrete Mathematics - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

CSE115/ENGR160 Discrete Mathematics 03/13/

4.1 Divisibility and modular arithmetic

  • Number theory : the branch of mathematics involves integers and their properties
  • If a and b are integers with a≠0, we say that a divides b if there is an integer c s.t. b=ac
  • When a divides b we say that a is a factor of b and that b is a multiple of a
  • The notation a | b denotes a divides b. We write a ∤ b when does not divide b

Theorem and corollary

  • Theorem: Let a, b, and c be integers, then
    • If a | b and a| c, then a | (b+c)
    • If a | b, and a | bc for all integers c
    • If a | b and b | c, then a | c
  • Corollary: If a, b, and c are integers s.t. a | b and a | c, then a | mb+nc whenever m and n are integers

The division algorithm

  • Let a be integer and d be a positive integer. Then there are unique integers q and r with 0 ≤ r < d, s.t. a=dq+r
  • In the equality, q is the quotient, r is the remainder

q = a div d, r = a mod d

  • -11 divided by 3
    • 11=3(-4)+1, -4=-11 div 3, 1=-11 mod 3
    • 11=3(-3)-2, but remainder cannot be negative

Example

  • Determine whether 17 is congruent to 5 modulo 6, and whether 24 and 14 are not congruent modulo 6 - 17-5=12, we see 17≡5 (mod 6) - 24-14=10, and thus 24≢14 (mod 6)

Theorem

  • Karl Friedrich Gauss developed the concept of congruences at the end of 18 th^ century
  • Let m be a positive integer. The integer a and b are congruent modulo m if and only if there is an integer k such that a=b+km - () If a=b+km, then km=a-b, and thus m divides a-b and so a≡b (mod m) - () if a≡b (mod m), then m | a-b. Thus, a-b=km, and so a=b+km

Example

  • 7 ≡ 2 (mod 5) and 11 ≡ 1 (mod 5), so
    • 18=7+11 ≡ 2+1=3 (mod 5)
    • 77=7∙11 ≡2∙1=2(mod 5)

Corollary

  • Let m be a positive integer and let a and b be integers, then (a+b) mod m=((a mod m) +(b mod m)) mod m ab mod m = ((a mod m)(b mod m)) mod m
  • Proof: By definitions mod m and congruence modulo m, we know that a≡(a mod m)(mod m) and b≡(b mod m)(mod m). Hence - (a+b) ≡((a mod m)+(b mod m)) (mod m) - ab ≡ (a mod m)(b mod m)(mod m)

Base conversion

  • Constructing the base b expansion

n=bq 0 +a 0 , 0 ≤a 0 <b

  • The remainder a 0 , is the rightmost digit in the base b expansion of n
  • Next, divide q 0 by b to obtain

q 0 =bq 1 +a 1 , 0≤a 1 <b

  • We see a 1 is the second digit from the right in the base b expansion of n
  • Continue this process, successively dividing the quotients by b, until the quotient is zero

Example

Example

  • To compute 3^11
  • 11=(1011) 2 ,So 3^11 =3^8 32 31. First compute 32 =9, and then 3^4 =9^2 =81, and 38 =(3^4 )^2 =(81)^2 =6561, So 311 =656193=
  • The algorithm successively finds b mod m, b^2 mod m, b^4 mod m, …, mod m, and multiply together those terms

16

b^2 k −^1

Algorithm

  • procedure modular exponentiation ( b:integer, n=(a (^) k-1a (^) k-2a 1 a 0 , …, a (^) n ) 2 , m:positive integer) x := 1 power:=b mod m for i:=0 to k- if a (^) i =1 then x:=(x⋅ power) mod m power:=(power⋅power) mod m end {x equals bn^ mod m}
  • It uses O((log m)^2 long n) bit operations

4.3 Primes and greatest common

divisions

  • Prime : a positive integer p greater than 1 if the only positive factors of p are 1 and p
  • A positive integer greater than 1 that is not prime is called composite
  • Fundamental theorem of arithmetic : Every positive integer greater than 1 can be written uniquely as a prime or as the product of two or more primes when the prime factors are written in order of non-decreasing size

Example

  • Prime factorizations of integers
    • 100=2∙2∙5∙5=2^2 ∙5^2
    • 641=
    • 999=3∙3∙3∙37=3 3 ∙
    • 1024=2∙2∙2∙2∙2∙2∙2∙2∙2∙2=2 10