0% found this document useful (0 votes)
34 views21 pages

Number Theory 1

The document covers key concepts in number theory, including Bézout's theorem, linear congruences, the Chinese remainder theorem, and Fermat's little theorem. It also discusses applications in cryptography, such as Caesar's cipher and block ciphers, providing examples and solutions for each concept. Additionally, it introduces pseudorandom number generation methods and their relevance in simulations.

Uploaded by

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

Number Theory 1

The document covers key concepts in number theory, including Bézout's theorem, linear congruences, the Chinese remainder theorem, and Fermat's little theorem. It also discusses applications in cryptography, such as Caesar's cipher and block ciphers, providing examples and solutions for each concept. Additionally, it introduces pseudorandom number generation methods and their relevance in simulations.

Uploaded by

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

Number Theory

BÉZOUT’S THEOREM:
If a and b are positive integers, then there exist integers s and t
such that gcd(a,b)=sa+tb.

gcd(a, b) can be expressed as a linear combination with


integer coefficients of a and b.
For example, gcd(6, 14) = 2, and 2 = (−2) · 6 + 1 · 14

Example:
Express gcd(252, 198) = 18 as a linear combination of 252 and
198.

Solution: To show that gcd(252, 198) = 18, the Euclidean


algorithm uses these divisions:
252 = 1 · 198 + 54
198 = 3 · 54 + 36
54 = 1 · 36 + 18
36 = 2 · 18.
Using the next-to-last division (the third division), we can
express gcd(252, 198) = 18 as a linear combination of 54 and
36.
18 = 54 − 1 · 36.

The second division tells us that


36 = 198 − 3 · 54.

Substituting this expression for 36 into the previous equation,


we can express 18 as a linear combination of 54 and 198.We
have
18 = 54 − 1 · 36
= 54 − 1 · (198 − 3 · 54)
= 4 · 54 − 1 · 198.

The first division tells us that


54 = 252 − 1 · 198
Substituting this expression for 54 into the
previous equation, we can express 18 as a
linear combination of 252 and 198.
We conclude that
18 = 4 · (252 − 1 · 198) − 1 · 198
= 4 · 252 − 5 · 198.
Linear Congruences:
A congruence of the form ax ≡ b(mod m),where m
is a positive integer, a and b are integers, and x is
a variable, is called a linear congruence.

Inverse of modulo m:
An integer a’ such that aa’ ≡ 1 (mod m), is said to
be an inverse of a modulo m.
Theorem:
If a and m are relatively prime integers and m> 1,
then an inverse of a modulo m exists.
Furthermore, this inverse is unique modulo m.
Example:
Find an inverse of 3 modulo 7 by first finding
Bézout coefficients of 3 and 7.
Solution:
Because gcd(3, 7) = 1, therefore an inverse of 3
modulo 7 exists. Applying the the Euclidean
algorithm to find the greatest common divisor of 3
and 7:
7=2·3+1 or
−2 · 3 + 1 · 7 = 1
This shows that −2 and 1 are Bézout coefficients of
3 and 7.
Therefore−2 is an inverse of 3 modulo 7.
Note that every integer congruent to −2 modulo 7
is also an inverse of 3, such as 5.
Example:
What are the solutions of the linear congruence
3x ≡ 4 (mod 7)?

Solution: Since −2 is an inverse of 3 modulo 7,


Multiplying both sides of the congruence by −2
shows that
−2 · 3x ≡ −2 · 4 (mod 7)

Because −6 ≡ 1 (mod 7) and −8 ≡ 6 (mod 7), it


