Announcements: - PowerPoint PPT Presentation

About This Presentation
Title:

Announcements:

Description:

Euclid's algorithm. Congruences if time. DTTF/NB479: Dszquphsbqiz Day 9. Basics 1: Divisibility ... is the last non-zero remainder found via Euclid. ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 10
Provided by: roseh9
Category:

less

Transcript and Presenter's Notes

Title: Announcements:


1
DTTF/NB479 Dszquphsbqiz Day 9
  • Announcements
  • Homework 1 returned. Comments from Kevin?
  • Matlab tutorial available at http//www.math.ufl
    .edu/help/matlab-tutorial/
  • Homework 2 due Tuesday
  • Quiz this Friday on concepts from chapter 2
    (tentative)
  • Practical quiz next week on breaking codes from
    chapter 2
  • Questions?
  • Today
  • Euclids algorithm
  • Congruences if time

2
Basics 1 Divisibility
Definition
Property 1
Property 2 (transitive)
Property 3 (linear combinations)
3
Basics 2 Primes
  • Any integer p gt 1 divisible by only p and 1.
  • How many are there?
  • Prime number theorem
  • Let p(x) be the number of primes less than x.
  • Then
  • Application how many 319-digit primes are there?
  • Every positive integer is a unique product of
    primes.

4
Basics 3. GCD
  • gcd(a,b)maxj (ja and jb).
  • Def. a and b are relatively prime iff gcd(a,b)1
  • gcd(14,21) easy
  • What about gcd(1856, 5862)?
  • gcd(500267500347832384769, 12092834543475893256574
    665)?
  • Do you really want to factor each one?
  • Whats our alternative?

5
Euclids Algorithm
  • gcd(a,b)
  • if (a lt b) swap (a,b)
  • // a gt b
  • r a b
  • while (r 0)
  • a b
  • b r
  • r a b
  • gcd b // last r 0
  • Calculate gcd(1856, 5862)
  • 2

6
Euclids Algorithm
Assume a gt b Let qi and ri be the series of
quotients and remainders, respectively, found
along the way. a q1b r1 b q2r1 r2 r1
q3r2 r3 ... ri-2 qiri-1 ri rk-2 qkrk-1
rk rk-1 qk1rk
  • gcd(a,b)
  • if (a gt b) swap (a,b)
  • // a gt b
  • r a b
  • while (r 0)
  • a b
  • b r
  • r a b
  • gcd b // last r 0

rk is gcd(a,b)
Youll prove this computes the gcd in Homework 3
(by induction)
7
Fundamental result If d gcd(a,b) then ax by
d
  • For some integers x and y.
  • These ints are just a by-product of the Euclidean
    algorithm!
  • Allows us to find a-1 (mod n) very quickly
  • Choose b n and d 1.
  • If gcd(a,n) 1, then ax ny 1
  • ax 1 (mod n) because it differs from 1 by a
    multiple of n
  • Therefore, x a-1 (mod n).
  • Why does this work?
  • How do we find x and y?

8
Why does this work?
Assume a gt b Let qi and ri be the series of
quotients and remainders, respectively, found
along the way. a q1b r1 b q2r1 r2 r1
q3r2 r3 ... ri-2 qiri-1 ri rk-2 qkrk-1
rk rk-1 qk1rk
  • Given a,b ints, not both 0, and gcd(a,b) d.
  • Prove ax by d
  • Recall gcd(a,b,)d rk is the last non-zero
    remainder found via Euclid.
  • Well show the property true for all remainders
    rj (by strong induction)

9
How to find x and y?
x and y swapped from book, which assumes that a lt
b on p. 69
Assume a gt b Let qi and ri be the series of
quotients and remainders, respectively, found
along the way. a q1b r1 b q2r1 r2 r1
q3r2 r3 ... ri-2 qiri-1 ri rk-2 qkrk-1
rk rk-1 qk1rk
  • To find x, take
  • x0 1, x1 0,
  • xj xj-2 qj-1xj-1
  • To find y, take
  • y0 0, y1 1,
  • yj yj-2 qj-1yj-1
  • Use to calculate xk and yk (the desired result)
  • Example
  • gcd(5862,1856)2
  • Yields x -101, y 319

Check 5862(-101) 1856(319) 2?
Write a Comment
User Comments (0)
About PowerShow.com