MATH 470 Lecture 4

From Notes
Jump to navigation Jump to search

« previous | Thursday, January 24, 2013 | next »


Motivation and Math History

How to calculate 217(mod7)?

  1. 4th grade . . .
  2. 8th grade: k = [0..]; remainders = repeat [1, 2, 4]; 217(mod7)=4 by the pattern (when does it repeat?)
  3. College:
    • 21≡2(mod7)
    • 22≡4(mod7)
    • 24≡2(mod7)
    • 28≡2(mod7)
    • 216≡4(mod7)
    • 232≡2(mod7)
    • 217≡216⋅21≡2⋅2≡4(mod7)
  4. Even faster! (secret: 26≡1(mod7) )
    • 217=26⋅2+5≡26⋅26⋅25≡4(mod7)
    • How to find in general for mod n?

Order

Definition: For any prime p, ∀x∈ℤ and p∤x, the order of x in ℤ/pℤ is the minimum positive integer k such that xk≡1(modp).

For example,

  • the order of 2 in ℤ/7ℤ is 3: 23≡1(mod7)
  • the order of 1 in ℤ/7ℤ is 1: 11≡1(mod7)
  • the order of 5 in ℤ/7ℤ is 6: 56≡1(mod7)


Fermat's Little Theorem

(See Fermat's Little Theorem→)


Given any prime p and any integer x,

xp≡x(modp)

This is often written as p∤x, then

xp−1≡1(modp)
Note: p−1 may not be the smallest integer k for xk≡1(modp).
  • 26≡1(mod7)
  • 23≡1(mod7)

Proof

Why is xp−1≡1(modp) when p∤x?

Define modulo classes 1,2,…,p−1.

Multiply by x: x,2x,…,(p−1)x.

  • none are 0
  • No two are the same. (suppose not, then ix≡jx(modp)⟹(i−j)∣p — contradiction)
  • therefore, each will map uniquely to modulo classes

Take prouct of each group: ∏i=1p−1i≡∏i=1p−1x(modp)(p−1)!≡(p−1)!x(modp)1≡x(modp)

We can divide by

(p−1)!

since it is not a multiple of

p

.

Q.E.D.

Corollary 1

For any x such that p∤x, the order of x is a factor of p−1. Why?

Proof. If

p−1=qk+r

and

0<r<k

, then

xr≡(modp)

— contradiction.

Q.E.D.

We know:

  • k is order in xk≡1(modp)
  • xp−1≡1(modp)

Corollary 2

If d and e are integers such that de≡1(modp−1) and p∤x, then xde≡x(modp).

Proof. Rewrite de≡1(modp−1) as de=q(p−1)+1.

xde=xq(p−1)+1

By Fermat's little theorem, xq(p−1)+1≡(xp−1)2x≡x(modp)

Corollary 3

If GCD(d,p−1)=1, then the function f:ℤ/pℤ→ℤ/pℤ defined by f(x)=xd has inverse g(x)=xe.

Application Example

Written on board at beginning of class:

plaintext:  ITWASABOUTELEVENOCLOCKINTHEMORNING
ciphertext: MISGXGZFDILULOLGFEUFEPMJICLQFNJMJR


The code was build by p=29 with function f(x)=x3(mod29).

Correspondence

A B C D . . .  Z
2 3 4 5       27

We omit 0 and 1 since {0,1}3={0,1}. That's not very secure.

For example, we take the first letter 'I' with correspondence 10:

I→10→1000≡14(mod29)→M


How to break coding scheme (x↦x3(mod29)), we need to find "cubic root" mod 29.

Corollary 2 and 3 tell us that for d=3 and p=29, we need to find de≡1(mod28): e=19


Generalization

What about when we replace p by any integer n?

For example, "What is the last digit of 317?" is another way of asking "3^{17} \equiv \Box \pmod{10}"

Can we find a number k such that 3k≡1(mod10)? YES

For any integer n, we define (ℤ/nℤ)* to be the set of all integers k in {1,2,…,n−1} with GCD(k,n)=1.

Examples:

  • n=5: (ℤ/5ℤ)*={1,2,3,4}
  • n=6: (ℤ/6ℤ)*={1,5}
  • n=9: (ℤ/9ℤ)*={1,2,4,5,7,8}
  • n=12: (ℤ/12ℤ)*={1,5,7,11}


Euler's Totient Function

Let ϕ(n)=number of integers in (ℤ/nℤ)*

From previous examples,

  • ϕ(5)=4
  • ϕ(6)=2
  • ϕ(9)=6
  • ϕ(12)=4

In particular, ϕ(p)=p−1

Computation

How to compute ϕ(n)?

Basic fact: ϕ(p)=p−1

ϕ(pn)=pn−pn−1=pn−1(p−1)

since there are pn−1 multiples of p between 0 and pn.

Properties: ϕ(mn)=ϕ(m)ϕ(n)

Take the product of the totients of the prime factorization of the number

Example

100=22⋅52

ϕ(100)=ϕ(22)ϕ(52)=(22−21)(52−51)


Euler's Theorem

For any integers n, x such thta GCD(x,n)=1,

xϕ(n)≡1(modn)


Example

What are the last two digits of 34081? (34081≡◻(mod100))

Let n=100, then ϕ(100)=40.

Therefore 34081=(340)◻⋅31≡3(mod100)

And the last two digits are "03"