follows that if x is a solution, then
x ≡−8 ≡6 (mod 7).
We need to determine whether every x with
x ≡ 6 (mod 7) is a solution.
Assume that x ≡ 6 (mod 7).
Then it follows that 3x ≡ 3 · 6
18 ≡ 4 (mod 7),
which shows that all such x satisfy the
congruence.
Therefore, the solutions to the congruence are
the integers x such that x ≡ 6 (mod 7), namely,
6, 13, 20,... and −1, −8,−15,....
THE CHINESE REMAINDER THEOREM
Let m1,m2,...,mn be pairwise relatively prime
positive integers greater than one and a1,a2,...,an
arbitrary integers. Then the system
x ≡ a1 (mod m1),
x ≡ a2 (mod m2),
·
·
·
x ≡ an (mod mn)
has a unique solution modulo m = m1m2 ···mn.
That is, there is a solution x with 0 ≤ x<m, and
all other solutions are congruent modulo m to
this solution.
Example:
Solve the following system
x ≡ 2 (mod 3),
x ≡ 3 (mod 5),
x ≡ 2 (mod 7)

Solution:
Let m = 3 · 5 · 7 = 105,
M1 = m/3 =35,
M2 = m/5 = 21,
and M3 = m/7 = 15.
We see that 2 is an inverse of M1 = 35 modulo 3,
because 35 · 2 ≡ 2 · 2 ≡ 1 (mod 3);
1 is an inverse of M2 = 21 modulo 5,
because 21 ≡1 (mod 5);
and 1 is an inverse of M3 = 15 (mod 7),
because 15 ≡ 1 (mod 7).
The solutions to this system are those x such
that
x ≡ a1M1y1 + a2M2y2 + a3M3y3
= 2 · 35 · 2 + 3 · 21 · 1 + 2 · 15 · 1= 233 ≡ 23
(mod 105).
FERMAT’S LITTLE THEOREM
If p is prime and a is an integer not divisible by p,
Then ap-1≡ 1 (mod p).
Furthermore, for every integer a we have
ap ≡ a(mod p).

Example: Find 7222 mod 11.


Solution: By Fermat’s little theorem, 710 ≡ 1(mod 11)
so , (710)k≡ 1(mod 11), for every positive integer k.
Since 222 = 22 · 10 + 2.
7222 = 722.10+2
= (710)22 72 ≡ (1)2.49
≡ 5 (mod 11).

It follows that 7222 mod 11 =5.


Randomly chosen numbers are often needed for
computer simulations. Different methods have
been devised for generating numbers that have
properties of randomly chosen numbers. Because
numbers generated by systematic methods are not
truly random, they are called pseudorandom
numbers. The most commonly used procedure for
generating pseudorandom numbers is the linear
congruential method.

Example:
Find the sequence of pseudorandom numbers
generated by the linear congruential method with
modulus m = 9, multiplier a = 7, increment c = 4,
and seed x0 = 3.
 Solution:We compute the terms of this sequence by
