Number Theory 1
Number Theory 1
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.
Example:
Express gcd(252, 198) = 18 as a linear combination of 252 and
198.
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:
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 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.