You are on page 1of 52

19 ive u )

MTH314

20 n io (c 7
Discrete Mathematics

on o 1

ity
rs e -W

rs
for Engineers

g
4
r
R K 31
TH
G
U
05 Number Theory
ye .
M

Department of Mathematics
Sharing and/or posting online this manuscript, or parts of it, are strictly1forbidden.
(c) K. Georgiou, Ryerson University, 2019
19 ive u )
20 n io (c 7
on o 1

ity
rs e -W

rs
g
4
r
Divisibility
R K 31
TH
G
U
ye .
M

Sharing and/or posting online this manuscript, or parts of it, are strictly2forbidden.
(c) K. Georgiou, Ryerson University, 2019
Divisibility
Definition:

19 ive u )
20 n io (c
We say that (a non zero) integer 𝑎𝑎 divides an integer 𝑏𝑏 , if there exists integer q, with
b = q⋅a

7
on o 1

ity
rs e -W
Notation: a | b will mean from now on that a divides b. (not to be confused with a / b )

rs
g
4
a | b will mean from now on that a does not divide b.

r
R K 31
Observation: 𝑎𝑎|𝑏𝑏 ≡ ∃𝑞𝑞 ∈ ℤ, 𝑏𝑏 = 𝑞𝑞 ⋅ 𝑎𝑎
TH
G
U
ye .
M

Example: 3 | 12 ? Yes, because there exist an integer q, here q=4, with 12 = q ⋅ 3

Example: 5 | 12 ? No, because for all integers q we have 12 ≠ q ⋅ 5 (Is this complete?)

Example: 0 | 0 ? Yes, because there exist an integer q, here q=46, with 0 = q ⋅ 0

Example: 0 | 3 ? No, because for all integers q we have 3 ≠ q ⋅ 0


Sharing and/or posting online this manuscript, or parts of it, are strictly3forbidden.
(c) K. Georgiou, Ryerson University, 2019
Some Interesting Properties on Divisibility (1)
a | b ↔ ∃q ∈ Z (b = q ⋅ a )

19 ive u )
20 n io (c
Lemma: For all integers n≥0 we have

7
0 = q⋅n

on o 1
Proof: Set q=0, and note that

ity
n|0

rs e -W

rs
1| n Proof: Set q=n, and note that n = q ⋅1

g
4
r
R K 31
Lemma: For all integers a,b we have (a | b ) ∧ (b | c ) → (a | c )
TH
G
U
Example:
(4 | 12) ∧ (12 | 132) → (4 | 132)
a | b means ∃q1 ∈ Z (b = q1 ⋅ a )
ye .
M

Proof:

b | c means ∃q2 ∈ Z (c = q2 ⋅ b )

But then c = q2 ⋅ b = q2 ⋅ (q1 ⋅ a ) which means that there exist an integer


here q = q2 ⋅ q1 with c = q ⋅ .a
This means by definition that a|c.
Sharing and/or posting online this manuscript, or parts of it, are strictly4forbidden.
(c) K. Georgiou, Ryerson University, 2019
© K. Georgiou
Some Interesting Properties on Divisibility (2)
a | b ↔ ∃q ∈ Z (b = q ⋅ a )

19 ive u )
20 n io (c 7
on o 1

ity
Lemma: For all integers a,b we have [(a | b ) ∧ (b | a )] → [(a = b ) ∨ (a = −b )]

rs e -W

rs
g
4
r
R K 31
TH
G
U
Lemma: For all integers 𝑎𝑎, 𝑏𝑏 with 𝑎𝑎, 𝑏𝑏 > 0 we have (a | b ) → (a ≤ b )
ye .
M

(
Example: Is it possible that (a > 0 ) ∧ (a | b ) ∧ a > b ? )
Sure, as long as b=0.

© K. Georgiou Sharing and/or posting online this manuscript, or parts of it, are strictly5forbidden.
(c) K. Georgiou, Ryerson University, 2019
𝑷𝑷 𝟎𝟎 ∧ ∀𝒏𝒏 ≥ 𝟎𝟎, 𝑷𝑷 𝒏𝒏 → 𝑷𝑷 𝒏𝒏 + 𝟏𝟏 → ∀𝒏𝒏 ≥ 𝟎𝟎, 𝑷𝑷 𝒏𝒏

Induction and Divisibility

19 ive u )
20 n io (c
Theorem

7
on o 1

ity
∀𝑛𝑛 ∈ ℤ≥0 , 3|(22𝑛𝑛 − 1)

rs e -W

rs
g
4
Proof:

r
R K 31
Define predicate 𝑃𝑃 𝑛𝑛 : 3|(22𝑛𝑛 − 1)
TH
G
U
Will show by induction on 𝑛𝑛 that ∀𝑛𝑛 ≥ 0, 𝑃𝑃 𝑛𝑛 .
ye .
M

Basic Step: Need to verify that 3|(20 −1). But 3|0, because
0 = 0 ⋅ 3, so the basic step is complete.
Inductive Step: Need to prove that
∀𝒏𝒏 ≥ 𝟎𝟎, 𝑷𝑷 𝒏𝒏 → 𝑷𝑷 𝒏𝒏 + 𝟏𝟏

Sharing and/or posting online this manuscript, or parts of it, are strictly6forbidden.
(c) K. Georgiou, Ryerson University, 2019
Goal: ∀𝒏𝒏 ≥ 𝟎𝟎, 𝑷𝑷 𝒏𝒏 → 𝑷𝑷 𝒏𝒏 + 𝟏𝟏 𝑃𝑃 𝑛𝑛 : 3|(22𝑛𝑛 − 1)

(proof cont’d):

19 ive u )
Let 𝑚𝑚 be an arbitrary nonnegative integer.

20 n io (c
Assume that 𝑃𝑃(𝑚𝑚) is true, that is 3|(22𝑚𝑚 − 1).

7
This means that there exists integer 𝑘𝑘, with 22𝑚𝑚 − 1 = 3𝑘𝑘 (inductive

on o 1

ity
hypothesis)

rs e -W

rs
Need to show that 3|(22(𝑚𝑚+1) − 1)

g
4
r
R K 31
We have 22(𝑚𝑚+1) − 1 = 22𝑚𝑚+2 − 1
TH
G
U
= 2 2𝑚𝑚 22 − 1 (simple algebra)

= (3𝑘𝑘 + 1)22 − 1
ye .
M

(inductive hypothesis)

= 12𝑘𝑘 + 3 (simple algebra)

= 3 4𝑘𝑘 + 1 (simple algebra)

This proves that for 𝑟𝑟 = 4𝑘𝑘 + 1, we have 22(𝑚𝑚+1) − 1 = 3𝑟𝑟, therefore


by definition of divisibility 3|(22(𝑚𝑚+1) − 1) as wanted.
Sharing and/or posting online this manuscript, or parts of it, are strictly7forbidden.
(c) K. Georgiou, Ryerson University, 2019
Let’s Discuss Some Problematic Arguments

19 ive u )
20 n io (c
Example: Prove that

7
on o 1

ity
the sum of any two even integers is also even.

rs e -W
∀𝑛𝑛, 𝑘𝑘 ∈ ℤ, (2 𝑛𝑛 ∧ 2 𝑘𝑘) → 2|(𝑛𝑛 + 𝑘𝑘)

rs
g
4
Wrong Solution (arguing with examples):

r
R K 31
This is true because if m = 14 and n = 6, which are both
even, then m + n = 20, which is also even.
TH
G
U
ye .
M

Example: What does it mean that integers 𝑛𝑛, 𝑘𝑘 are odd?


Wrong Solution (wrong notation):
It means that there exists integer 𝑟𝑟, such that
𝑛𝑛 = 2𝑟𝑟 + 1 and 𝑘𝑘 = 2𝑟𝑟 + 1.
Sharing and/or posting online this manuscript, or parts of it, are strictly8forbidden.
(c) K. Georgiou, Ryerson University, 2019
Let’s Discuss Some Problematic Arguments

19 ive u )
Example: Prove that

