0% found this document useful (0 votes)
14 views31 pages

COMP232 Introduction To Discrete Mathematics Integers and Division

The document provides an introduction to discrete mathematics focusing on integers and division, covering key concepts such as divisibility, prime and composite numbers, the Fundamental Theorem of Arithmetic, and the Division Algorithm. It also discusses GCD and LCM, co-prime integers, the Euclidean Algorithm, and modular arithmetic, including congruences and their properties. Additionally, it highlights the application of these concepts in areas like encryption algorithms and scheduling problems.

Uploaded by

Narendra Mishra
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)
14 views31 pages

COMP232 Introduction To Discrete Mathematics Integers and Division

The document provides an introduction to discrete mathematics focusing on integers and division, covering key concepts such as divisibility, prime and composite numbers, the Fundamental Theorem of Arithmetic, and the Division Algorithm. It also discusses GCD and LCM, co-prime integers, the Euclidean Algorithm, and modular arithmetic, including congruences and their properties. Additionally, it highlights the application of these concepts in areas like encryption algorithms and scheduling problems.

Uploaded by

Narendra Mishra
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/ 31

COMP232

Introduction to Discrete Mathematics


Integers and Division

1/1
Integers and Division

We review some basic elements of number theory


and introduce notions needed for the rest of the course.
Elements of number theory are needed in:

I Data structures,
I random number generation,
I encryption of data for secure data transmission,
I scheduling,
I etc.

2/1
Division

Definition
For integers a and b with a 6= 0 we define
a divides b iff ∃c ∈ Z b = ac.
a divides b is written as a | b
We call a a factor of b and b a multiple of a.

Example
3 | 15
3 6 | 16
4 | 16
16 6 | 4

3/1
Theorem

Let a, b, and c be integers. Then

1. if a | b and a | c then a | (b + c).

2. if a | b then a | bc for all integers c.

3. if a | b and b | c then a | c.

Note: Prove this theorem!

4/1
Partial Proof

Let a, b, and c be integers. Then

1. if a | b and a | c then a | (b + c).


Direct proof: If a| b and a | c then there exist k1 , k2 , k3 ∈ Z
such that:
b = k1 · a, c = k2 · a and thus
(b + c) = k1 a + k2 a = (k1 + k2 )a = k3 a and a|(b + c).

2. if a | b then a | bc for all integers c.

3. if a | b and b | c then a | c.

Note: Prove the rest of this theorem!

5/1
Prime and composite numbers

Definition
A prime is a positive integer p that has exactly two distinct
positive factors, 1 and p.
A positive integer greater than 1 which is not a prime is called
composite.

Example
Primes: 2, 3, 5, 7, 11, 13, 29, 53, 997, 7951, . . .
Composites: 4 = 2 · 2, 6 = 2 · 3, 35 = 5 · 7, 57 = 3 · 19, etc.

6/1
Fundamental Theorem of Arithmetic

Let Pr = {pi |pi is the ith prime where i ∈ Z}.

Theorem
Every positive integer x can be written uniquely as a product of
primes, where the prime factors are written in order of their size.
x = p1a1 p2a2 . . . pnan . . .

Example
40 = 2 · 2 · 2 · 5 = 23 · 5
42 = 2 · 3 · 7
780 = 2 · 2 · 3 · 5 · 13 = 22 · 3 · 5 · 13
550 = 2 · 5 · 5 · 11 = 2 · 52 · 11

7/1
Bounded search space

Theorem √
If n is a composite number then n has a factor ≤ n.

Note that factors come in pairs, {k , kn }: n = k kn

Proof.
n is composite, thus by definition there exist a, b ∈ Z with
1 < a < n and 1 < b < n such that n = ab.
√ √
Show that a ≤ n or b ≤ n by contradiction:
√ √
Assume that both a ≥ n and b ≥ n.
√ √
Then n = ab ≥ n n = n, a contradiction.

8/1
Example
n = 311
√ .
311 = 17.6 ≤ 20
Test dividing by 2, 3, 5, 7, 11, 13, 17.
Since none of these divides 311, it is a prime.

Example
n = 253
√ .
253 = 15.9
Test division by 2, 3, 5, 7, 11, 13.
253 = 11*23

9/1
Encryption algorithms

Factorization of very large numbers by computers is a difficult


problem.
This fact is used by some encryption systems like the
RSA encryption system, named after the inventors Rivest,
Shamir, and Adelman.
Breaking a code would require factoring numbers with 250 to
500 digits that have only two prime factors, both large primes.

Modern encryption cannot rely only on factorization of large


