Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

2022 - ESIEA Dr. H.

Schellinx

Mathematics and cryptography

Numbers

ℕ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ

Natural numbers, integers (whole numbers), rational numbers, real numbers and complex
numbers.

Prime numbers: A number p ∈ ℕ is a prime number (or: is prime) when it has exactly
two distinct divisors, namely 1 and itself.

Theorem: There are infinitely many prime numbers. ⊠

(A proof of this important fact can already be found in Euclid’s ‘The Elements’. It is
proposition 20 in book IX. We did the proof in class. Can you recall it?)

2022 - ESIEA Dr. H. Schellinx

Prime numbers are like atoms in our number system, which is the ‘essence’ of the
fundamental theorem of arithmetic: Any number n ∈ ℕ can be written as a product of
primes in a way that is, essentially, unique (by putting the separate prime factors in
increasing order). ⊠

Examples: 2022 = 2 × 3 × 337 ; 48 = 24 × 3 ; 118 = 2 × 59 ; 175 = 52 × 7.

m m′ m
Corollary: For any fraction we can find numbers m′ and n′ such that = , with
n n′ n
m′ ≤ m, n′ ≤ n and the greatest common divisor of m′ and n′, gcd(m′, n′), is equal to 1.
We say that m′ and n′ are co-prime. Note that this implies that whenever for two integers
k m′
k and l, we have = , then k ≥ m′ and l ≥ n′.

l n′

The division of two natural numbers b and a: for all natural numbers a, b with 0 ≠a<b
we can find two other natural numbers (the quotient q and the remainder r) such that
b = q ⋅ a + r, and 0 ≤ r < a.

We use (and used in class) Euclid’s Algorithm to find the greatest common divisor
gcd(a, b) of two natural numbers a and b; when we ‘run the algorithm in reverse’, we find
two integers x and y that satisfy a ⋅ x + b ⋅ y = gcd(a, b). This equality is called Bézout’s
identity. 


The fact that these two integers always exist follows from Bézout’s Theorem: The
equation a x + by = c has a solution in whole numbers iff gcd(a, b) | c. ⊠

Another corollary of this theorem is the following important and very useful fact: two
natural numbers a and b are co-prime iff ∃x, y ∈ ℤ such that a x + by = 1.

Exercise 1:
a. Use Euclid’s algorithm to determine gcd(77,9) and find x and y such that 77x + 9y = gcd(77,9)

b. Use Euclid’s algorithm to determine gcd(321,27) and find x, y such that 321x + 27y = gcd(321,27)

c. Use Euclid’s algorithm to determine gcd(2022,1685) and find x, y such that


2022x + 1685y = gcd(2022,1685)

2022 - ESIEA Dr. H. Schellinx

Sets

Recall:

• a set is ‘a bag of things’, like !E = {all natural numbers that divisible by 2} = !{x ∈ ℕ | ∃k ∈ ℕ . x = 2k} ; if
something is ‘inside the bag’, we write that, e.g., !2 ∈ E ; or 25679564
! ∈ E ; if something is ‘not inside the bag’, we
write that, e.g., 17
! ∉ E.


• an ‘empty bag’ is called ‘the empty set’ and written as ∅


! ; there is nothing in the empty set: ! ∀x . x ∉ ∅


• the set A is a subset of the set B, written as A


! ⊂ B, if x! ∈ A implies that x! ∈ B


• two sets A and B are equal, written as A


! = B, in case !x ∈ A iff x! ∈ B, which is the same as saying that A is a subset
of B, and B is a subset of A 


• the intersection !A ∩ B of two sets A and B, which contains those elements that are in both of the sets

• the union !A ∪ B of two sets A and B, which contains those elements that are in at least one of the sets 


• the complement !A of a set A ! contains everything that is not inside A


! [note that this supposes some sort of a ‘universe
de discours’]: x! ∈ A iff x! ∉ A.

If E and F are non-empty set, the cartesian product E × F is the set of all possible pairs
with a first element from E and a second one from F: E × F = {(x, y) | x ∈ E, y ∈ F}.

Given the cartesian product E × F of two non-empty sets E and F, a subset of E × F is


called a graph of E in F. Such a graph relates (links) points of E to points of F.

Given a non-empty set E, a graph of E in E ( i.e. a subset of E 2 = E × E ) is [called] a


binary relation on E.

For example, let E = {0, 1, 2}, then the graph GR = {(0,0), (0,2), (1,0)} ⊂ E 2 is a
binary relation R on E, and we write 0R0, 0R2, 1R0 to indicate the ‘relations’ between
the elements of E.

2022 - ESIEA Dr. H. Schellinx

Some important (potential) properties of a binary relation R on a set E:

- the relation R is reflexive if ∀x ∈ E . x R x

- the relation R is symmetric if ∀x, y ∈ E . x Ry ⟺ yR x

- the relation R is anti-symmetric if ∀x, y ∈ E . x Ry ∧ yR x ⟹ x = y

- the relation R is transitive if ∀x, y, z ∈ E . x Ry ∧ yRz ⟹ x Rz

A binary relation R on a set E is called an equivalence relation (or, shorter, an


equivalence) if the relation is reflexive, symmetric and transitive.
[[ One can think of an equivalence as sort of a more ‘liberal’ form of equality; equivalent
elements are not literally equal, but ’from a certain point of view’ they are the same ; like,
say, having ‘the same color’ ]]

Given an equivalence relation R on a set E, we define, for each element x ∈ E, the


equivalence class cl(x). It is the set of all elements y ∈ E that are equivalent to x:
cl(x) = {y ∈ E | x Ry}. Note that because of reflexivity an equivalence class is never
empty: ∀x ∈ E . x ∈ cl(x).

Given an equivalence relation R on a set E, the so-called quotient set E /R is the set of
all R− equivalence classes in E: E /R = {cl(x) | x ∈ E}.

Partitions

Let A be a non-empty set and A1, A2, A3, . . . , Ap a collection of subsets of A. We say

that {A1, A2, A3, . . . , Ap} is a partition of A if

— the subsets Ai are all mutually disjoint (i.e., for all j ≠ k, Aj ∩ Ak = ∅


—A = Ai

i=1

Theorem: Given a set E and an equivalence relation R on E, the quotient set


E /R = {cl(x) | x ∈ E} of R− equivalence classes forms a partition of E.

proof: This is pretty much evident from the definition of an equivalence relation: by reflexivity each
of the elements of E is included in an equivalence class, and by transitivity and symmetry these
2022 - ESIEA Dr. H. Schellinx
classes are disjoint. For, suppose that y ∈ cl(x) and y ∈ cl(z). Then x R y and z R y, so x R z and
z R x: z ∈ cl(x) and x ∈ cl(z), hence cl(x) = cl(z). ⊠

Modular arithmetic

This is a system of arithmetic for integers, where the numbers ‘wrap around’ when
reaching a value, called the modulus.

We are all totally familiar with modular counting:

- 3 hours after 11 o’clock in the evening we say without any hesitation that it is now ‘2
o’clock’ …

- counting in music: “1, 2, 3, 4, 1, 2, 3, 4, ….” or “1, 2, 3, 1, 2, 3, 1, 2, ….”

Given a positive integer n (the modulus), two integers a and b are said to be congruent
modulo n if their difference is divisible by n, i.e. iff n | (a − b)

We write: a ≡ b (mod n) or a ≡ b [n] or a ≡n b example:

Note: a ≡ b [n] iff 13 ≡ 37[12]

n | (a − b) iff 12 | (13 − 37)

∃k ∈ ℤ, a − b = k n iff (13 − 37) = − 2 × 12

∃k ∈ ℤ, b − a = k n iff (37 − 13) = 2 × 12

n | (b − a) iff 12 | (37 − 12)

b ≡ a [n] 37 ≡ 13[12]

For each n, the relation a≡ b [n] is a binary relation on the set of integers ℤ, i.e. it is a
subset of the cartesian product ℤ × ℤ = ℤ2.

Proposition: For each n, the relation a ≡ b [n] is an equivalence (relation) on the set of
integers ℤ.

proof: Exercise. ⊠

As our congruence relation is an equivalence, we can consider, for any given n the
resulting equivalence classes: x and y will be in the same equivalence class modulo n if
and only of x
≡ y [n]. The equivalence class modulo n of a given integer x is written as x.

We have: x = {y | y ≡ x[n]} = {x + k n | k ∈ ℤ}

2022 - ESIEA Dr. H. Schellinx

Here are some of the properties of these equivalence classes x, given some modulus n:

1. x ∈ x, because the congruence is an equivalence relation, hence reflexive :

for all x ∈ ℤ, x ≡ x [n]

2. For any y ∈ ℤ, x = y iff x ∈ y iff y ∈ x iff x ≡ y[n] iff n | (y − x)

3. If x ∈ ℤ, given a modulus n, we can always write x = k n + r, where r is the


remainder when we divide x by n, and 0 ≤ r < n. Hence, of course, x ≡ r[n]. Note that
r will be the smallest positive element (the smallest representative) in the equivalence
class x.

Examples:
123 [5] — if we divide 123 by 5 we find: 123
= 24 × 5 + 3 ; 3 is the remainder … we
write : 123 ≡ 3 (mod 5). Hence 123 = 3 (mod 5)

123 [2] — if we divide 123 by 2 we find: 123


= 61 × 2 + 1 ; 1 is the remainder … we
write : 123 ≡ 1 (mod 2). Hence 123 = 1 (mod 2)

Exercise:

Show that modulo 2, ℤ = 0 ∪ 1.

Can you express this identity in a plain English sentence?

n−1


[ More generally, modulo n, ℤ = k ]

k=0

For each n, the ≡n − equivalence classes partition the integers ℤ in n disjoint parts.

The set of ≡n − equivalence classes is written as ℤ/nℤ.

It is called ‘the set of integers modulo n’.

ℤ/nℤ = {0, 1, 2, . . . , n − 1}

2022 - ESIEA Dr. H. Schellinx

Example: ℤ/7ℤ = {0, 1, 2, 3, 4, 5, 6}



Each column in the table below is (a fragment of) a 'modulo 7' equivalence class of ℤ. All
numbers in a column are equivalent modulo 7: they have the same remainder if divided by 7.


… -22

-21 -20 -19 -18 -17 -16 -15

-14 -13 -12 -11 -10 -9 -8

-7 -6 -5 -4 -3 -2 -1

0 1 2 3 4 5 6

7 8 9 10 11 12 13

14 15 16 17 18 19 20

21 22 23 24 25 26 27

28 …

You might also like