20 n io (c
the sum of any two even integers is also even.

7
on o 1

ity
∀𝑛𝑛, 𝑘𝑘 ∈ ℤ, (2 𝑛𝑛 ∧ 2 𝑘𝑘) → 2|(𝑛𝑛 + 𝑘𝑘)

rs e -W
Wrong Solution: (jumping to conclusion/undefined

rs
notation)

g
4
r
R K 31
Consider two even integers 𝑛𝑛, 𝑘𝑘.
We have, 𝑛𝑛 + 𝑘𝑘 = 2𝑟𝑟 + 2𝑠𝑠 which is also divisible by 2.
TH
G
U
ye .
M

Example: Prove that the product of two odd integers is


odd.
Wrong Solution: (circular reasoning)
Suppose 𝑚𝑚 and 𝑛𝑛 are any odd integers. When any odd
integers are multiplied, their product is odd. Hence 𝑚𝑚𝑚𝑚 is
odd.
Sharing and/or posting online this manuscript, or parts of it, are strictly9forbidden.
(c) K. Georgiou, Ryerson University, 2019
Let’s Discuss Some Problematic Arguments

19 ive u )
Example:

20 n io (c
Prove that the product of two odd integers is odd.

7
on o 1

ity
rs e -W
Wrong Solution: (another circular reasoning)

rs
g
Suppose 𝑚𝑚 and 𝑛𝑛 are any odd integers. We must show that
4
r
R K 31
𝑚𝑚𝑚𝑚 is odd.
This means that there exists an integer 𝑠𝑠 such that
TH
G
U
𝑚𝑚𝑚𝑚 = 2𝑠𝑠 + 1
ye .
M

Also by definition of odd integers, there exist integers 𝑎𝑎 and 𝑏𝑏


such that
𝑚𝑚 = 2𝑎𝑎 + 1 and 𝑛𝑛 = 2𝑏𝑏 + 1.
Then
𝑚𝑚𝑚𝑚 = (2𝑎𝑎 + 1)(2𝑏𝑏 + 1) = 2𝑠𝑠 + 1
So, since 𝑠𝑠 is an integer, 𝑚𝑚𝑚𝑚 is odd by definition of odd.
10forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Let’s Discuss Some Problematic Arguments

19 ive u )
20 n io (c 7
on o 1

ity
Examples (words misuse):

rs e -W

rs
• If 𝑚𝑚 is an odd integer, then 𝑚𝑚 = 2𝑎𝑎 + 1 for any

g
4
r
integer 𝑎𝑎.
R K 31
TH

• Suppose p is a prime number. If p is prime, then p


G
U
cannot be written as a product of two smaller
ye .
M

positive integers.

11forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Prime Numbers
(different from course notes)

19 ive u )
20 n io (c
Definition: An integer n≥2 is called prime if the only positive divisors of n

7
are the integers 1 and n (exactly two distinct divisors)

on o 1

ity
An integer n≥2 is called composite if it has more than two distinct divisors.

rs e -W

rs
Observations: 1 is neither prime or composite.

g
4
Every integer 𝑛𝑛 ≥ 2 is either prime or composite, exclusively.

r
R K 31
Note: 𝑝𝑝 ≥ 2 is prime ≡ ∀𝑘𝑘 ∈ ℤ, 𝑘𝑘|𝑝𝑝 → (𝑘𝑘 = 1 ∨ 𝑘𝑘 = 𝑝𝑝)
TH
G
U
𝑝𝑝 ≥ 2 is composite ≡ ∃𝑘𝑘 ∈ ℤ, 𝑘𝑘|𝑝𝑝 ∧ 𝑘𝑘 ≠ 1 ∧ 𝑘𝑘 ≠ 𝑝𝑝)
ye .
M

Example: All prime numbers under 1000:


2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131,
137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,
571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719,
727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881,
883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997.

Example: 998 is not a prime, because 998 = 499Sharing


⋅ 2.and/or posting online this manuscript, or parts of it, are strictly
12forbidden.
(c) K. Georgiou, Ryerson University, 2019
Verifying Primality (efficiently)

19 ive u )
Primality testing: Given an integer n, is it prime?

20 n io (c 7
Question: What is the size of the input of the above problem?

on o 1

ity
rs e -W
Size when n=4314? 4

rs
g
4
Size when n=3847568736225097324624314? 25

r
R K 31
Theorem: Number of digits in order to represent n is Θ(log n ) .
TH
G
U
Question: Is there a way to solve primality in polynomially many steps (in log n )?
ye .
M

Theorem (2002): Yes there is!

Agrawal, Kayal, Saxena


13forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Divisibility by Primes

19 ive u )
Theorem: Every integer more than 1 has a prime factor.

