Download - Chapter 8 Introduction to Number Theory. 2 Contents Prime Numbers Fermats and Eulers Theorems
Chapter 8 Introduction to Number Theory
2
Contents
Prime Numbers
Fermat’s and Euler’s Theorems
3
Prime Numbers
Primes numbers An integer p > 1 is a prime number if and only if it is divisible by only
1 and p.
4
Prime Numbers
Integer factorization
Any integer a > 1 can be factored in a unique way as
where p1 < p2 < … < pt are prime numbers and
each ai is a positive integer.
tat
aaa ppppa ...321321
91 = 7 × 13;11101 = 7 × 112 ×13
5
Prime Numbers
Another integer factorization If P is the set of all prime numbers, then any positive integer can be w
ritten uniquely in the following form:
The right side is the product over all possible prime numbers p. Most of the exponents ap will be 0.
0each whereP
pp
a apa p
3600 = 24×32×52×70×110×….
6
Prime Numbers
Another integer factorization The value of any given positive integer can be specified by listing all
the nonzero exponents.
The integer 12 =22×31 is represented by {a2=2, a3=1}.The integer 18 =21×32 is represented by {a2=1, a3=2}.The integer 91= 72×131 is represented by {a7= 2, a13= 1}.
7
Prime Numbers
Multiplication Multiplication of two numbers is adding the corresponding exponents.
k = 12 × 18 = 216
12 = 22 × 31
18 = 21 × 32
------------------216 = 23 × 33
8
Prime Numbers
Divisibility
a|b → ap ≤ bp for all p
a = 12; b= 36; 12|36
12 = 22×3;36 = 22×32
a2 = 2 = b2
a3 = 1 ≤ 2 = b3
9
Prime Numbers
GCD
k = gcd (a, b) → kp = min(ap, bp) for all p
300 = 22×31×52
18 = 21×32×50
gcd (18, 300) = 21×31×50 = 6
10
Fermat’s and Euler’s Theorems
Fermat’s theorem If p is prime and a is a positive integer not divisible by p,
then
ap-1 ≡ 1 (mod p)
11
Fermat’s and Euler’s Theorems
Proof of Fermat’s theorem. Outline
Show {1, 2, …, p-1}={a mod p, 2a mod p, …, (p-1)a mod p}
Show .
Since is relatively prime to p, we multiply
to both sides to get .
papp p mod)!1()!1( 1
)!1( p -1)!1( p
pa p mod1 1
12
Fermat’s and Euler’s Theorems
Proof of Fermat’s theorem Show {1, 2, …, p-1}={a mod p, 2a mod p, …, (p-1)a mod p}
Show ka mod p for any 1 ≤ k ≤ p-1 is in {1, 2, …, p-1}
by showing that ka mod p ≠ k’a mod p for k≠ k’.
Show ka mod p ≠ k’a mod p for 1 ≤ k≠ k’ ≤ p-1. Proof by contradiction Assume that ka ≡ k’a mod p for some 1 ≤ k≠ k’ ≤ p-1. Since a is relatively prime to p, we multiply a-1 to get k ≡ k’ mod p,
which contradiction the fact that k≠ k’.
13
Fermat’s and Euler’s Theorems
Proof of Fermat’s theorem Show .
{1, 2, …, p-1} = {a mod p, 2a mod p, …, (p-1)a mod p}
ppap p mod)!1()!1( 1
pa
papp
papaap...
ppappapap...
p
p
mod1
mod)!1()!1(
mod ])1(...2[)]1(21[
mod )]mod)1((...)mod2()mod[()]1(21[
1
1
14
Fermat’s and Euler’s Theorems
An alternative form of Fermat’s Theorem
ap ≡ a mod p
where p is prime and a is any positive integer.
Proof If a and p are relatively prime, we get ap ≡ a mod p by multi
plying a to each side of ap-1 ≡ 1 mod p.
If a and p are not relatively prime, a = cp for some positive integer c. So ap ≡ (cp)p ≡ 0 mod p and a ≡ 0 mod p, which means ap ≡ a mod p.
15
Fermat’s and Euler’s Theorems
An alternative form of Fermat’s Theorem
ap ≡ a mod p
where p is prime and a is any positive integer.
p = 5, a = 3 35 = 243 ≡ 3 mod 5
p = 5, a = 10 105 = 100000 ≡ 10 mod 5 ≡ 0 mod 5
16
Fermat’s and Euler’s Theorems
Euler’s Totient Function The number of positive integers less than n and relatively prime to n.
)(n
= 3637 is prime, so all the positive number from 1 to 36are relatively prime to 37.
= 2435 = 5×71, 2, 3, 4, 6, 8, 9,11, 12, 13, 16, 17, 18, 19, 22, 23, 24, 26, 27, 29, 31, 32, 33, 34
)37(
)35(
17
Fermat’s and Euler’s Theorems
How to compute In general,
For a prime n, (Zn = {1,2,…, n-1})
For n = pq, p and q are prime numbers and p≠ q
)(n
1)( nn
)1()1()( qpn
npp
nn dividing primes theallover runs where,)1
1()(
18
Fermat’s and Euler’s Theorems
Proof of
is the number of positive integers less than pq that are relatively prime to pq.
can be computed by subtract from pq – 1 the number of positive integers in {1, …, pq – 1} that are not relatively prime to pq.
The positive integers that are not relatively prime to pq are a multiple of either p or q. { p, 2p,…,(q – 1)p}, {q, 2q, …,(p – 1)q} There is no same elements in the two sets. So, there are p + q – 2 elements that are not relatively prime to pq.
Hence, = pq – 1– (p + q – 2) = pq – p – q +1 = (p – 1)(q – 1)
)(n
)1()1()( qpn
)(n
)(n
19
Fermat’s and Euler’s Theorems
Φ(21) = Φ(3)×Φ(7) = (3-1)×(7-1) = 2 ×6 = 12
Z21={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}Φ(3)={3,6,9,12,15,18}Φ(7)={7,14}
where the 12 integers are {1,2,4,5,8,10,11,13,16,17,19,20}
20
Fermat’s and Euler’s Theorems
Euler’s theorem For every a and n that are relatively prime:
na n mod1)(
a = 3; n = 10; Φ(10) = 4; 34 = 81 ≡ 1 mod 10a = 2; n = 11; Φ(11) = 10; 210 = 1024 ≡ 1 mod 11
21
Fermat’s and Euler’s Theorems
Proof of Euler’s theorem
If n is prime, it holds due to Fermat’s theorem.
Otherwise (If n is not prime), define two sets R and S. show the sets R and S are the same. then, show
na n mod1)(
nan mod11
na n mod1)(
22
Fermat’s and Euler’s Theorems
Proof of Euler’s theorem
Set R The elements are positive integers less than n and relatively prime to n. The number of elements is
R={x1, x2,…, xΦ(n)} where x1< x2<…< xΦ(n)
Set S Multiplying each element of R by a∈R modulo n S ={(ax1 mod n), (ax2 mod n),…(axΦ(n) mod n)}.
)(n
23
Fermat’s and Euler’s Theorems
Proof of Euler’s theorem
The sets R and S are the same. We show S has all integers less than n and relatively prime to n.
S ={(ax1 mod n), (ax2 mod n),…(axΦ(n) mod n)}
1. All the elements of S are integers less than n that are relatively prime to n because a is relatively prime to n and xi is relatively prime to n, axi must also be relatively prime to n.
2. There are no duplicates in S.If axi mod n = axj mod n, then xi = xj. by cancellation law.
24
Fermat’s and Euler’s Theorems
Proof of Euler’s theorem Since R and S are the same sets,
)(mod1
)(mod
)(mod
)mod(
)(
)(
1
)(
1
)(
)(
1
)(
1
)(
1
)(
1
na
nxxa
nxax
xnax
n
n
ii
n
ii
n
n
i
n
iii
n
i
n
iii
25
Fermat’s and Euler’s Theorems
Alternative form of the theorem
If a and n are relatively prime, it is true due to Euler’s theorem.
Otherwise, ….
)(mod1)( naa n
26
Fermat’s and Euler’s Theorem
The validity of RSA algorithm Given 2 prime numbers p and q, and integers n = pq and m,
with 0<m<n, the following relationship holds.
If m and n are re relatively prime, it holds by Euler’s theorem. If m and n are not relatively prime, m is a multiple of either p or q.
nmmm qpn mod1)1)(1(1)(
27
Fermat’s and Euler’s Theorem
Case 1: m is a multiple of p m=cp for some positive integer c. gcd(m, q)=1, otherwise, m is a multiple of p and q and yet m<pq because gcd(m, q)=1, Euler’s theorem holds
by the rules of modular arithmetic,
Multiplying each side by m=cp
qmq mod11
kkqm
qm
qm
n
n
pq
integer somefor ,1
mod1
mod1][
)(
)(
11
nmm
kcnmkcpqmmn
n
mod1)(
1)(
28
Fermat’s and Euler’s Theorem
Case 2: m is a multiple of q prove similarly.
Thus, the following equation is proved.
nmmm qpn mod1)1)(1(1)(
29
Fermat’s and Euler’s Theorem
An alternative form of this corollary is directly relevant to RSA.
nm
nm
nmm
m
k
kn
nk
mod
theoremsEuler'by ,mod])1[(
mod][( 1)(
1)(