0% found this document useful (0 votes)
11 views28 pages

Unit 4 Number Theory - PHT - V.1

Uploaded by

abc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views28 pages

Unit 4 Number Theory - PHT - V.1

Uploaded by

abc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

By Purvi Tandel

Modular arithmetic

Prime and relative prime numbers

Euler’s Theorem

Euclidean algorithm

Finite field of the form GF(p)

Polynomial arithmetic

Finite field of the form GF(2n)


Purvi Tandel, CE & IT Dept., CGPIT 2 2/18/2019
Modular arithmetic

Prime and relative prime numbers

Euler’s Theorem

Euclidean algorithm

Finite field of the form GF(p)

Polynomial arithmetic

Finite field of the form GF(2n)


Purvi Tandel, CE & IT Dept., CGPIT 3 2/18/2019
Classical math problem:
Samantha says she will be home by 10:00, and she’s 13 hours late,
what time does she get home?

(10+13) mod 12 = 23 mod 12 = 11 mod 12 = 11

Another way of writing the same is:


23 ≡ 11 (mod 12)

Typical solution:
10:00 AM suppose to reach home (add 13 hours)
11:00 PM she will reach home
Purvi Tandel, CE & IT Dept., CGPIT 4 2/18/2019
23 ≡ 11 (mod 12) (here ≡ denotes congruence)

Basically, a ≡ b (mod n) if a = b + kn for some integer k.


Where, a is non negative and b is between 0 to n.
Sometimes, b is reminder of a when divided by n.

Sometimes, b is called the residue of a, modulo n.

Sometimes, a is called Congruent to b, modulo n.

Purvi Tandel, CE & IT Dept., CGPIT 5 2/18/2019


Some examples of a = b + kn:
For a = 11, n = 7,
11 = 1 * 7 + 4; Residue b = 4, k =1.
For a = -11, n = 7,
-11 = -2 * 7 + 3; Residue b = 3, k = -2.
73 ≡ 4 (mod 23)
73 = 3 * 23 + 4; Residue b = 4, k = 3.
 21 ≡ -9 (mod 10)
21 = 3 * 10 + (-9); Residue b = -9, k = 3.
 21 ≡ 1 (mod 10)
21 = 2 * 10 + 1; Residue b = 1, k = 2.

Purvi Tandel, CE & IT Dept., CGPIT 6 2/18/2019


Properties of Congruence:
1. a ≡ b (mod n) if n|(a-b).
2. a ≡ b (mod n) implies b ≡ a (mod n).
3. a ≡ b (mod n) and b ≡ c (mod n) imply a ≡ c (mod n).

To demonstrate first point if n|(a-b), then (a-b) = kn for some k.


23 ≡ 8 (mod 5) because 23 – 8 = 15 = 5 * 3
-11 ≡ 5 (mod 8) because - 11 – 5 = -16 = 8 * (-2)
81 ≡ 0 (mod 27) because 81 – 0 = 81 = 27 * 3

Purvi Tandel, CE & IT Dept., CGPIT 7 2/18/2019


Modular Arithmetic operations:
1. (a + b) mod n = ((a mod n) + (b mod n)) mod n
2. (a - b) mod n = ((a mod n) - (b mod n)) mod n
3. (a * b) mod n = ((a mod n) * (b mod n)) mod n

Now calculating the power of some number modulo some number,


ax mod n,
is just a series of multiplications and divisions, but there are speedups.

Speedup aims minimize the number of multiplications.

Purvi Tandel, CE & IT Dept., CGPIT 8 2/18/2019


a8 mod n = (a*a*a*a*a*a*a*a) mod n

Speedup aims minimize the number of multiplications.


How???
To find 117 mod 13, we can proceed as follows:
112 mod 13 = 121 mod 13 = 4 (mod13) = 4 (Because 13*9 + 4 )
114 mod 13 = (112 mod 13)2 mod 13 = (4)2 mod 13 = 16 mod 13 = 3
(mod 13) = 3
117 mod 13 = (114 mod 13 * 112mod 13 * 11 mod 13) mod 13 =
(3*4*11) mod 13 = 132 mod 13 = 2 (mod 13) = 2 (Because 13*10 + 2)
So, 117 mod 13 = 2.
Purvi Tandel, CE & IT Dept., CGPIT 9 2/18/2019
In modular arithmetic mod 8, the additive inverse of x is the integer y
such that (x + y ) mod 8 = 0 mod 8.

