Euler’s Theorem - Indiana University...

Post on 23-Jun-2020

6 views 0 download

Transcript of Euler’s Theorem - Indiana University...

Euler’sTheorem

YanHuang

Objectives

• ExercisesonextendedEuclideanalgorithms

• ExercisesonapplicationsofChineseRemainderTheorem

• Fermat’slittleTheoremandEuler’sTheorem

• Mentalcalculationonmoduloarithmetic

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)

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)

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)

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)

ChineseRemainderTheorem

Assume𝑛" and𝑛# arecoprime.Let𝑥 bethesolutiontothefollowingsystemsof

moduloidentities

𝑥 = 𝑎" mod 𝑛"

𝑥 = 𝑎# mod 𝑛#.

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

Isomorphism

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

TheIsomorphism

UsingCRTtoSimplifyModuloComputations

• Calculate3299mod24

UsingCRTtoSimplifyModuloComputations

• Calculate12345*12345mod35

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

• Closure

• Identity

• Inverse

• Associativity

Iterativemultiplications

Fermat’sLittleTheorem

If𝑝 isprime,thenforall𝑎 ∈ ℤ$∗

𝑎$'( = 1 mod 𝑝

• p=7,a=5

• p=11,a=2

Euler’sTheorem

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

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

) iscalledEuler’stotientfunction.

𝑛 = 15, 𝑎 = 11

SomeMagicYoucanPlayNow

• 11"E mod3

SomeMagicYoucanPlayNow

• 11#F"G mod15