Lec 2
Lec 2
Cryptography in
Fintech
Chapter 2: 1
Introduction to Number Theory
The Intended Learning
Outcomes:
After studying this chapter, you should be able to:
▪ Understand the concept of divisibility and the division algorithm.
▪ Understand how to use the Euclidean algorithm to find the greatest common divisor.
2
3
Divisibility And The
Division Algorithm
Divisibility And The Division
Algorithm
▪ Divisibility:
▪ We say that a nonzero b divides a if a = mb for some m, where a, b, and m are integers.
4
Divisibility And The Division
Algorithm
▪ Divisibility:
▪ We say that a nonzero b divides a if a = mb for some m, where a, b, and m are integers.
5
Divisibility And The Division
Algorithm
▪ Divisibility:
▪ Properties of divisibility for integers are as follows:
• If a|b and b|c, then a|c. (e.g., if 11|66 and 66|198 then 11|198).
• If b|g and b|h, then b|(mg + nh) for arbitrary integers m and n.
6
Divisibility And The Division
Algorithm
▪ Divisibility:
▪ Properties of divisibility for integers are as follows:
7
Divisibility And The Division
Algorithm
▪ The Division Algorithm:
▪ Given any positive integer n and any nonnegative integer a, if we divide a by n, we get an
integer quotient q and an integer remainder r that obey the following relationship:
8
Divisibility And The Division
Algorithm
▪ The Division Algorithm:
9
Divisibility And The Division
Algorithm
▪ The Division Algorithm:
10
11
THE EUCLIDEAN
ALGORITHM
THE EUCLIDEAN ALGORITHM
▪ Euclidean algorithm is a simple procedure for determining the greatest common
Two integers are relatively prime if and only if their only common positive
integer factor is 1.
12
THE EUCLIDEAN ALGORITHM
▪ Greatest Common Divisor:
▪ We will use the notation gcd(a, b) to mean the greatest common divisor of a and b.
▪ The greatest common divisor of a and b is the largest integer that divides both a and b.
13
THE EUCLIDEAN ALGORITHM
▪ Greatest Common Divisor:
▪ Also, because all nonzero integers divide 0, we have gcd(a, 0) = |a|.
14
THE EUCLIDEAN ALGORITHM
▪ Finding the Greatest Common Divisor:
15
THE EUCLIDEAN ALGORITHM
▪ Finding the Greatest Common Divisor:
16
THE EUCLIDEAN ALGORITHM
▪ Finding the Greatest Common Divisor:
17
THE EUCLIDEAN ALGORITHM
▪ Finding the Greatest Common Divisor:
18
19
MODULAR
ARITHMETIC
MODULAR ARITHMETIC
▪ Modulus:
▪ If a is an integer and n is a positive integer, we define a mod n to be the remainder when a
is divided by n.
▪ Thus, for any integer a, we can rewrite the Division Algorithm as follows:
a = qn + r 0 # r , n; q = Ãa/nÕ;
a = Ãa/nÕ * n + (a mod n)
20
MODULAR ARITHMETIC
▪ Modulus:
▪ Two integers a and b are said to be congruent modulo n, if (a mod n) = (b mod n).
21
MODULAR ARITHMETIC
▪ Properties of Congruences:
▪ a … b (mod n) if n|(a - b).
22
MODULAR ARITHMETIC
▪ Modular Arithmetic Operations:
▪ Modular arithmetic exhibits the following properties:
23
MODULAR ARITHMETIC
▪ Modular Arithmetic Operations:
▪ Exponentiation is performed by repeated multiplication, as in ordinary arithmetic.
24
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
▪ Define the set Zn as the set of nonnegative integers less than n:
Zn = {0, 1, … , (n - 1)}
25
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
26
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
27
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
▪ The previous table values represent the set of residues, or residue classes (mod n). To be
28
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
29
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
▪ if (a + b) … (a + c) (mod n) then b … c (mod n).
30
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
▪ if (a * b) … (a * c)(mod n) then b … c(mod n) if a is relatively prime to n.
31
MODULAR ARITHMETIC
▪ Properties of Modular Arithmetic:
32
MODULAR ARITHMETIC
▪ Euclidean Algorithm Revisited:
▪ The Euclidean algorithm can be based on the following theorem:
For any integers a, b, with a $ b $ 0, we can repetitively apply the following formula:
33
34
Summary
Summary
▪ We have covered the following:
▪ The concept of divisibility and the division algorithm.
▪ How to use the Euclidean algorithm to find the greatest common divisor.
of mod.”
35