Purvi Tandel, CE & IT Dept., CGPIT 10 2/18/2019


In modular arithmetic mod 8, the multiplicative inverse of x is the
integer y such that (x * y ) mod 8 = 1 mod 8.

Purvi Tandel, CE & IT Dept., CGPIT 11 2/18/2019


Purvi Tandel, CE & IT Dept., CGPIT 12 2/18/2019
Define the set Zn as the set of nonnegative integers less than n:
Zn = { 0 , 1 , . . . . . . . . , (n-1)}

In ordinary arithmetic, the following statement is true only with the


attached condition:
if (a x b) = (a x c) (mod n) then b = c (mod n) if a is relatively prime
to n

In general, an integer has a multiplicative inverse in Zn if that integer


is relatively prime to n.

Table shows that the integers 1, 3, 5, and 7 have a multiplicative


inverse in Z8, but 2, 4, and 6 do not.

Purvi Tandel, CE & IT Dept., CGPIT 13 2/18/2019


Modular arithmetic

Prime and relative prime numbers

Euler’s Theorem

Euclidean algorithm

Finite field of the form GF(p)

Polynomial arithmetic

Finite field of the form GF(2n)


Purvi Tandel, CE & IT Dept., CGPIT 14 2/18/2019
An integer p>1 is a prime number if and only if its only divisors are
± 1 and ± p.

Any integer a > 1 can be factored in a unique way as


a = p1a1*p2a2…ptat
Where p1 < p2 < ….. < pt are prime numbers and where each ai is a
positive integer.

Examples:
91 = 7 * 13
3600 = 24 * 32 * 52
11011 = 7 * 112 * 13
Purvi Tandel, CE & IT Dept., CGPIT 15 2/18/2019
If P is the set of all prime numbers, then any positive integer a can
be written uniquely in the following form:

a= 𝑝є𝑃 𝑝𝑎𝑝 where each ap ≥ 0

If gcd ( p , q ) = 1 then, p & q both are relative prime numbers to


each other.
Examples:
1. p = 3, q = 5 then gcd ( 3 , 5 ) = 1 (Both Prime numbers)
2. p = 7, q = 13 then gcd ( 7 , 13 ) = 1 (Both Prime numbers)
3. p = 31, q = 84 then gcd ( 31 , 84 ) =1 (Both are not Prime
numbers)
Purvi Tandel, CE & IT Dept., CGPIT 16 2/18/2019
Note:
All prime numbers are relative to each other.
Non prime number also can be relative to each other.

Purvi Tandel, CE & IT Dept., CGPIT 17 2/18/2019


Modular arithmetic

Prime and relative prime numbers

Euler’s Theorem

Euclidean algorithm

Finite field of the form GF(p)

Polynomial arithmetic

Finite field of the form GF(2n)


Purvi Tandel, CE & IT Dept., CGPIT 18 2/18/2019
Euler’s theorem states that for every a and n that are relatively
prime:
aø(n) ≡ 1 (mod n)
Examples:
a=3; n=10; ø(10)=4;
hence 34 = 81 = 1 mod 10
 a=2; n=11; ø(11)=10;
hence 210 = 1024 = 1 mod 11

Alternative form of the theorem is:


aø(n)+1 ≡ a (mod n)

Purvi Tandel, CE & IT Dept., CGPIT 19 2/18/2019


Euler’s Totient function:
Euler’s totient function, written as ∅(n), defined as the number of
positive integers less than n and relatively prime to n.

If n is prime number, then ∅(n) = (n - 1).


Example: n = 37 (prime number)
So all the positive integers from 1 through 36 are relatively prime to
37.
∅(n) = (n – 1) = 36 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ………, 36}

Purvi Tandel, CE & IT Dept., CGPIT 20 2/18/2019