20 n io (c
∀𝑎𝑎 ∈ ℤ, 𝑎𝑎 ≥ 2 → ∃𝑝𝑝 ∈ 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃, 𝑝𝑝 𝑎𝑎

7
on o 1

ity
Proof: Every integer is either prime or composite. So it is enough to prove that

rs e -W
(i) ∀𝑎𝑎 ∈ 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃, 𝑎𝑎 ≥ 2 → ∃𝑝𝑝 ∈ 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃, 𝑝𝑝 𝑎𝑎

rs
(ii) ∀𝑎𝑎 ∈ 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶, 𝑎𝑎 ≥ 2 → ∃𝑝𝑝 ∈ 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃, 𝑝𝑝 𝑎𝑎

g
4
r
R K 31
(i) is true because ….
TH
G
U
For the sake of contradiction, assume (ii) is false, i.e.
ye .
M

∃𝑎𝑎 ∈ 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶, 𝑎𝑎 ≥ 2 ∧ ∀𝑝𝑝 ∈ 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃, 𝑝𝑝 ∤ 𝑎𝑎


Let 𝑎𝑎 ≥ 2 be the smallest such composite number.
Since 𝑎𝑎 is composite, there exists 𝑑𝑑 ∈ ℤ, 𝑑𝑑 ≠ 1 ∧ 𝑑𝑑 ≠ 𝑎𝑎 ∧ 𝑑𝑑|𝑎𝑎.
It follows that 1 < 𝑑𝑑 < 𝑎𝑎.
𝑑𝑑 cannot be a prime, otherwise 𝑎𝑎 would have a prime factor.
Since 𝑑𝑑 ≥ 2 is composite, 𝑑𝑑 has a prime factor (𝑎𝑎 is the smallest that does not).
If 𝑝𝑝 is that prime factor, then 𝑝𝑝|𝑑𝑑. But also 𝑑𝑑|𝑎𝑎, hence 𝑝𝑝|𝑎𝑎, a contradiction. ∎ 14
Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
(c) K. Georgiou, Ryerson University, 2019
Unique Factorization Theorem

19 ive u )
20 n io (c
Theorem (Fundamental Theorem of Arithmetic):

7
Every integer > 1 has a unique representation as a product of prime powers.

on o 1

ity
rs e -W
Example: 9421868371896 = 2 ⋅ 2 ⋅ 2 ⋅ 3 ⋅ 3 ⋅ 3 ⋅ 3 ⋅ 3 ⋅ 3 ⋅17 ⋅17 ⋅17 ⋅17 ⋅ 23 ⋅ 29 ⋅ 29

rs
g
4
= 23 ⋅ 36 ⋅17 4 ⋅ 23 ⋅ 29 2 Prime power decomposition

r
R K 31
Theorem (restated):
TH
G
U
For every integer 𝑛𝑛 > 1, there exists integer 𝑘𝑘, and 𝑘𝑘 distinct primes
ye .
M

𝑝𝑝1 < ⋯ < 𝑝𝑝𝑘𝑘 , along with positive integers 𝑒𝑒1 , … , 𝑒𝑒𝑘𝑘 such that
𝑒𝑒 𝑒𝑒 𝑒𝑒
𝑛𝑛 = 𝑝𝑝11 ⋅ 𝑝𝑝22 ⋅ … 𝑝𝑝𝑘𝑘𝑘𝑘 .
This representation is unique, meaning that if for some integer 𝑙𝑙, and 𝑙𝑙 primes
𝑞𝑞1 < ⋯ < 𝑞𝑞𝑘𝑘 , along with positive integers 𝑡𝑡1 , … , 𝑡𝑡𝑙𝑙 we have
𝑡𝑡 𝑡𝑡 𝑡𝑡
𝑛𝑛 = 𝑞𝑞11 ⋅ 𝑞𝑞22 ⋅ … 𝑞𝑞𝑙𝑙 𝑙𝑙
then 𝑘𝑘 = 𝑙𝑙, 𝑝𝑝𝑖𝑖 = 𝑞𝑞𝑖𝑖 and 𝑒𝑒𝑖𝑖 = 𝑡𝑡_𝑖𝑖, 𝑖𝑖 = 1, … , 𝑘𝑘. 15forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Proof of Unique Factorization Thm
Theorem (restated):

19 ive u )
20 n io (c
∀𝑛𝑛 > 1, there exists integer 𝑘𝑘, and 𝑘𝑘 distinct primes
𝑝𝑝1 < ⋯ < 𝑝𝑝𝑘𝑘 , along with positive integers 𝑒𝑒1 , … , 𝑒𝑒𝑘𝑘 such that

7
on o 1

ity
𝑒𝑒 𝑒𝑒 𝑒𝑒
𝑛𝑛 = 𝑝𝑝11 ⋅ 𝑝𝑝22 ⋅ … 𝑝𝑝𝑘𝑘𝑘𝑘 .

rs e -W

rs
g
4
Proof:

r
R K 31
For the sake of contradiction, suppose there is 𝑛𝑛 > 1 that does not
TH
have this property.
G
U
We may assume that 𝑛𝑛 is the smallest such integer.
ye .
M

If 𝑛𝑛 is prime, we are done, because 𝑛𝑛 = 𝑛𝑛1 .


If 𝑛𝑛 is composite, then there exists prime 𝑝𝑝 such that 𝑝𝑝|𝑛𝑛.
But then, 𝑛𝑛 = 𝑞𝑞𝑞𝑞, for some integer 𝑞𝑞.
Moreover 1 < 𝑞𝑞 < 𝑛𝑛, and hence 𝑞𝑞 does have a prime factorization.
But then 𝑞𝑞𝑞𝑞 gives a prime factorization for 𝑛𝑛, a contradiction. ∎
16forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
19 ive u )
20 n io (c 7
on o 1

ity
rs e -W

rs
g
4
r
Greatest Common Divisor
R K 31
TH
G
U
ye .
M

17forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Greatest Common Divisors

19 ive u )
20 n io (c
Definition

7
on o 1

ity
Let 𝑎𝑎, 𝑏𝑏 ∈ ℤ not both 0. The greatest common divisor

rs e -W

rs
of 𝑎𝑎, 𝑏𝑏, denoted by gcd(𝑎𝑎, 𝑏𝑏), is the largest integer

g
4
r
that divides both 𝑎𝑎, 𝑏𝑏.
R K 31
TH
G
U
Observation: gcd ⋅,⋅ is well defined.
ye .
M

1 divides both 𝑎𝑎, 𝑏𝑏, hence common divisors do exist.


Any common divisor of 𝑎𝑎, 𝑏𝑏 is no more than
min 𝑎𝑎 , 𝑏𝑏 .

18forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Finding GCDs
Find gcd 12,24 .

19 ive u )
20 n io (c
Solution:

7
Divisors of 12: {±1, ±2, ±3, ±4, ±6, ±12}

on o 1

ity
Divisors of 24: {±1, ±2, ±3, ±4, ±6, ±12, ±24}.

rs e -W

rs
Hence gcd 12,24 = 12.

g
4
r
R K 31
Find gcd 16,20 .
TH
G
U
Solution:
ye .
M

Divisors of 16: {±1, ±2, ±4, ±8, ±16}


Divisors of 20: {±1, ±2, ±4, ±5, ±10, ±20}.
Hence gcd 16,20 = 4.

Find gcd(3,5). Answer: 1


Find gcd(110,0). Answer: 110 19forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Integer Combinations

19 ive u )
20 n io (c
Definition

7
on o 1

ity
Let 𝑎𝑎, 𝑏𝑏 be integers. For each 𝑘𝑘, 𝑙𝑙 integers,

rs e -W

rs
𝑘𝑘𝑘𝑘 + 𝑙𝑙𝑙𝑙

g
4
is called an integer combination of 𝑎𝑎, 𝑏𝑏.

r
R K 31
TH
G
U
Examples
ye .
M

Integer combination of 3, −7: −23 = 3 ⋅ 4 + 5 ⋅ −7


Integer combination of 3,5: −23 = 3 ⋅ 4 + 5 ⋅ −7
Integer combination of 4,5: −23 = 3 ⋅ 4 + 5 ⋅ −7
Integer combination of 4, −7: −23 = 3 ⋅ 4 + 5 ⋅ −7

20forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Property of Integer Combinations

19 ive u )
20 n io (c
Theorem For every integers 𝑑𝑑, 𝑎𝑎, 𝑏𝑏,

7
on o 1

ity
𝑑𝑑 𝑎𝑎 ∧ 𝑑𝑑 𝑏𝑏 → (𝑑𝑑 divides any integer combination of 𝑎𝑎, 𝑏𝑏)

rs e -W
(Corollary: 𝑑𝑑 𝑎𝑎 ∧ 𝑑𝑑 𝑏𝑏 → 𝑑𝑑|(𝑎𝑎 ± 𝑏𝑏) )

rs
g
4
r
Proof:
R K 31
Let 𝑑𝑑, 𝑎𝑎, 𝑏𝑏 be arbitrary integers for which 𝑑𝑑|𝑎𝑎 ∧ 𝑑𝑑|𝑏𝑏.
TH
G
U
But then ∃𝑟𝑟1 ∈ ℤ: 𝑎𝑎 = 𝑟𝑟1 𝑑𝑑
ye .
M

∃𝑟𝑟2 ∈ ℤ: 𝑏𝑏 = 𝑟𝑟2 𝑑𝑑
Let 𝑘𝑘𝑘𝑘 + 𝑙𝑙𝑙𝑙 be an arbitrary integer combination of 𝑎𝑎, 𝑏𝑏.
But then 𝑘𝑘𝑘𝑘 = 𝑘𝑘𝑟𝑟1 𝑑𝑑
𝑙𝑙𝑙𝑙 = 𝑙𝑙𝑟𝑟2 𝑑𝑑
Hence 𝑘𝑘𝑘𝑘 + 𝑙𝑙𝑙𝑙 = 𝑘𝑘𝑟𝑟1 𝑑𝑑 + 𝑙𝑙𝑟𝑟2 𝑑𝑑 = 𝑘𝑘𝑟𝑟1 + 𝑙𝑙𝑟𝑟2 𝑑𝑑.
Hence, 𝑑𝑑|(𝑘𝑘𝑘𝑘 + 𝑙𝑙𝑙𝑙) as wanted. ∎
21forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Correctness of Division (Proof) (1)
Theorem: Let a,b integers with b>0. Then there exist unique integers q,r :

19 ive u )
20 n io (c
divisor
Example: 𝑎𝑎 = 54, when divided by
a = b ⋅ q + r ,where 0≤r<b.

7
𝑏𝑏 = 4, has quotient 𝑞𝑞 = 13 and

on o 1

ity
dividend remainder remainder 𝑟𝑟 = 2, i. e.
quotient

rs e -W
54 = 4 ⋅ 13 + 2

rs
Proof: (for a≥0 – The case a<0 is similar) Consider the sequence f n = a − n ⋅ b

g
4
r
R K 31
f0 f1 f2 f3 f k −1 fk
TH
G
U
a , a − b , a − 2b , a − 3b , … , a − (k − 1) ⋅ b , a − k ⋅ b ,
ye .
M

positive first negative


element of the element of the
sequence sequence
“proposed remainder”

Set r = a − (k − 1) ⋅ b b ⋅ q + r = b ⋅ (k − 1) + a − b ⋅ (k − 1) = a
and observe
q = k −1 r≥0 (why?)
r = a − (k − 1) ⋅ b = a − k ⋅ b + b < b
“proposed quotient”
22forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Correctness of Division (Proof) (2)
Theorem: Let a,b integers with b>0. Then there exist unique integers q,r :

19 ive u )
20 n io (c
divisor

a = b ⋅ q + r ,where 0≤r<b.

7
on o 1

ity
dividend remainder

rs e -W
quotient

rs
Proof (cont’d): (uniqueness)

g
4
r
We have shown that
R K 31a = b ⋅ q + r ,where 0 ≤ r < .b
Hence, b ⋅ q + r = b ⋅ q '+ r '
TH
G
U
Now, suppose that a = b ⋅ q '+ r ' ,where 0 ≤ r ' < b. that is b ⋅ (q '− q ) = r − r '
ye .
M