successively using the recursively defined function xn+1 =
(7xn + 4) mod 9,
x1 = 7x0 + 4 mod 9 = 7 · 3 + 4 mod 9 = 25 mod 9 = 7,
x2 = 7x1 + 4 mod 9 = 7 · 7 + 4 mod 9 = 53 mod 9 = 8,
x3 = 7x2 + 4 mod 9 = 7 · 8 + 4 mod 9 = 60 mod 9 = 6,
x4 = 7x3 + 4 mod 9 = 7 · 6 + 4 mod 9 = 46 mod 9 = 1,
x5 = 7x4 + 4 mod 9 = 7 · 1 + 4 mod 9 = 11 mod 9 = 2,
x6 = 7x5 + 4 mod 9 = 7 · 2 + 4 mod 9 = 18 mod 9 = 0,
x7 = 7x6 + 4 mod 9 = 7 · 0 + 4 mod 9 = 4 mod 9 = 4,
x8 = 7x7 + 4 mod 9 = 7 · 4 + 4 mod 9 = 32 mod 9 = 5,
x9 = 7x8 + 4 mod 9 = 7 · 5 + 4 mod 9 = 39 mod 9 = 3.
Because x9 = x0 and because each term depends only on the
previous term, we see that the sequence
3, 7, 8, 6, 1, 2, 0, 4, 5, 3, 7, 8, 6, 1, 2, 0, 4, 5, 3,...
is generated. This sequence contains nine different numbers
before repeating
Number theory plays a key role in cryptography, the
subject of transforming information so that it cannot
be easily recovered without special knowledge.
One of the earliest known uses of cryptography was
by Julius Caesar.
To express Caesar’s encryption process
mathematically, first replace each letter by an
element of Z26, that is, an integer from 0 to 25 equal
to one less than its position in the alphabet. For
example, replace A by 0, K by 10, and Z by 25.
Caesar’s encryption method can be represented by
the function f that assigns to the nonnegative
integer p, p ≤ 25, the integer f(p) in the set {0, 1,
2,..., 25} with f(p) = (p + 3) mod 26.
Example:
Encrypt the plaintext message “STOP GLOBAL
WARMING” using the shift cipher with shift k= 11.
Solution: To encrypt the message “STOP GLOBAL
WARMING” we first translate each letter to the
corresponding element of Z26.
This produces the string
18 19 14 15 6 11 14 1 0 11 22 0 17 12 8 13 6
Now apply the shift f(p) = (p + 11) mod 26 to each
number in this string. We obtain
3 4 25 0 17 22 25 12 11 22 7 11 2 23 19 24
17
Translating this last string back to letters, we
obtain the cipher text “DEZA RWZMLW
HLCXTYR.”
Example:
Decrypt the cipher text message “LEWLYPLUJL PZ H
NYLHA ALHJOLY” that was encrypted with the shift
cipher with shift k = 7.
Solution: To decrypt the cipher text first translate the
letters back to elements of Z26.
We obtain
11 4 22 11 24 15 11 20 9 11 15 25 7 13 24 11 7 0
0 11 7 9 14 11 24.
Next, shift each of these numbers by −k =−7 modulo
26 to obtain
4 23 15 4 17 8 4 13 2 4 8 18 0 6 17 4 0 19 19 4 0 2 7 4 17.
Finally, we translate these numbers back to letters to
obtain the plaintext. We obtain
“EXPERIENCE IS A GREAT TEACHER.”
We can generalize shift ciphers further to slightly
enhance security by using a function of the form f(p)
=(ap+b)mod 26,
where a and b are integers, chosen so that f is a
bijection. (The function f(p) = (ap +b) mod 26 is a
bijection if and only if gcd(a, 26) = 1.)
Such a mapping is called an affine transformation, and
the resulting cipher is called an affine cipher.

Example: What letter replaces the letter K when the


function f(p) = (7p + 3) mod 26 is used for encryption?
Solution: Since 10 represents K, using the encryption
function specified, it follows that
f(10) = (7 · 10 + 3) mod 26 = 21. Because 21
represents V, K is replaced by V in the encrypted
message
BLOCK CIPHERS :
Shift ciphers and affine ciphers proceed by
replacing each letter of the alphabet by another
letter in the alphabet. Because of this, these
ciphers are called character or monoalphabetic
ciphers. Encryption methods of this kind are
vulnerable to attacks based on the analysis of
letter frequency in the ciphertext. We can make
it harder to successfully attack ciphertext by
replacing blocks of letters with other blocks of
letters instead of replacing individual
characters with individual characters; such
ciphers are called block ciphers.
Example:
Using the transposition cipher based on the permutation σ
of the set {1, 2, 3, 4} with σ(1) = 3, σ(2) = 1, σ(3) = 4, and
σ(4) = 2,
(a) Encrypt the plaintext message PIRATE ATTACK.
(b)Decrypt the ciphertext message SWUETRAEOEHS,
whichwas encrypted using this cipher.
Solution:
(a)We first split the letters of the plaintext into blocks of four
letters. We obtain PIRA TEAT TACK.
To encrypt each block, we send the first letter to the third
position, the second letter to the first position, the third
letter to the fourth position, and the fourth letter to the
second position.
We obtain IAPR ETTA AKTC.
(b) We note that σ-1, the inverse of σ, sends 1 to
2, sends 2 to 4, sends 3 to 1, and sends 4 to 3.
Applying σ-1(m) to each block gives us the
plaintext: USEWATERHOSE. (Grouping
together these letters to form common words,
we get USE WATER HOSE.)

You might also like