If n is non-prime number, and whose factors are two prime
numbers p and q, with p ≠ q, then
∅(n) = ∅(pq) = ∅(p) * ∅(q) = (p – 1) * (q – 1).

Example: n = 35 (Non-prime number)


n = 35 = 7 * 5 (factors of 35, both prime and p ≠ q)
∅(35) = (p – 1) * (q – 1) = ( 7 – 1) * (5 – 1) = 6 * 4 = 24
∅(35) = { 1, 2, 3, 4, 6, 8, 9, 11, 12, 13, 16, 17, 18, 19, 22, 23, 24, 26, 27,
29, 31, 32, 33, 34}

Purvi Tandel, CE & IT Dept., CGPIT 21 2/18/2019


Modular arithmetic

Prime and relative prime numbers

Euler’s Theorem

Euclidean algorithm

Finite field of the form GF(p)

Polynomial arithmetic

Finite field of the form GF(2n)


Purvi Tandel, CE & IT Dept., CGPIT 22 2/18/2019
One of the basic techniques of number theory is the Euclidean
algorithm,
which is a simple procedure for determining the greatest
common divisor of two positive integers.

Use the notation GCD(a , b) which is the greatest common


divisor of a and b.
Example:
GCD(60,24) = 12
GCD(8,15) = 1 , hence 8 & 15 are relatively prime

Purvi Tandel, CE & IT Dept., CGPIT 23 2/18/2019


Finding the Greatest Common Divisor:
The Euclidean algorithm is based on the following theorem:
For any nonnegative integer a and any positive integer b,

GCD (a, b) = GCD (b, a mod b)


Example:
GCD(55, 22) = GCD(22, 55 mod 22) = GCD(22, 11) = 11
GCD (18, 12) = GCD(12, 18 mod 12) = GCD(12, 6) = 6

Purvi Tandel, CE & IT Dept., CGPIT 24 2/18/2019


The algorithm has following progression:

Purvi Tandel, CE & IT Dept., CGPIT 25 2/18/2019


Example GCD(1970, 1066) = 2
1970 = 1 x 1066 + 904 gcd(1066, 904)
1066 = 1 x 904 + 162 gcd(904, 162)
904 = 5 x 162 + 94 gcd(162, 94)
162 = 1 x 94 + 68 gcd(94, 68)
94 = 1 x 68 + 26 gcd(68, 26)
68 = 2 x 26 + 16 gcd(26, 16)
26 = 1 x 16 + 10 gcd(16, 10)
16 = 1 x 10 + 6 gcd(10, 6)
10 = 1 x 6 + 4 gcd(6, 4)
6=1x4+2 gcd(4, 2)
4=2x2+0 gcd(2, 0)
Purvi Tandel, CE & IT Dept., CGPIT 26 2/18/2019
Example GCD(1160718174, 316258250) = 1078

Dividend Divisor Quotient Remainder


a = 1160718174 b = 316258250 q1 = 3 r1 = 211943424
b = 316258250 r1 = 211943424 q2 = 1 r2 = 104314826
r1 = 211943424 r2 = 104314826 q3 = 2 r3 = 3313772
r2 = 104314826 r3 = 3313772 q4 = 31 r4 = 1587894
r3 = 3313772 r4 = 1587894 q5 = 2 r5 = 137984
r4 = 1587894 r5 = 137984 q6 = 11 r6 = 70070
r5 = 137984 r6 = 70070 q7 = 1 r7 = 67914
r6 = 70070 r7 = 67914 q8 = 1 r8 = 2516
r7 = 67914 r8 = 2516 q9 = 31 r9 = 1078
r8 = 2516 r9 = 1078 q10 = 2 r10 = 0

Purvi Tandel, CE & IT Dept., CGPIT 27 2/18/2019


Modular arithmetic

Prime and relative prime numbers

Euler’s Theorem

Euclidean algorithm

Finite field of the form GF(p)

Polynomial arithmetic

Finite field of the form GF(2n)


Purvi Tandel, CE & IT Dept., CGPIT 28 2/18/2019

You might also like