0≤r
⇒ −b < r − r ' this says b divides r-r’
r' < b
⇒ −b < r − r ' < b
this says b>|r-r’|
0 ≤ r'
⇒ r − r' < b ⇒ r − r' = 0
r <b
⇒ q − q' = 0
23forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Does this Smell Like a Function?
Theorem: Let a,b integers with b>0. Then there exist unique integers q,r :

19 ive u )
20 n io (c
divisor

a = b ⋅ q + r ,where 0≤r<b.

7
on o 1

ity
dividend remainder

rs e -W
quotient

rs
g
4
Notation:

r
R K 31
• 𝑑𝑑𝑑𝑑𝑑𝑑: ℤ × ℤ∗ → ℤ
𝑑𝑑𝑑𝑑𝑑𝑑 𝑎𝑎, 𝑏𝑏 ≔ the unique quotient, when 𝑎𝑎 is the dividend and 𝑏𝑏 the divisor
TH
G
U
(more commonly denoted by 𝑎𝑎 𝑑𝑑𝑑𝑑𝑑𝑑 𝑏𝑏 )
ye .
M

• 𝑚𝑚𝑚𝑚𝑚𝑚: ℤ × ℤ∗ → ℤ
𝑚𝑚𝑚𝑚𝑚𝑚 𝑎𝑎, 𝑏𝑏 ≔ the unique remainder, when 𝑎𝑎 is the dividend and 𝑏𝑏 the divisor
(more commonly denoted by 𝑎𝑎 𝑚𝑚𝑚𝑚𝑚𝑚 𝑏𝑏 )

Example: 𝑎𝑎 = 54, when divided by 𝑏𝑏 = 4, has quotient 𝑞𝑞 = 13 and remainder 𝑟𝑟 = 2, i. e.


54 = 4 ⋅ 13 + 2
and hence 54 𝑑𝑑𝑑𝑑𝑑𝑑 4 = 13 and 54 𝑚𝑚𝑚𝑚𝑚𝑚 4 = 2.
24forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
The Euclidean Algorithm
Theorem For all integers 𝑎𝑎, 𝑏𝑏, 𝑞𝑞, 𝑟𝑟

19 ive u )
20 n io (c
𝑎𝑎 = 𝑞𝑞𝑞𝑞 + 𝑟𝑟 → gcd 𝑎𝑎, 𝑏𝑏 = gcd 𝑏𝑏, 𝑟𝑟 .
Proof:

7
on o 1

ity
Let 𝑎𝑎, 𝑏𝑏, 𝑞𝑞, 𝑟𝑟 be arbitrary integers, and assume 𝑎𝑎 = 𝑞𝑞𝑞𝑞 + 𝑟𝑟.

rs e -W

rs
Claim 1: Every divisor of 𝑎𝑎, 𝑏𝑏 also divides 𝑏𝑏, 𝑟𝑟.

g
4
r
Indeed, 𝑟𝑟 = 𝑎𝑎 + −𝑞𝑞 𝑏𝑏 (𝑟𝑟 is an integer combination of 𝑎𝑎, 𝑏𝑏).
R K 31
Claim 2: Every divisor of 𝑏𝑏, 𝑟𝑟 also divides 𝑎𝑎, 𝑏𝑏.
TH
G
U
Indeed, 𝑎𝑎 is an integer combination of 𝑏𝑏, 𝑟𝑟. ∎
ye .
M

Euclidean Algorithm
(for finding 𝐠𝐠𝐠𝐠𝐠𝐠 𝒂𝒂, 𝒃𝒃 , when 𝒂𝒂 ≥ 𝒃𝒃 ≥ 𝟎𝟎 and 𝒂𝒂 > 𝟎𝟎)
gcd 𝑎𝑎, 𝑏𝑏
- If 𝑏𝑏 = 0, return 𝑎𝑎.
- else, return gcd(𝑏𝑏, 𝑎𝑎 𝑚𝑚𝑚𝑚𝑚𝑚 𝑏𝑏)
25forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
Raphael’s “School of(c)
Athens” (1509) Ryerson University, 2019
K. Georgiou,
(Vatican’s Apostolic Palace)
The Euclidean Algorithm
(for finding GCDs)
a = q ⋅b + r
Example: Find GCD (−4410,−5005)

19 ive u )
and a,b not both 0

