euler’s theorem - indiana university...

20
Euler’s Theorem Yan Huang

Upload: others

Post on 23-Jun-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Euler’sTheorem

YanHuang

Page 2: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Objectives

• ExercisesonextendedEuclideanalgorithms

• ExercisesonapplicationsofChineseRemainderTheorem

• Fermat’slittleTheoremandEuler’sTheorem

• Mentalcalculationonmoduloarithmetic

Page 3: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Find𝑥, 𝑦 ∈ ℤ suchthata𝑥 + 𝑏𝑦 = gcd(𝑎, 𝑏) ?

egcd :: Int -> Int -> (Int, Int, Int)

egcd a 1 = (0, 1, 1)

egcd a 0 = (1, 0, a)

egcd a b | a < b = let (x, y, d) = egcd b a in (y, x, d)

| otherwise = let (x, y, d) = egcd b (a `mod` b)

q = a `div` b

in (y, x-y*q, d)

Page 4: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Findintegerx,ysuchthat5*x+7*y=1

egcd :: Int -> Int -> (Int, Int, Int)

egcd a 1 = (0, 1, 1)

egcd a 0 = (1, 0, a)

egcd a b | a < b = let (x, y, d) = egcd b a in (y, x, d)

| otherwise = let (x, y, d) = egcd b (a `mod` b)

q = a `div` b

in (y, x-y*q, d)

Page 5: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Findintegerx,ysuchthat12*x+8*y=4

egcd :: Int -> Int -> (Int, Int, Int)

egcd a 1 = (0, 1, 1)

egcd a 0 = (1, 0, a)

egcd a b | a < b = let (x, y, d) = egcd b a in (y, x, d)

| otherwise = let (x, y, d) = egcd b (a `mod` b)

q = a `div` b

in (y, x-y*q, d)

Page 6: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Findintegerx,ysuchthat27*x+42*y=gcd(27,42)

egcd :: Int -> Int -> (Int, Int, Int)

egcd a 1 = (0, 1, 1)

egcd a 0 = (1, 0, a)

egcd a b | a < b = let (x, y, d) = egcd b a in (y, x, d)

| otherwise = let (x, y, d) = egcd b (a `mod` b)

q = a `div` b

in (y, x-y*q, d)

Page 7: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

ChineseRemainderTheorem

Assume𝑛" and𝑛# arecoprime.Let𝑥 bethesolutiontothefollowingsystemsof

moduloidentities

𝑥 = 𝑎" mod 𝑛"

𝑥 = 𝑎# mod 𝑛#.

Then𝑥 = 𝑋#𝑛#𝑎" + 𝑋"𝑛"𝑎# mod 𝑁,where𝑁 = 𝑛"×𝑛# and𝑋"𝑛" + 𝑋#𝑛# = 1.

Page 8: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Isomorphism

Let𝔾, ℍ begroupswithrespecttotheoperations⋆𝔾 and⋆ℍ.Afunction𝑓: 𝔾 → ℍ isanisomorphismif1. 𝑓 isabijection,and2. Forall𝑔", 𝑔# ∈ 𝔾,𝑓 𝑔" ⋆𝔾 𝑔# = 𝑓 𝑔" ⋆ℍ 𝑓(𝑔#).Ifthereexistsanisomorphismbetween𝔾 andℍ,wesay𝔾 andℍ areisomorphicandwrite𝔾 ≃ ℍ.

Page 9: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

TheIsomorphism

Page 10: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

UsingCRTtoSimplifyModuloComputations

• Calculate3299mod24

Page 11: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

UsingCRTtoSimplifyModuloComputations

• Calculate12345*12345mod35

Page 12: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Recall:ℤ!∗ = ( 1,… , 6 , ∗#$% !)

• Closure

• Identity

• Inverse

• Associativity

Page 13: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Iterativemultiplications

Page 14: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Fermat’sLittleTheorem

If𝑝 isprime,thenforall𝑎 ∈ ℤ$∗

𝑎$'( = 1 mod 𝑝

Page 15: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

• p=7,a=5

Page 16: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

• p=11,a=2

Page 17: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

Euler’sTheorem

If𝑛 and𝑎 arecoprime,then𝑎=(>) = 1 (mod 𝑛)

where𝜙 𝑛 = 𝑛ΠA|>( 1 − "A

) iscalledEuler’stotientfunction.

Page 18: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

𝑛 = 15, 𝑎 = 11

Page 19: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

SomeMagicYoucanPlayNow

• 11"E mod3

Page 20: Euler’s Theorem - Indiana University Bloomingtonhomes.sice.indiana.edu/yh33/Teaching/I231-2016/lectures/lec20.pdf · • Exercises on applications of Chinese Remainder Theorem •

SomeMagicYoucanPlayNow

• 11#F"G mod15