numbers anymore.

10 / 1
The Division Algorithm

Theorem
Let a be an integer and d a positive integer. Then there exist
unique integers q and r , 0 ≤ r < d, such that

a = dq + r

a is called the dividend


d is called the divisor
r is called the remainder
q is called the quotient.

11 / 1
GCD and LCM
Definition
GCD(a, b), called the greatest common divisor of a and b, is
the largest factor of both a and b, where ab > 0.
When GCD(a, b) = 1, we say that a and b are relatively prime
(or coprime)

GCD(18, 24) = 6
GCD(18, 13) = 1

Definition
LCM(a, b), called the least common multiple of a and b, is the
smallest integer with both a and b as factors.

LCM(8, 6) = 24
LCM(8, 12) = 24
LCM(11, 17) = 11 · 17 = 187
12 / 1
GCD and LCM

The prime factorization of a and b can be used to find


GCD(a, b) or LCM(a, b):

Example
780 = 2 · 2 · 3 · 5 · 13 = 22 · 3 · 5 · 13
550 = 2 · 5 · 5 · 11 =2 · 52 · 11
GCD(780, 550) = 2 · 5 = 10
take the factors common to both numbers.
LCM(780, 550) = 22 · 3 · 52 · 11 · 13 = 42900
take all factors in both numbers with highest exponent.

13 / 1
GCD and LCM
If a = p1a1 p2a2 · · · pnan and
b = p1b1 p2b2 · · · pnbn
min(a1 ,b1 ) min(a2 ,b2 ) min(an ,bn )
gcd(a, b) = p1 p2 · · · pn
max(a1 ,b1 ) max(a2 ,b2 ) max(an ,bn )
lcm(a, b) = p1 p2 · · · pn
Note that min(ai , bi ) + max(ai , bi ) = ai + bi , leading to

Theorem
Let a and b be positive integers. Then

ab = gcd(a, b) · lcm(a, b)

Example
GCD(780, 550) = 2 · 5 = 10
780 · 550 = 429000
LCM(780, 550) = 42900
14 / 1
Co-prime integers

Definition
The integers a and b are said to be co-prime or relatively prime
if gcd(a, b) = 1.

Example
6 and 25 are co-prime, as gcd(6, 25) = 1

Example
6 and 27 are not co-prime, since gcd(6, 27) = 3 6= 1

Example
Any two distinct prime numbers are relatively prime

15 / 1
Exercise
Find all pairs of numbers (a, b) such that
gcd(a, b) = 6 and lcm(a, b) = 540.

16 / 1
Exercise solved

Find all pairs of numbers (a, b) such that


gcd(a, b) = 6 and lcm(a, b) = 540.

a · b = gcd(a, b)lcm(a, b) = 6 · 540 = 3240 = 2 · 3 · 22 · 33 · 5

min(a2 , b2 ) = 1 max(a2 , b2 ) = 2
min(a3 , b3 ) = 1 max(a3 , b3 ) = 3
min(a5 , b5 ) = 0 max(a5 , b5 ) = 1

{(6, 540), (540, 6), (30, 108), (108, 30)} is the set of all pairs
(a, b).

17 / 1
Eucledean Algorithm — motivation

Find gcd(91, 287)


287 = 91 · 3 + 14
Note: for all a ∈ Z: a|287 → a|(91 · 3 + 14) → a|91 ∧ a|14
Thus gcd(287, 91) = gcd(91, 14)

91 = 14 · 6 + 7
14 = 7 · 2
gcd(287, 91) = gcd(91, 14) = gcd(14, 7) = 7

18 / 1
Eucledean Algorithm

Theorem
Let a = bq + r , where a, b, q, r ∈ Z. Then gcd(a, b) = gcd(b, r ).

Proof: Let d = gcd(a, b)


I If d|a ∧ d|b then d|a − bq and since r = a − bq: d|r .
I If d|b ∧ d|r then d|bq + r ∧ d|a

Hence gcd(a, b) = gcd(b, r ).

19 / 1
Modular Arithmetic

Definition
Let a ∈ Z and m ∈ Z+ with m ≥ 2.
Let a = mq + r and 0 ≤ (a mod m) < m.
a mod m = r = a − m · q

Example
8 mod 7 = 1
12 mod 7 = 5
21 mod 7 = 0

Example
Since the result of the mod operation must be ≥ 0 and < 7,
−3 mod 7 = 4 since −3 = −1 · 7 + 4
−22 mod 6 = 2 since −22 = −4 · 6 + 2