20 n io (c
GCD (−4410,−5005) = GCD(5005,4410) ⇒
GCD (a, b) = GCD (b, r )

7
on o 1

ity
Sign and order do not matter

rs e -W

rs
Apply repeatedly previous theorem, performing long division

g
4
that is, if 5005 = q ⋅ 4410 + r then GCD (5005,4410) = GCD (4410, r )

r
R K 31
Solution: 5005 = (1) ⋅ 4410 + 595 GCD (5005,4410) = GCD (4410,595)
TH
G
U
4410 = (7 ) ⋅ 595 + 245
ye .
M

GCD (4410,595) = GCD(595,245)

595 = (2 ) ⋅ 245 + 105 GCD (595,245) = GCD (245,105) Will this


algorithm
always
245 = (2 ) ⋅105 + 35 GCD (245,105) = GCD (105,35) terminate?

105 = (3) ⋅ 35 + 0 GCD (105,35) = GCD (35,0) = 35 26forbidden.


Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Floors and Ceilings

19 ive u )
20 n io (c
Definition: (Floor of real number x)
⌊𝑥𝑥⌋: =largest integer which is no more than 𝑥𝑥.

7
on o 1

ity
rs e -W
⌊𝑥𝑥⌋ = 𝑛𝑛 ⇔ 𝑛𝑛 ∈ ℤ ∧ 𝑛𝑛 ≤ 𝑥𝑥 < 𝑛𝑛 + 1

rs
g
4
r
Examples:
R K 31 1/3 = 0, −4 = −4, 𝜋𝜋 = 3
TH
G
U
ye .
M

Definition: (Ceiling of real number x)


⌈𝑥𝑥⌉: =smallest integer which is no less than 𝑥𝑥.

⌈𝑥𝑥⌉ = 𝑛𝑛 ⇔ 𝑛𝑛 ∈ ℤ ∧ 𝑛𝑛 − 1 < 𝑥𝑥 ≤ 𝑛𝑛

Examples: 1/3 = 1, −4 = −4, 𝜋𝜋 = 4


27forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Floors and Mods

19 ive u )
20 n io (c
Theorem:
For all integers 𝑛𝑛 and positive integers 𝑑𝑑

7
𝒏𝒏 𝒅𝒅𝒅𝒅𝒅𝒅 𝒅𝒅 = 𝒏𝒏/𝒅𝒅

on o 1

ity
𝒏𝒏 𝒎𝒎𝒎𝒎𝒎𝒎 𝒅𝒅 = 𝒏𝒏 − 𝒅𝒅 𝒏𝒏/𝒅𝒅

rs e -W

rs
g
4
Proof (sketch):

r
R K 31
Let 𝑛𝑛 be an arbitrary integer and 𝑑𝑑 be an arbitrary positive integer.
TH
By correctness of division, there exist (unique) integers 𝑞𝑞, 𝑟𝑟, such that
G
U
𝑛𝑛 = 𝑑𝑑 ⋅ 𝒒𝒒 + 𝒓𝒓, 0 ≤ 𝑟𝑟 < 𝑑𝑑
ye .
M

We already know that 𝒒𝒒 = 𝒏𝒏 𝒅𝒅𝒅𝒅𝒅𝒅 𝒅𝒅 and that 𝒓𝒓 = 𝒏𝒏 𝒎𝒎𝒎𝒎𝒎𝒎 𝒅𝒅.


So it suffices to prove that
a) 𝑛𝑛 = 𝑑𝑑 ⋅ 𝒏𝒏/𝒅𝒅 + 𝒏𝒏 − 𝒅𝒅 ⋅ 𝒏𝒏/𝒅𝒅 (easy…)
b) 0 ≤ 𝒏𝒏 − 𝒅𝒅 ⋅ 𝒏𝒏/𝒅𝒅 < 𝑑𝑑.
𝑛𝑛
Since 𝑑𝑑 is positive, b) above is equivalent to − 1 < 𝑛𝑛/𝑑𝑑 , and this is
𝑑𝑑
true by the definition of the floor function.
28forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Relatively Prime Numbers

19 ive u )
Definition Integers 𝑎𝑎, 𝑏𝑏 are called relatively prime

20 n io (c
(co-prime) if gcd 𝑎𝑎, 𝑏𝑏 = 1.

7
on o 1

ity
rs e -W
Examples: gcd 3,5 = 1, gcd 10,11 = 1 , gcd 5,16 = 1

rs
g
4
r
Theorem:
R K 31
TH
If 1 is an integer combination of 𝑎𝑎, 𝑏𝑏, then 𝑎𝑎, 𝑏𝑏 are coprime.
G
U
Proof:
ye .
M

Let 𝑎𝑎, 𝑏𝑏 be arbitrary integers for which 1 = 𝑘𝑘𝑘𝑘 + 𝑙𝑙𝑙𝑙 for


some integers 𝑘𝑘, 𝑙𝑙.
Let 𝑑𝑑 = gcd 𝑎𝑎, 𝑏𝑏 . Since 𝑑𝑑|𝑎𝑎 and 𝑑𝑑|𝑏𝑏, we conclude 𝑑𝑑|1.
So 𝑑𝑑 = 1, as wanted. ∎
29forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
19 ive u )
20 n io (c 7
on o 1

ity
rs e -W

rs
g
4
r
Modular Arithmetic
R K 31
TH
G
U
ye .
M

30forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Motivation

Let’s Play a Mind-Reading Game


slide

19 ive u )
20 n io (c
Think of 3 digit integer, and call it x (example 587)

7
on o 1

ity
rs e -W

rs
Reorder it’s digits anyway you like and call the result y (example 875)

g
4
r
R K 31
Find the number |x-y|, and say it is represented with digits a,b,c.
TH
G
U
(example 875-587=288, so a,b,c are 2,8,8)
ye .
M

Tell me any two of the digits a,b,c.

Motivation 31forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
slide
Congruences – Modular Arithmetic
Motivation: What day will it be in 2 days from now?

19 ive u )
20 n io (c
… in 9 days from now?

7
… in 16 days from now?

on o 1

ity
rs e -W
… in 700016 days from now?

rs
g
Definition: For all integers 𝑎𝑎, 𝑏𝑏, and positive integer 𝑚𝑚, we say that

4
r
R K 31
𝒂𝒂 is congruent to 𝒃𝒃 modulo m iff 𝑚𝑚|(𝑎𝑎 − 𝑏𝑏)
TH
G
U
Notation: We denote that 𝑎𝑎 is congruent to 𝑏𝑏 modulo m by a ≡ b(mod m )
We denote that 𝑎𝑎 is NOT congruent to 𝑏𝑏 modulo m by a ≡ b(mod m )
ye .
M

Example: 24 ≡ 4(mod 5), because 5 | (24 − 4)

− 3 ≡ 23(mod 13), because 13 | (−3 − 23)

24 ≡ 4(mod 6 ), because 6 | (24 − 4)


Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
(c) K. Georgiou, Ryerson University, 2019
Useful Properties on Congruences
Lemma: For all integers 𝑎𝑎, 𝑏𝑏, and positive integer 𝑚𝑚, we have that

19 ive u )
20 n io (c
there exist integer 𝑞𝑞 with a = b + m ⋅ q iff a ≡ b(mod m ) .

7
Proof: a ≡ b mod m is equivalent to 𝑚𝑚|(𝑎𝑎 − 𝑏𝑏),

on o 1

ity
rs e -W
which is equivalent to that there exist integer q with a − b = m ⋅ q .

rs
g
4
r
R K 31
Lemma: For all integers 𝑎𝑎, 𝑏𝑏, and positive integer 𝑚𝑚, we have that

𝑎𝑎, 𝑏𝑏 have same remainder when divided with 𝑚𝑚 iff a ≡ b(mod m ).


TH
G
U
Proof: (⇒ ) Division of 𝑎𝑎, 𝑏𝑏 with 𝑚𝑚 gives a = m ⋅ p + r , b = m ⋅ q + r
ye .
M

Hence, a − b = m ⋅ ( p − q ) , thus 𝑚𝑚|(𝑎𝑎 − 𝑏𝑏).

(⇐) Division of 𝑏𝑏 with 𝑚𝑚 gives unique quotient p and remainder 𝑟𝑟 < 𝑚𝑚 with b = m⋅ p + r
a ≡ b mod m implies that there exist integer 𝑞𝑞 with a − b = m ⋅ q .
Hence, a = b + m ⋅ q = m ⋅ p + r + m ⋅ q = m ⋅ ( p + q ) + r , which is exactly what
Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
we wanted (why?).
(c) K. Georgiou, Ryerson University, 2019
Applications - Implications
Lemma: For all integers 𝑎𝑎, 𝑏𝑏, and positive integer 𝑚𝑚, we have that

𝑎𝑎, 𝑏𝑏 have same remainder when divided with m iff a ≡ b(mod m ).

19 ive u )
20 n io (c 7
Important Implication - Example: Consider the set of integers:

on o 1

ity
rs e -W
{...,−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,...}

rs
g
4
r
R K 31
When dividing with 6, there are only six different possibilities for remainders.

{... − 18,−12,−6,0,6,12,18,...} a ≡ 0(mod 6 )


TH
Remainder 0 G
U
Z
{... − 17,−11,−5,1,7,13,19,...} a ≡ 1(mod 6 )
ye .
Remainder 1
M

Remainder 2 {... − 16,−10,−4,2,8,14,20,...} a ≡ 5(mod 6 )


a ≡ 4(mod 6 )
Remainder 3 {... − 15,−9,−3,3,9,15,21,...} a ≡ 3(mod 6 )
Remainder 4 {... − 14,−8,−2,4,10,16,22,...}
a ≡ 2(mod 6 )
Remainder 5 {... − 13,−7,−1,5,11,17,23,...}
Congruence modulo 6, partitions Z into 6 classesSharing
of and/or posting online this manuscript, or parts of it, are strictly forbidden.
“equivalent integers”.
(c) K. Georgiou, Ryerson University, 2019
Least Positive Residue

19 ive u )
20 n io (c
Examples

7
on o 1

ity
−3 ≡ 2 𝑚𝑚𝑚𝑚𝑚𝑚 5 , 18 ≡ 0 𝑚𝑚𝑚𝑚𝑚𝑚 6

rs e -W

rs
g
4
Theorem ∀𝑛𝑛 ∈ ℤ>0 , ∀𝑎𝑎 ∈ ℤ, ∃! 𝑟𝑟 ∈ 0,1, … , 𝑛𝑛 − 1 ,

r
R K 31
𝑎𝑎 ≡ 𝑟𝑟 𝑚𝑚𝑚𝑚𝑚𝑚 𝑛𝑛 .
TH
G
U
Proof
ye .
M

𝑎𝑎 is the dividend, 𝑛𝑛 the divisor, r is the remainder. ∎

Definition
The unique 𝑟𝑟 above is called the least positive residue.
35forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Equivalence Relations

19 ive u )
20 n io (c
Theorem: For all integers a,b, and positive integer m,

Reflixivity a ≡ a (mod m )

7
on o 1

ity
Symmetry a ≡ b(mod m ) ↔ b ≡ a (mod m )

rs e -W

rs
Transitivity (a ≡ b(mod m ) ∧ b ≡ c(mod m )) → a ≡ c(mod m )

g
4
r
R K 31
Proof: (sketch)
TH
G
U
…of reflixivity: m | ( a − a ) .
ye .
M

…of symmetry: (m | (a − b) ) ↔ (m | (b − a ) ) .

…of transitivity: (m|(a-b) ∧ m|(b-c)) → m | ( a − b + b − c) .

Definition: Because congruence modulo m satisfies Reflixivity, Symmetry


and Transitivity, it is called an equivalence relation.
Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
(c) K. Georgiou, Ryerson University, 2019
Some Natural and Intuitive Properties
Proposition: For all integers a,b, and m>0,a ≡ b(mod m ) is equivalent to all:

19 ive u )
i) there exist integer 𝑞𝑞 with a = b + m ⋅ q .

20 n io (c
ii) m | (a − b )

7
on o 1

ity
iii) 𝑎𝑎, 𝑏𝑏 have same remainder when divided with m.

rs e -W

rs
g
Theorem: For all integers 𝑎𝑎, 𝑏𝑏, 𝑎𝑎𝑎, 𝑏𝑏𝑏 and 𝑚𝑚 > 0, we have

4
r
R K 31
a ≡ a ' (mod m ) (i) a + b ≡ a '+b' (mod m )
TH
G (ii) a − b ≡ a '−b' (mod m )

U
imply
b ≡ b' (mod m )
(iii) a ⋅ b ≡ a '⋅b' (mod m )
ye .
M

Proof: (i) a ≡ a ' mod m means a = a '+ m ⋅ q for some integer 𝑞𝑞 .

b ≡ b' mod m means b = b'+ m ⋅ p for some integer 𝑝𝑝 .

But then a + b = a '+b'+ m ⋅ (q + p ) which means a + b ≡ a '+b' (mod m )

Similarly we show (ii) and (iii) … Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
(c) K. Georgiou, Ryerson University, 2019
Examples on Congruences

19 ive u )
20 n io (c
Example For all integers 𝑥𝑥 show that

7
on o 1
4𝑥𝑥 ≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 7 iff 𝑥𝑥 ≡ 2 𝑚𝑚𝑚𝑚𝑚𝑚 7

ity
rs e -W
Solution:

rs
Let 𝑥𝑥 be arbitrary.

g
4
⇒ If 4𝑥𝑥 ≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 7 , then 8𝑥𝑥 ≡ 2 𝑚𝑚𝑚𝑚𝑚𝑚 7 .

r
R K 31
But 8𝑥𝑥 ≡ 7𝑥𝑥 + 𝑥𝑥 ≡ 𝑥𝑥 (𝑚𝑚𝑚𝑚𝑚𝑚 7).
TH
G
U
⇐ If 𝑥𝑥 ≡ 2 𝑚𝑚𝑚𝑚𝑚𝑚 7 , then 4𝑥𝑥 ≡ 8 ≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 7 .
ye .
M

Example Find the remainder when 14 ⋅ 25 is divided by 3.


Rephrase: Find the least positive residue of 14 ⋅ 25 mod 3 .
Solution: 14 ≡ 2 𝑚𝑚𝑚𝑚𝑚𝑚 3 and 25 ≡ 1(𝑚𝑚𝑚𝑚𝑚𝑚 3). Hence,
14 ⋅ 25 ≡ 2 ⋅ 1 ≡ 2 (𝑚𝑚𝑚𝑚𝑚𝑚 3).
So the remainder is 2.

38forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
More Examples (2)
1001
Example: Find the second to last digit of 46 .

19 ive u )
Solution: Question asks to find the second to last digit of 461001 (mod 100 ) .

20 n io (c 7
We observe that 46 ≡ 46 (mod 100 )

on o 1
This shows that

ity
rs e -W
46 2 ≡ 2116 ≡ 16 (mod 100 ) 46 n +5 ≡ 46 n (mod 100 )

rs
463 ≡ 97336 ≡ 36(mod 100 )

g
4
for n≥2.

r
R K 31
46 4 ≡ 4477456 ≡ 56(mod 100 ) This shows that
TH
G
U
465 ≡ 205962976 ≡ 76(mod 100 ) 46 n +5⋅k ≡ 46 n (mod 100 )
ye .
M

466 ≡ 9474296896 ≡ 96(mod 100 ) for n≥2.

467 ≡ 435817657216 ≡ 16(mod 100 ) So we will use that

468 ≡ 20047612231936 ≡ 36(mod 100 ) 1001 = 200 ⋅ 5 + 1.

Then, 461001 ≡ 46 200⋅5+1 ≡

Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
(c) K. Georgiou, Ryerson University, 2019
More Examples (2)
1001
Example: Find the second to last digit of 46 .

19 ive u )
Solution: Question asks to find the second to last digit of 461001 (mod 100 ) .

20 n io (c 7
We observe that 46 ≡ 46 (mod 100 )

on o 1
This shows that

ity
rs e -W
46 2 ≡ 2116 ≡ 16 (mod 100 ) 46 n +5 ≡ 46 n (mod 100 )

rs
463 ≡ 97336 ≡ 36(mod 100 )

g
4
for n≥2.

r
R K 31
46 4 ≡ 4477456 ≡ 56(mod 100 ) This shows that
TH
G
U
465 ≡ 205962976 ≡ 76(mod 100 ) 46 n +5⋅k ≡ 46 n (mod 100 )
ye .
M

466 ≡ 9474296896 ≡ 96(mod 100 ) for n≥2.

467 ≡ 435817657216 ≡ 16(mod 100 ) So we will use that

468 ≡ 20047612231936 ≡ 36(mod 100 ) 1001 = 200 ⋅ 5 + 1.


1001 = 199 ⋅ 5 + 6.
Then, 461001 ≡ 46 200⋅5+1 ≡

461001 ≡ 46199⋅5+ 6 ≡ 466 ≡ 96(mod 100 ) Answer is 9.


Sharing and/or posting online this manuscript, or parts of it, are strictly forbidden.
(c) K. Georgiou, Ryerson University, 2019
Simplifying Powers

19 ive u )
20 n io (c
Example Find the last digit of 1312 .

7
on o 1

ity
rs e -W

rs
Solution:

g
4
r
R K 31
1312 ≡ 312 (𝑚𝑚𝑚𝑚𝑚𝑚 10)
TH
G
U
32 ≡ 9 ≡ −1 (𝑚𝑚𝑚𝑚𝑚𝑚 10)
ye .
M

Hence, 1312 ≡ 312


≡ 32 6
≡ −1 6
≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 10 .
41forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Some Reminders

19 ive u )
20 n io (c
Already Proved

7
on o 1

ity
For all integers 𝑎𝑎, 𝑏𝑏 and positive integer 𝑚𝑚, the following are

rs e -W
equivalent

rs
g
• 𝑎𝑎 ≡ 𝑏𝑏 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑚𝑚)

4
r
R K 31
• 𝑎𝑎, 𝑏𝑏 have the same remainder when divided by 𝑚𝑚
TH
G
U
• 𝑚𝑚|(𝑎𝑎 − 𝑏𝑏)
• 𝑎𝑎 = 𝑞𝑞𝑞𝑞 + 𝑏𝑏, for some integer 𝑞𝑞.
ye .
M

Already defined
𝑏𝑏 is the least positive residue of 𝑎𝑎 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑚𝑚) if
𝑎𝑎 ≡ 𝑏𝑏 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑚𝑚) and 0 ≤ 𝑏𝑏 < 𝑚𝑚.

42forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Simplifying Powers

19 ive u )
20 n io (c
Example Find the last digit of 22012 .
(Find least positive residue of 22012 𝑚𝑚𝑚𝑚𝑚𝑚 10 )

7
on o 1

ity
rs e -W
Solution: 21 ≡ 𝟐𝟐(𝒎𝒎𝒎𝒎𝒎𝒎 𝟏𝟏𝟏𝟏)

rs
g
4
22 ≡ 4(𝑚𝑚𝑚𝑚𝑚𝑚 10)

r
R K 31
23 ≡ 22 ⋅ 2 = 4 ⋅ 2 ≡ 8(𝑚𝑚𝑚𝑚𝑚𝑚 10)
TH
G
U
24 ≡ 23 ⋅ 2 = 8 ⋅ 2 ≡ 16 ≡ 6(𝑚𝑚𝑚𝑚𝑚𝑚 10)
25 ≡ 24 ⋅ 2 = 6 ⋅ 2 ≡ 12 ≡ 𝟐𝟐(𝒎𝒎𝒎𝒎𝒎𝒎 𝟏𝟏𝟏𝟏)
ye .
M

Hence, 25 ≡ 29 ≡ 213 ≡ ⋯ ≡ 21 𝑚𝑚𝑚𝑚𝑚𝑚 10


Hence, 26 ≡ 210 ≡ 214 ≡ ⋯ ≡ 22 𝑚𝑚𝑚𝑚𝑚𝑚 10
In general, 24⋅𝑥𝑥+𝑟𝑟 = 2𝑟𝑟 (𝑚𝑚𝑚𝑚𝑚𝑚 10) for all 𝑟𝑟 = 1,2,3,4, and for all 𝑥𝑥.
So, 22012 ≡ 24⋅502+4 ≡ 24 ≡ 6(𝑚𝑚𝑚𝑚𝑚𝑚 10)
43forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Simplifying Powers

19 ive u )
20 n io (c
Example Find the remainder when

7
172018 is divided by 5.

on o 1

ity
rs e -W
Solution:

rs
g
4
Least positive residue of 172018 𝑚𝑚𝑚𝑚𝑚𝑚 5 =?

r
R K 31
Or equivalently of 22018 𝑚𝑚𝑚𝑚𝑚𝑚 5 =?
TH
G
U
21 ≡ 2(𝑚𝑚𝑚𝑚𝑚𝑚 5)
ye .
M

22 ≡ 4 (𝑚𝑚𝑚𝑚𝑚𝑚 5)
23 ≡ 22 ⋅ 2 ≡ 4 ⋅ 2 ≡ 8 ≡ 3 (𝑚𝑚𝑚𝑚𝑚𝑚 5)
2𝟒𝟒 ≡ 23 ⋅ 2 ≡ 3 ⋅ 2 ≡ 6 ≡ 𝟏𝟏 (𝒎𝒎𝒎𝒎𝒎𝒎 𝟓𝟓)
Hence, 22018 = 24⋅504+2 ≡ 24 504 22 ≡ 1504 22 ≡ 4 𝑚𝑚𝑚𝑚𝑚𝑚 5 .
44forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
19 ive u )
20 n io (c 7
on o 1

ity
rs e -W

rs
g
4
Rules of Divisibility

r
R K 31
TH

(Time Permitting)
G
U
ye .
M

45forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
High Level Goal

19 ive u )
20 n io (c
Given 𝑛𝑛, 𝑑𝑑: Find conditions regarding 𝑛𝑛’s digits that

7
on o 1

ity
guarantee divisibility by 𝑑𝑑?

rs e -W

rs
g
4
r
R K 31
Example: Is 428374567810 divisible by 10?
TH
G
U
ye .
M

Observation:
Integer 𝑛𝑛 is divisible by 10 iff it’s right-most digit is 0.

46forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Divisibility by 2

19 ive u )
20 n io (c
Example: Is 428374567817 divisible by 2?

7
on o 1

ity
rs e -W
Proposition:

rs
𝑛𝑛 = 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100

g
4
r
R K 31
is divisible by 2 iff 𝑎𝑎0 is even.
TH
G
U
ye .
Proof: Will find least positive residue of 𝑛𝑛(𝑚𝑚𝑚𝑚𝑚𝑚 2).
M

𝑛𝑛 ≡ 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100 𝑚𝑚𝑚𝑚𝑚𝑚 2


≡ 10 𝑎𝑎𝑘𝑘 10𝑘𝑘−1 + ⋯ + 𝑎𝑎2 101 + 𝑎𝑎1 + 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 2
≡ 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 2
≡ 0 𝑚𝑚𝑚𝑚𝑚𝑚 2 iff 𝑎𝑎0 = 0,2,4,6,8. ∎
47forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Divisibility by 5

19 ive u )
20 n io (c
Example: Is 428374567815 divisible by 5?

7
on o 1

ity
rs e -W
Proposition:

rs
𝑛𝑛 = 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100

g
4
r
R K 31
is divisible by 5 iff 𝑎𝑎0 is 0 or 5.
TH
G
U
ye .
Proof: Will find least positive residue of 𝑛𝑛(𝑚𝑚𝑚𝑚𝑚𝑚 5).
M

𝑛𝑛 ≡ 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100 𝑚𝑚𝑚𝑚𝑚𝑚 5


≡ 10 𝑎𝑎𝑘𝑘 10𝑘𝑘−1 + ⋯ + 𝑎𝑎2 101 + 𝑎𝑎1 + 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 5
≡ 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 5
≡ 0 𝑚𝑚𝑚𝑚𝑚𝑚 5 iff 𝑎𝑎0 = 0,5. ∎
48forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Divisibility by 4

19 ive u )
20 n io (c
Example: Is 428374567814 divisible by 4?

7
Answer: No because 𝟒𝟒 ∤ 𝟏𝟏𝟏𝟏.

on o 1

ity
rs e -W
Proposition:

rs
𝑛𝑛 = 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100

g
4
r
R K 31
is divisible by 4 iff 𝑎𝑎1 101 + 𝑎𝑎0 is divisible by 4.
TH
G
U
ye .
Proof: Will find least positive residue of 𝑛𝑛(𝑚𝑚𝑚𝑚𝑚𝑚 4).
M

𝑛𝑛 ≡ 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100 𝑚𝑚𝑚𝑚𝑚𝑚 4


≡ 100 𝑎𝑎𝑘𝑘 10𝑘𝑘−2 + ⋯ + 𝑎𝑎2 100 + 𝑎𝑎1 10 + 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 4
≡ 𝑎𝑎1 10 + 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 4

49forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Divisibility by 3

19 ive u )
20 n io (c
Example: Is 428374567814 divisible by 3?

7
Answer: 𝟒𝟒 + 𝟐𝟐 + 𝟖𝟖 + 𝟑𝟑 + 𝟕𝟕 + 𝟒𝟒 + 𝟓𝟓 + 𝟔𝟔 + 𝟕𝟕 + 𝟖𝟖 + 𝟏𝟏 + 𝟒𝟒 = 𝟓𝟓𝟓𝟓 and 𝟑𝟑 ∤ 𝟓𝟓𝟓𝟓

on o 1

ity
Proposition:

rs e -W

rs
𝑛𝑛 = 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100

g
4
r
R K 31
is divisible by 3 iff 𝑎𝑎𝑘𝑘 + 𝑎𝑎𝑘𝑘−1 + ⋯ + 𝑎𝑎1 + 𝑎𝑎0 is divisible by 3.
TH
G
U
Proof: Will find least positive residue of 𝑛𝑛(𝑚𝑚𝑚𝑚𝑚𝑚 3).
ye .
M

Observe that 10 ≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 3 , hence


𝑛𝑛 ≡ 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100 𝑚𝑚𝑚𝑚𝑚𝑚 3
≡ 𝑎𝑎𝑘𝑘 + 𝑎𝑎𝑘𝑘−1 + ⋯ + 𝑎𝑎1 + 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 3

50forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Divisibility by 9

19 ive u )
20 n io (c
Example: Is 428374567814 divisible by 𝟗𝟗?

7
Answer: 𝟒𝟒 + 𝟐𝟐 + 𝟖𝟖 + 𝟑𝟑 + 𝟕𝟕 + 𝟒𝟒 + 𝟓𝟓 + 𝟔𝟔 + 𝟕𝟕 + 𝟖𝟖 + 𝟏𝟏 + 𝟒𝟒 = 𝟓𝟓𝟓𝟓 and 𝟗𝟗 ∤ 𝟓𝟓𝟓𝟓

on o 1

ity
Proposition:

rs e -W

rs
𝑛𝑛 = 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100

g
4
r
R K 31
is divisible by 𝟗𝟗 iff 𝑎𝑎𝑘𝑘 + 𝑎𝑎𝑘𝑘−1 + ⋯ + 𝑎𝑎1 + 𝑎𝑎0 is divisible by 𝟗𝟗.
TH
G
U
Proof: Will find least positive residue of 𝑛𝑛(𝑚𝑚𝑚𝑚𝑚𝑚 𝟗𝟗).
ye .
M

Observe that 10 ≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 𝟗𝟗 , hence


𝑛𝑛 ≡ 𝑎𝑎𝑘𝑘 10𝑘𝑘 + ⋯ + 𝑎𝑎2 102 + 𝑎𝑎1 101 + 𝑎𝑎0 100 𝑚𝑚𝑚𝑚𝑚𝑚 𝟗𝟗
≡ 𝑎𝑎𝑘𝑘 + 𝑎𝑎𝑘𝑘−1 + ⋯ + 𝑎𝑎1 + 𝑎𝑎0 𝑚𝑚𝑚𝑚𝑚𝑚 𝟗𝟗

51forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019
Back to the Magic Trick

19 ive u )
20 n io (c
Proposition:

7
on o 1

ity
Let 𝑥𝑥 = 𝑎𝑎2 100 + 𝑎𝑎1 10 + 𝑎𝑎0 .

rs e -W

rs
Let 𝑦𝑦 = 𝑎𝑎1 100 + 𝑎𝑎0 10 + 𝑎𝑎2 .

g
4
r
Let 𝑥𝑥 − 𝑦𝑦 = 𝑏𝑏2 100 + 𝑏𝑏1 10 + 𝑏𝑏0 .
R K 31
Then 𝑏𝑏2 + 𝑏𝑏1 + 𝑏𝑏0 is divisible by 9.
TH
G
U
ye .
M

Example:
𝑥𝑥 = 587, 𝑦𝑦 = 875
𝑥𝑥 − 𝑦𝑦 = 288
2 + 8 + 8 = 18 = 0 𝑚𝑚𝑚𝑚𝑚𝑚 9
52forbidden.
Sharing and/or posting online this manuscript, or parts of it, are strictly
(c) K. Georgiou, Ryerson University, 2019

You might also like