0% found this document useful (0 votes)
15 views35 pages

Lec 2

This chapter introduces number theory concepts like divisibility, the division algorithm, the Euclidean algorithm for finding greatest common divisors, and modular arithmetic. It defines key terms, properties, and algorithms at a high level.

Uploaded by

karmaelgendy04
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)
15 views35 pages

Lec 2

This chapter introduces number theory concepts like divisibility, the division algorithm, the Euclidean algorithm for finding greatest common divisors, and modular arithmetic. It defines key terms, properties, and algorithms at a high level.

Uploaded by

karmaelgendy04
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/ 35

Cybersecurity and

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.

▪ Present an overview of the concepts of modular arithmetic.

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.

▪ That is, b divides a if there is no remainder on division.

▪ The notation b|a is commonly used to mean b divides a.

▪ Also, if b|a, we say that b is a divisor of a.

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.

▪ That is, b divides a if there is no remainder on division.

▪ The notation b|a is commonly used to mean b divides a.

▪ Also, if b|a, we say that b is a divisor of a.

5
Divisibility And The Division
Algorithm
▪ Divisibility:
▪ Properties of divisibility for integers are as follows:

• If a|1, then a = ±1.

• If a|b and b|a, then a = ±b.

• Any b≠0 divides 0.

• 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:

a = qn + r , where 0 # r , n; and q=Ãa/nÕ

▪ The remainder r is often referred to as a residue.

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

divisor (GCD) of two positive integers.

▪ First, we need a simple definition:

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.

▪ We also define gcd(0, 0) = 0.

▪ An equivalent definition is gcd(a, b) = max[k, such that k|a and k|b].

▪ Because we require that the greatest common divisor be positive. In general,


gcd(a,b)=gcd(|a|,|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.

▪ The integer n is called the modulus.

▪ 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).

▪ This is written as a … b (mod n).

▪ Note that if a … 0 (mod n), then n|a.

21
MODULAR ARITHMETIC
▪ Properties of Congruences:
▪ a … b (mod n) if n|(a - b).

▪ a … b (mod n) implies b … a (mod n).

▪ a … b (mod n) and b … c (mod n) imply a … c (mod n).

22
MODULAR ARITHMETIC
▪ Modular Arithmetic Operations:
▪ Modular arithmetic exhibits the following properties:

1. [(a mod n) + (b mod n)] mod n = (a + b) mod n

2. [(a mod n) - (b mod n)] mod n = (a - b) mod n

3. [(a mod n) * (b mod n)] mod n = (a * b) mod n

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)}

▪ Let's assume that n is 8.

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

more precise, each integer in Zn represents a residue class.

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:

gcd(a, b) = gcd(b, a mod b)

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.

▪ An overview of the concepts of modular arithmetic.

▪ I recommend reading Appendix 2A to get a better knowledge about “The meaning

of mod.”

35

You might also like