20 / 1
Example of the use of mod

A scheduling problem:
We have processors 1, 2, 3, 4, 5
and jobs 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ...
Scheduling: Given a job number, select a processor on which
to execute the job.
Round-robin scheduling:
jobs 1, 6, 11, 16, 21, ... are done on processor 2
jobs 2, 7, 12, 17, 22, ... are done on processor 3
jobs 3, 8, 13, 18, 23, ... are done on processor 4
jobs 4, 9, 14, 19, 24, ... are done on processor 5
jobs 5, 10, 15, 20, 25, ... are done on processor 1
job i is assigned to processor (i mod 5) + 1

21 / 1
Congruences

Definition
Let a and b be integers and m be a positive integer. We say that
a is congruent to b modulo m if m | (a − b).

a ≡ b (modm)

Example
5 | (14 − 9) ⇐⇒ 14 ≡ 9(mod5)
5 | (19 − 9) ⇐⇒ 19 ≡ 9(mod5)
5 | (32 − 12) ⇐⇒ 32 ≡ 12(mod5)
7 | (14 − 7) ⇐⇒ 14 ≡ 7(mod7)

22 / 1
Theorem

Let a and b be integers and m be a positive integer.


a ≡ b (modm) ⇐⇒ (a mod m) = (b mod m)

23 / 1
Theorem

Let a and b be integers and m be a positive integer.


a ≡ b (modm) ⇐⇒ (a mod m) = (b mod m)

Proof.

a ≡ b (modm) ⇒ a − b = km for k ∈ Z (*)
Since a = mq1 + r1 and b = mq2 + r2 for suitable integers
q1 , q2 , r1 , r2 by division algorithm
a − b = (mq1 + r1 ) − (mq2 + r2 ) = m(q1 − q2 ) − (r1 − r2 )
and by (*)
k = q1 − q2 and r1 = r2 and thus a mod m = b mod m

24 / 1
Theorem
Let a and b be integers and m be a positive integer.
a ≡ b (modm) ⇐⇒ (a mod m) = (b mod m)

Proof.

Let (a mod m) = (b mod m) = r
a mod m = r = a − m · ki from definition of mod and division
algorithm for some ki ∈ Z.
b mod m = r = b − m · kii from definition of mod and division
algorithm for some ki ∈ Z.
a − m · ki = b − m · kii
a − b = ki m − kii m = (ki − kii )m and since ki − kii − k ∈ Z,
a ≡ b (modm) by definition

25 / 1
Theorem
Let a and b be integers and m be a positive integer.

a ≡ b (modm) iff a = b + km for some integer k

Proof.
If a ≡ b(modm), then m|(a − b) by definition.
Thus there exists k ∈ Z with a − b = km and a = b + km.
Conversely, if there is a k ∈ Z such that a = b + km, then
km = a − b.

Hence, m divides a − b and a ≡ b (modm)

26 / 1
Exercise

Find all integers congruent to 7 modulo 6.


It is the infinite set {a : a = 7 + 6k, k ∈ Z }.
7 ≡ 13 (mod6) 7 ≡ 19 (mod6)
7 ≡ 25 (mod6) 7 ≡ 31 (mod6)
7 ≡ 37 (mod6) 7 ≡ 1 (mod6)
7 ≡ −5 (mod6) 7 ≡ −11 (mod6)

27 / 1
Theorem
Let m be a positive integer. If a ≡ b (modm) and
c ≡ d (modm) then

a + c ≡ b + d (modm)

a · c ≡ b · d (modm)

28 / 1
Exercise
Show that if a, b, c, and m are integers such that m ≥ 2, c > 0,
and
a ≡ b (mod m), then ac ≡ bc (mod mc).

29 / 1
Proof.
Direct Proof to show that if a, b, c, and m are integers such that
m ≥ 2, c > 0, and a ≡ b (mod m), then ac ≡ bc (mod mc).

Assume
A a ≡ b (mod m)
B a, b, c, and m are integers such that m ≥ 2, c > 0, and
a ≡ b (mod m)
C ac ≡ bc (mod mc)

30 / 1
Proof.
Direct Proof to show that if a, b, c, and m are integers such that
m ≥ 2, c > 0, and a ≡ b (mod m), then ac ≡ bc (mod mc).

Assume a, b, c, and m are integers such that m ≥ 2, c > 0, and


a ≡ b (mod m).
Then m|(a − b) or a − b = km for some k ∈ Z.
Then ac − bc = kcm for all integers c
and thus mc|ac − bc or ac ≡ bc (mod mc)

31 / 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy