MTH314: Discrete Mathematics for Engineers Lecture 6: Divisibility - - PowerPoint PPT Presentation

mth314 discrete mathematics for engineers
SMART_READER_LITE
LIVE PREVIEW

MTH314: Discrete Mathematics for Engineers Lecture 6: Divisibility - - PowerPoint PPT Presentation

MTH314: Discrete Mathematics for Engineers Lecture 6: Divisibility Dr Ewa Infeld Ryerson University Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers Divisibility: Definition Definition Let a , b Z . We say that


slide-1
SLIDE 1

MTH314: Discrete Mathematics for Engineers

Lecture 6: Divisibility Dr Ewa Infeld

Ryerson University

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-2
SLIDE 2

Divisibility: Definition

Definition Let a, b ∈ Z. We say that a divides b if there exists an integer q such that aq = b. Does 6 divide 0? What numbers divide 4? Does 0 divide 6? Does 1 divide 1? Does 5 divide 12? Does 12 divide 6?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-3
SLIDE 3

Divisibility: Definition

Definition Let a, b ∈ Z. We say that a divides b if there exists an integer q such that a · q = b. Does 6 divide 0?

  • YES. Take q = 0, then 6 · 0 = 0

What numbers divide 4?

  • 4, -2, -1, 1, 2, 4

Does 0 divide 6?

  • NO. There’s q ∈ Z such that 0 · q = 6.

Does 1 divide 1?

  • YES. Take q = 1, get 1 · 1 = 1.

Does 5 divide 12?NO. There is no q ∈ Z such that 12 · q = 5. Does 12 divide 6?NO. There is no q ∈ Z such that 12 · q = 6.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-4
SLIDE 4

Divisibility: Notation

Definition Let a, b ∈ Z. We say that a divides b and write a|b if there exists an integer q such that a · q = b. If a does not divide b, we write a | b. 6|0 −4|4, −2|4, −1|4, 1|4, 2|4, 4|4 0 | 6 1|1 5 | 12 12 | 6

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-5
SLIDE 5

Divisibility: Notation

Definition (Divisibility, in words) Let a, b ∈ Z. We say that a divides b and write a|b if there exists an integer q such that a · q = b. If a does not divide b, we write a | b. Definition (Divisibility, in symbols) Let a, b ∈ Z. Then: a|b ↔ ∃q ∈ Z, b = q · a

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-6
SLIDE 6

Divisibility: Notation

Theorem ∀a, b, c ∈ Z : (a|b) ∧ (b|c) → a|c

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-7
SLIDE 7

Divisibility: Notation

Theorem ∀a, b, c ∈ Z : (a|b) ∧ (b|c) → a|c Proof: We know that a|b and b|c. So there exist some integers q1, q2 such that: a · q1 = b b · q2 = c.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-8
SLIDE 8

Divisibility: Notation

Theorem ∀a, b, c ∈ Z : (a|b) ∧ (b|c) → a|c Proof: We know that a|b and b|c. So there exist some integers q1, q2 such that: a · q1 = b b · q2 = c. Then c = b · q2 = (a · q1) · q2 = a · (q1 · q2).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-9
SLIDE 9

Divisibility: Notation

Theorem ∀a, b, c ∈ Z : (a|b) ∧ (b|c) → a|c Proof: We know that a|b and b|c. So there exist some integers q1, q2 such that: a · q1 = b b · q2 = c. Then c = b · q2 = (a · q1) · q2 = a · (q1 · q2). Since the product q1 · q2 is an integer, we get a|c.

  • Dr Ewa Infeld

Ryerson University MTH314: Discrete Mathematics for Engineers

slide-10
SLIDE 10

Integer combination

Definition Let a, b ∈ Z. Then for all x, y ∈ Z, x · a + y · b is an integer, and it is called an integer combination of a and b. Example: for any x, y ∈ Z, x · 5 + y · 6 is an integer combination of 5 and 6. Any integers acan be plugged in for x and y, for example: 0 · 5 + 1 · 6, −14 · 5 + 23861 · 6, 10 · 5 − 90 · 6 . . .

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-11
SLIDE 11

Integer combination

Definition Let a, b ∈ Z. Then for all x, y ∈ Z, x · a + y · b is an integer, and it is called an integer combination of a and b. Example: for any x, y ∈ Z, x · 5 + y · 6 is an integer combination of 5 and 6. If c ∈ Z divides both a and b, then c divides any integer combination of a and b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-12
SLIDE 12

Theorem ∀a, b, c ∈ Z, if c divides both a and b, then c divides any integer combination of a and b. Proof:

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-13
SLIDE 13

Theorem ∀a, b, c ∈ Z, if c divides both a and b, then c divides any integer combination of a and b. Proof: We know that c|a and c|b. So there exist some integers q1, q2 such that c · q1 = a, c · q2 = b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-14
SLIDE 14

Theorem ∀a, b, c ∈ Z, if c divides both a and b, then c divides any integer combination of a and b. Proof: We know that c|a and c|b. So there exist some integers q1, q2 such that c · q1 = a, c · q2 = b. Then for any integer combination x · a + y · b we have: x · c · q1 + y · c · q2 = c · (x · q1 + y · q2) And so, since x · q1 + y · q2 ∈ Z, c divides x · a + y · b.

  • Dr Ewa Infeld

Ryerson University MTH314: Discrete Mathematics for Engineers

slide-15
SLIDE 15

Remainders

Theorem Let a, b ∈ Z with b > 0. Then there exist unique integers q, r with 0 ≤ r < b such that: a = b · q + r.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-16
SLIDE 16

Remainders

Theorem Let a, b ∈ Z with b > 0. Then there exist unique integers q, r with 0 ≤ r < b such that: a = b · q + r. If 0 ≤ a < b, what is q? What is r? If a = −1, what are q and r? Can you explain how we find q and r in general?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-17
SLIDE 17

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-18
SLIDE 18

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1). Base case: n = 0. 22·0 − 1 = 1 − 1 = 0

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-19
SLIDE 19

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1). Base case: n = 0. 22·0 − 1 = 1 − 1 = 0 Inductive step: assume that 3|(22n − 1). Want to show that 3|(22(n+1) − 1). 22(n+1) − 1 = 22n+2 − 1 = 4 · 22n − 1 = 3 · 22n + 22n − 1

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-20
SLIDE 20

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1). Base case: n = 0. 22·0 − 1 = 1 − 1 = 0 Inductive step: assume that 3|(22n − 1). Want to show that 3|(22(n+1) − 1). 22(n+1) − 1 = 22n+2 − 1 = 4 · 22n − 1 = 3 · 22n + 22n − 1

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-21
SLIDE 21

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1). Base case: Let n = 0. 22·0 − 1 = 1 − 1 = 0 Inductive step: assume that for some k ∈ N, 3|(22k − 1). Want to show that 3|(22(k+1) − 1). 22(k+1) − 1 = 22k+2 − 1 = 4 · 22k − 1 = 3 · 22k + 22k − 1

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-22
SLIDE 22

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1). Base case: n = 0. 22·0 − 1 = 1 − 1 = 0 Inductive step: assume that for some k ∈ N, 3|(22k − 1). Want to show that 3|(22(k+1) − 1). 22(k+1) − 1 = 22k+2 − 1 = 4 · 22k − 1 = 3 · 22k + 22k − 1

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-23
SLIDE 23

Induction and divisibility

Prove by induction that: ∀n ∈ N, 3|(22n − 1). Base case: n = 0. 22·0 − 1 = 1 − 1 = 0 Inductive step: assume that for some k ∈ N, 3|(22k − 1). Want to show that 3|(22(k+1) − 1). 22(k+1) − 1 = 22k+2 − 1 = 4 · 22k − 1 = 3 · 22k + 22k − 1 3 · 22k has to be divisible by 3, since it’s 3 times 22k, an integer. 22k − 1 is divisible by 3 by inductive hypothesis. By the principle of mathematical induction, we conclude that ∀n ∈ N, 3|(22n − 1).

  • Dr Ewa Infeld

Ryerson University MTH314: Discrete Mathematics for Engineers

slide-24
SLIDE 24

Set of divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-25
SLIDE 25

Set of divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b. Examples: D4 = {−4, −2, −1, 1, 2, 4}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-26
SLIDE 26

Common divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b. Examples: D4 = {−4, −2, −1, 1, 2, 4} = D4 = {±1, ±2, ±4}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-27
SLIDE 27

Common divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b. Examples: D4 = {−4, −2, −1, 1, 2, 4} = D4 = {±1, ±2, ±4} D15 = {±1, ±3, ±5, ±15}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-28
SLIDE 28

Set of divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b. Examples: D4 = {−4, −2, −1, 1, 2, 4} = D4 = {±1, ±2, ±4} D15 = {±1, ±3, ±5, ±15}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-29
SLIDE 29

Set of divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b. Examples: D4 = {−4, −2, −1, 1, 2, 4} = D4 = {±1, ±2, ±4} D15 = {±1, ±3, ±5, ±15} D7 = {±1, ±7}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-30
SLIDE 30

Set of divisors

Definition (divisor) If a, b ∈ Z and a|b then a is a divisor or b. Definition (set of divisors) We will denote the set of all divisors of b by Db, with a ∈ Db if and only if a is a divisor of b. Examples: D4 = {−4, −2, −1, 1, 2, 4} = D4 = {±1, ±2, ±4} D15 = {±1, ±3, ±5, ±15} D7 = {±1, ±7}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-31
SLIDE 31

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

113 100 112 Can you think of an efficient way to do this?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-32
SLIDE 32

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

D−12 = {±1, ±2, ±3, ±4, ±6, ±12} 113 D113 = {±1, ±113} 100 D100 = {±1, ±2, ±4, ±5, ±10, ±20, ±25, ±50, ±100} 112 D112 = {±1, ±2, ±4, ±7, ±8, ±14, ±16, ±28, ±56, ±112} Can you think of an efficient way to do this?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-33
SLIDE 33

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

D−12 = {±1, ±2, ±3, ±4, ±6, ±12} 113 D113 = {±1, ±113} D100 = {±1, ±2, ±4, ±5, ±10, ±20, ±25, ±50, ±100} 112 D112 = {±1, ±2, ±4, ±7, ±8, ±14, ±16, ±28, ±56, ±112} Can you think of an efficient way to do this? 112 = 2 × 56

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-34
SLIDE 34

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

D−12 = {±1, ±2, ±3, ±4, ±6, ±12} 113 D113 = {±1, ±113} 100 D100 = {±1, ±2, ±4, ±5, ±10, ±20, ±25, ±50, ±100} 112 D112 = {±1, ±2, ±4, ±7, ±8, ±14, ±16, ±28, ±56, ±112} Can you think of an efficient way to do this? 112 = 2 × 56 = 2 × 2 × 28

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-35
SLIDE 35

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

D−12 = {±1, ±2, ±3, ±4, ±6, ±12} 113 D113 = {±1, ±113} 100 D100 = {±1, ±2, ±4, ±5, ±10, ±20, ±25, ±50, ±100} 112 D112 = {±1, ±2, ±4, ±7, ±8, ±14, ±16, ±28, ±56, ±112} Can you think of an efficient way to do this? 112 = 2 × 56 = 2 × 2 × 28 = 2 × 2 × 2 × 2 × 14

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-36
SLIDE 36

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

D−12 = {±1, ±2, ±3, ±4, ±6, ±12} 113 D113 = {±1, ±113} 100 D100 = {±1, ±2, ±4, ±5, ±10, ±20, ±25, ±50, ±100} 112 D112 = {±1, ±2, ±4, ±7, ±8, ±14, ±16, ±28, ±56, ±112} Can you think of an efficient way to do this? 112 = 2 × 56 = 2 × 2 × 28 = 2 × 2 × 2 × 2 × 14 = 2 × 2 × 2 × 2 × 2 × 7

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-37
SLIDE 37

Set of divisors: Exercise

List all (integer) divisors of these numbers:

  • 12

D−12 = {±1, ±2, ±3, ±4, ±6, ±12} 113 D113 = {±1, ±113} 100 D100 = {±1, ±2, ±4, ±5, ±10, ±20, ±25, ±50, ±100} 112 D112 = {±1, ±2, ±4, ±7, ±8, ±14, ±16, ±28, ±56, ±112} Can you think of an efficient way to do this? 112 = 2 × 56 = 2 × 2 × 28 = 2 × 2 × 2 × 2 × 14 = 2 × 2 × 2 × 2 × 2 × 7 This is called the PRIME FACTORIZATION

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-38
SLIDE 38

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-39
SLIDE 39

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b} ±1 and ±b are always in the set.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-40
SLIDE 40

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b} ±1 and ±b are always in the set Db. ±2 are in the set Db if and only if b is even.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-41
SLIDE 41

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b} ±1 and ±b are always in the set Db. ±2 are in the set Db if and only if b is even. When Db = {±1, . . . , ±b}?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-42
SLIDE 42

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b} ±1 and ±b are always in the set Db. ±2 are in the set Db if and only if b is even. Proposition: Db = {±1, . . . , ±b} is and only if b ∈ {±1, ±2}.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-43
SLIDE 43

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b} ±1 and ±b are always in the set Db. ±2 are in the set Db if and only if b is even. Proposition: Db = {±1, . . . , ±b} is and only if b ∈ {±1, ±2}. Proof outline: First the “if” part, i.e. b ∈ {±1, ±2} ⇒ Db = {±1, . . . , ±b}: D1 = D−1 = {±1} D2 = D−2 = {±1, ±2}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-44
SLIDE 44

Set of divisors

For any b ∈ Z such that b = 0, the set Db is always finite. Db ⊆ {±1, ±2, . . . , ±b} ±1 and ±b are always in the set Db. ±2 are in the set Db if and only if b is even. Proposition: Db = {±1, . . . , ±b} is and only if b ∈ {±1, ±2}. Proof outline: First the “if” part, i.e. b ∈ {±1, ±2} ⇒ Db = {±1, . . . , ±b}: D1 = D−1 = {±1} D2 = D−2 = {±1, ±2}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-45
SLIDE 45

Set of divisors

Proposition: Db = {±1, . . . , ±b} is and only if b ∈ {±1, ±2}. Proof outline: First the “if” part, i.e. b ∈ {±1, ±2} ⇒ Db = {±1, . . . , ±b}: D1 = D−1 = {±1} D2 = D−2 = {±1, ±2} Now the “only if” part, i.e. Db = {±1, . . . , ±b} ⇒ b ∈ {±1, ±2}. Suppose for contratiction that this is also true for some b, where |b| ≥ 3. Let’s split it up two cases: b > 0 and b < 0. In the first case, b ≥ 3. Then if Db = {±1, . . . , ±b} ⇒ b ∈ {±1, ±2}, we have b − 1|b, so for some integer q > 1, q · (b − 1) = b. But if q ≥ 2, b ≥ 3, then q · (b − 1) ≥ 2b − 2 > b. The other case is analogous.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-46
SLIDE 46

Common divisors

If a, b ∈ Z, and their sets of divisors are respectively Da and Db, then their common divisors are the elements of: Da ∩ Db In other words, d ∈ Z is a common divisor of a and b if it divides both a and b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-47
SLIDE 47

Common divisors

If a, b ∈ Z, and their sets of divisors are respectively Da and Db, then their common divisors are the elements of: Da ∩ Db In other words, d ∈ Z is a common divisor of a and b if it divides both a and b. For any a, b ∈ Z, there exists a greatest common divisor, GCD(a, b). It’s the integer d that is the largest element of Da ∩ Db.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-48
SLIDE 48

Common divisors

If a, b ∈ Z, and their sets of divisors are respectively Da and Db, then their common divisors are the elements of: Da ∩ Db In other words, d ∈ Z is a common divisor of a and b if it divides both a and b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-49
SLIDE 49

Common divisors

If a, b ∈ Z, and their sets of divisors are respectively Da and Db, then their common divisors are the elements of: Da ∩ Db In other words, d ∈ Z is a common divisor of a and b if it divides both a and b. For any a, b ∈ Z, there exists a greatest common divisor, GCD(a, b). It’s the integer d that is the largest element of Da ∩ Db. Does d exist for any pair a, b? Is d unique for any pair a, b?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-50
SLIDE 50

Common divisors

If a, b ∈ Z, and their sets of divisors are respectively Da and Db, then their common divisors are the elements of: Da ∩ Db In other words, d ∈ Z is a common divisor of a and b if it divides both a and b. For any a, b ∈ Z, there exists a greatest common divisor, GCD(a, b). It’s the integer d that is the largest element of Da ∩ Db. Does d exist for any pair a, b? Is d unique for any pair a, b? Both of these things are true, so d = GCD(a, b) is well-defined.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-51
SLIDE 51

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-52
SLIDE 52

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Proof: We need to show that GCD(b, r) divides a, b and also that it’s the largest integer that does. It clearly divides b and r. Then, since a is an integer combination of b and r, it divides a.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-53
SLIDE 53

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Proof: We need to show that GCD(b, r) divides a, b and also that it’s the largest integer that does. It clearly divides b and r. Then, since a is an integer combination of b and r, it divides a. Now we know that GDC(b, r) is a common divisor of a, b, we need to show it’s the greatest one. So suppose for contradiction that there exists d such that d|a, d|b and d > GCD(b, r). So then d |r.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-54
SLIDE 54

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Proof: We need to show that GCD(b, r) divides a, b and also that it’s the largest integer that does. It clearly divides b and r. Then, since a is an integer combination of b and r, it divides a. Now we know that GDC(b, r) is a common divisor of a, b, we need to show it’s the greatest one. So suppose for contradiction that there exists d such that d|a, d|b and d > GCD(b, r). So then d |r. But we have a = q · b + r, so a − q · b = r. d clearly divides the LHS, but not the RHS so they can’t be equal! CONTRADICTION

  • Dr Ewa Infeld

Ryerson University MTH314: Discrete Mathematics for Engineers

slide-55
SLIDE 55

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Example: We want to find the GCD(159, 15). We have 159 = 10 · 15 + 9.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-56
SLIDE 56

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Example: We want to find the GCD(159, 15). We have: 159 = 10 · 15 + 9. So according to the theorem, GCD(159, 15) = GCD(15, 9) = 3.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-57
SLIDE 57

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Example: We want to find the GCD(159, 15). We have: 159 = 10 · 15 + 9. So according to the theorem, GCD(159, 15) = GCD(15, 9) = 3. If we weren’t sure it’s 3 yet, we can do one more step, because 15 = 9 + 6: GCD(159, 15) = GCD(15, 9) = GCD(9, 6)

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-58
SLIDE 58

Finding the Greatest Common Divisor (GCD)

Theorem Let a, b, q, r be integers, a, b not both 0, such that a = q · b + r. Then GCD(a, b) = GCD(b, r). Example: We want to find the GCD(159, 15). We have: 159 = 10 · 15 + 9. So according to the theorem, GCD(159, 15) = GCD(15, 9) = 3. If we weren’t sure it’s 3 yet, we can do more steps, because 15 = 9 + 6: GCD(159, 15) = GCD(15, 9) = GCD(9, 6) = GCD(6, 3) = 3

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-59
SLIDE 59

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-60
SLIDE 60

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-61
SLIDE 61

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595 So GCD(−4410, −5005) = GCD(4410, 595).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-62
SLIDE 62

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595 4410 = 7 · 595 + 245 So GCD(−4410, −5005) = GCD(595, 245).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-63
SLIDE 63

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595 4410 = 7 · 595 + 245 595 = 2 · 245 + 105 So GCD(−4410, −5005) = GCD(245, 105).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-64
SLIDE 64

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595 4410 = 7 · 595 + 245 595 = 2 · 245 + 105 245 = 2 · 105 + 35 So GCD(−4410, −5005) = GCD(105, 35).

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-65
SLIDE 65

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595 4410 = 7 · 595 + 245 595 = 2 · 245 + 105 245 = 2 · 105 + 35 105 = 3 · 35 So GCD(−4410, −5005) = GCD(105, 35) =.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-66
SLIDE 66

Euclidean Algorithm

This is the Euclidean Algorithm. We can efficiently find the GCD

  • f two integers a, b, |a| > |b| by finding the integers q, r such that

a = q · b + r, and repeating the process until ri = 0: Example: find the GCD(−4410, −5005). GCD(−4410, −5005) = GCD(4410, 5005) 5005 = 1 · 4410 + 595 4410 = 7 · 595 + 245 595 = 2 · 245 + 105 245 = 2 · 105 + 35 105 = 3 · 35 So GCD(−4410, −5005) = GCD(105, 35) = 35.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-67
SLIDE 67

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-68
SLIDE 68

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 4410 = 7 · 595 + 245 595 = 2 · 245 + 105 245 = 2 · 105 + 35 105 = 3 · 35

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-69
SLIDE 69

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 595 = 2 · 245 + 105 245 = 2 · 105 + 35 105 = 3 · 35

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-70
SLIDE 70

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 595 = 2 · 245 + 105 245 = 2 · 105 + 35 105 = 3 · 35

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-71
SLIDE 71

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 = 4410 − 7 · (5005 − 4410) 595 = 2 · 245 + 105 105 = 595 − 2 · 245 245 = 2 · 105 + 35 105 = 3 · 35

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-72
SLIDE 72

Good Characterization Theorem

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 = 4410 − 7 · (5005 − 4410) 595 = 2 · 245 + 105 105 = 595 − 2 · 245 245 = 2 · 105 + 35 35 = 245 − 2 · 105 105 = 3 · 35

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-73
SLIDE 73

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 = 4410 − 7 · (5005 − 4410) 595 = 2 · 245 + 105 105 = 595 − 2 · 245 = 5005 − 4410 − 2 · (4410 − 7 · 595) 245 = 2 · 105 + 35 35 = 245 − 2 · 105 105 = 3 · 35 35 = 245 − 2 · 105 = 4410 − 7 · 595 − 2 · (5005 − 4410 − 2 · (4410 − 7 · 595)) = 8·4410−7·5005−2·(15·5005−17·4410)) = 42·4410−37·5005

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-74
SLIDE 74

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 = 4410 − 7 · (5005 − 4410) 595 = 2 · 245 + 105 105 = 595 − 2 · 245 = 5005 − 4410 − 2 · (4410 − 7 · 595) 245 = 2 · 105 + 35 35 = 245 − 2 · 105 105 = 3 · 35 35 = 245 − 2 · 105 = 4410 − 7 · 595 = 8·4410−7·5005−2·(15·5005−17·4410)) = 42·4410−37·5005

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-75
SLIDE 75

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 = 4410 − 7 · (5005 − 4410) 595 = 2 · 245 + 105 105 = 595 − 2 · 245 = 5005 − 3 · 4410 + 14 · 595 245 = 2 · 105 + 35 35 = 245 − 2 · 105 105 = 3 · 35 35 = 245−2·105 = 4410 − 7 · 595−2·(5005 − 3 · 4410 + 14 · 595) = 8·4410−7·5005−2·(15·5005−17·4410)) = 42·4410−37·5005

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-76
SLIDE 76

the Extended Euclidean Algorithm

GCD(a, b) is an integer combination of a, b. Go backwards with the Euclidean algorithm: 5005 = 1 · 4410 + 595 595 = 5005 − 4410 4410 = 7 · 595 + 245 245 = 4410 − 7 · 595 = 4410 − 7 · (5005 − 4410) 595 = 2 · 245 + 105 105 = 595 − 2 · 245 = 5005 − 3 · 4410 + 14 · 595 245 = 2 · 105 + 35 35 = 245 − 2 · 105 105 = 3 · 35 35 = 245−2·105 = 4410 − 7 · 595−2·(5005 − 3 · 4410 + 14 · 595) = 8·4410−7·5005−2·(15·5005−17·4410)) = 42·4410−37·5005

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-77
SLIDE 77

Good Characterization Theorem

We just expressed GCD(5005, 4410) = GCD(−5005, −4410) as a linear combination of 5005, 4410 (and thus also a linear combination of −5005, −4410): 35 = 42 · 4410 + (−37) · 5005 = (−42) · (−4410) + 37 · (−5005) using the Extended Euclidean Algorithm. Theorem (Good Characterization Theorem) Let a, b be integers not both 0. Then for an integer d > 0, we have: d|a and d|b and d is an integer combiantion of a, b ⇔ d = GCD(a, b)

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-78
SLIDE 78

Good Characterization Theorem

Theorem (Good Characterization Theorem) Let a, b be integers not both 0. Then for an integer d > 0, we have: d|a and d|b and d is an integer combiantion of a, b ⇔ d = GCD(a, b) By the Extended Euclidean Algorithm, we saw that we can express GCD(a, b) as an integer combination of a, b. To convince

  • urselves that the Good Characterization Theorem is true, we need

to show that no other positive common divisor of a, b can be expressed as an integer combination of a, b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-79
SLIDE 79

Good Characterization Theorem

Theorem (Good Characterization Theorem) Let a, b be integers not both 0. Then for an integer d > 0, we have: d|a and d|b and d is an integer combiantion of a, b ⇔ d = GCD(a, b) By the Extended Euclidean Algorithm, we saw that we can express GCD(a, b) as an integer combination of a, b. To convince

  • urselves that the Good Characterization Theorem is true, we need

to show that no other positive common divisor of a, b can be expressed as an integer combination of a, b. But any integer combination of a, b has to be divisible by GCD(a, b)!

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-80
SLIDE 80

Good Characterization Theorem

Theorem (Good Characterization Theorem) Let a, b be integers not both 0. Then for an integer d > 0, we have: d|a and d|b and d is an integer combiantion of a, b ⇔ d = GCD(a, b) By the Extended Euclidean Algorithm, we saw that we can express GCD(a, b) as an integer combination of a, b. To convince

  • urselves that the Good Characterization Theorem is true, we need

to show that no other positive common divisor of a, b can be expressed as an integer combination of a, b. But any integer combination of a, b has to be divisible by GCD(a, b)! Exercise: write out the formal proof.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-81
SLIDE 81

Coprime integers

Definition Two integers a, b are called coprime (or relatively prime) if GCD(a, b) = 1.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-82
SLIDE 82

Coprime integers

Definition Two integers a, b are called coprime (or relatively prime) if GCD(a, b) = 1. Are 13 and 60 coprime? Are 17 and 34 coprime? Can you find two even numbers that are coprime? If a, b are coprime, is 17 an integer combination of a and b?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-83
SLIDE 83

Coprime integers

Definition Two integers a, b are called coprime (or relatively prime) if GCD(a, b) = 1. Are 13 and 60 coprime? YES Are 17 and 34 coprime? NO, GCD(17, 34) = 17 Can you find two even numbers that are coprime? NO If a, b are coprime, is 17 an integer combination of a and b?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-84
SLIDE 84

Coprime integers

Definition Two integers a, b are called coprime (or relatively prime) if GCD(a, b) = 1. Are 13 and 60 coprime? YES Are 17 and 34 coprime? NO, GCD(17, 34) = 17 Can you find two even numbers that are coprime? NO If a, b are coprime, is 17 an integer combination of a and b? Suppose a, b are coprime. Then by Good Characterization Theorem, 1 is an integer combination of a, b. So there exist some integers q1, q2 such that 1 = q1 · a + q2 · b. Then: 17 = (17q1) · a + (17q2) · b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-85
SLIDE 85

Coprime integers

Definition Two integers a, b are called coprime (or relatively prime) if GCD(a, b) = 1. In other words, a, b are coprime iff 1 is an integer combination od a and b. Equivalently, a, b are coprime iff any (∀) integer c is an integer combination od a and b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-86
SLIDE 86

Coprime integers

Definition Two integers a, b are called coprime (or relatively prime) if GCD(a, b) = 1. In other words, a, b are coprime iff 1 is an integer combination od a and b. Equivalently, a, b are coprime iff any (∀) integer c is an integer combination od a and b. Theorem Let a, b, c be integers such that c|ab and a, c are coprime, and c |a. Then c|b. Example: if ab is even, and a is odd then b is even. (c = 2)

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-87
SLIDE 87

Theorem Let a, b be integers not both 0. Then if d = GCD(a, b), we have: GCD( a d , b d ) = 1. Example: We know that GCD(5005, 4410) = 35. Then 5005

35 = 143

and 4410

35 = 126 are coprime.

Verify by the Euclidean Algorithm: 143 = 126 + 17 126 = 7 · 17 + 7 17 = 2 · 7 + 3 7 = 2 · 3 + 1

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-88
SLIDE 88

Theorem Let m, n, a be integers. Then if m|a, n|a, and d = GCD(m, n), we have: m · n d |a. Example: Let m = 4, n = 12, a = 24. Then the premises are fulfilled, i.e. 4|24 and 12|24. Notice that m · n |a. We have d = GCD(4, 12) = 4. Then: m · n d = 4 · 12 4 = 12, and 12 indeed divides 24. Corollary In the setup above, if m, n are coprime then m · n|a.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-89
SLIDE 89

Linear Diophantine Equations

Definition A linear equation with integer coefficients for which we are looking

  • nly for integer solutions is called a Linear Diophantine Equation

(LDE.) Examples: Find all integer solutions x, y of the equation 2x + 14y = 9 There are none. An integer combination of 2 and 14 will always be even. Find all integer solutions x, y of the equation 17x + 3y = 14 x = 1, y = −1 Find all integer solutions x of the equation 10x = 2015 There are none. An equation of the form ax = b, a, b ∈ Z has integer solutions iff a|b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-90
SLIDE 90

Linear Diophantione Equations

Definition A linear equation with integer coefficients for which we are looking

  • nly for integer solutions is called a Linear Diophantine Equation

(LDE.) Examples: Find all integer solutions x, y of the equation 2x + 14y = 9 There are none. An integer combination of 2 and 14 will always be even. Find all integer solutions x, y of the equation 17x + 3y = 14 x = 1, y = −1 x = 4, y = −18 maybe more? Find all integer solutions x of the equation 10x = 2015 There are none. An equation of the form ax = b, a, b ∈ Z has integer solutions iff a|b.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-91
SLIDE 91

2x + 14y = 9

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-92
SLIDE 92

2x + 14y = 9

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-93
SLIDE 93

17x + 3y = 14

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-94
SLIDE 94

17x + 3y = 14

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-95
SLIDE 95

Complete solution of the LDE

Definition For LDEs of the form ax + by = c , we call the set of its integer solutions S = {(xi, yi) ∈ Z × Z : axi + byi = c} the complete solution of the LDE. Infinitely many solutions exist if GCD(a, b)|c. Otherwise no solutions exist. If x0, y0 is a solution, then so is: xn = x0 + b GCD(a, b)n, yn = y0 − a GCD(a, b)n for any n ∈ Z

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-96
SLIDE 96

Solving LDEs Summary

To solve a Linear Diophantine Equation given in the form a · x + b · y = c, you need to: Check that solutions exist (i.e. that GCD(a, b)|c) Express the GCD(a, b) as a linear combination of a, b. Multiply this expression by

c GCD(a,b) to get one solution.

If x0, y0 is a solution, then so is: xn = x0 + b GCD(a, b)n, yn = y0 − a GCD(a, b)n for any n ∈ Z Your solution is an expression for the complete set.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-97
SLIDE 97

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-98
SLIDE 98

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. First we need to find GCD(97, 35) and make sure that it divides 13.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-99
SLIDE 99

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. First we need to find GCD(97, 35) and make sure that it divides 13. 97 = 2 · 35 + 27

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-100
SLIDE 100

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. First we need to find GCD(97, 35) and make sure that it divides 13. 97 = 2 · 35 + 27 35 = 27 + 8 27 = 3 · 8 + 3 8 = 2 · 3 + 2 3 = 2 + 1 GCD(97, 35) = 1

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-101
SLIDE 101

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. First we need to find GCD(97, 35) and make sure that it divides 13. 97 = 2 · 35 + 27 35 = 27 + 8 27 = 3 · 8 + 3 8 = 2 · 3 + 2 3 = 2 + 1 GCD(97, 35) = 1 1|13

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-102
SLIDE 102

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. First we need to find GCD(97, 35) and make sure that it divides 13. 97 = 2 · 35 + 27 27 = 97 − 2 · 35 35 = 27 + 8 8 = 35 − 27 = 35 − (97 − 2 · 35) = 3 · 35 − 97 27 = 3 · 8 + 3 3 = 27 − 3 · 8 = 4 · 97 − 11 · 35 8 = 2 · 3 + 2 2 = 8 − 2 · 3 = 25 · 35 − 9 · 97 3 = 2 + 1 1 = 3 − 2 = 13 · 97 − 36 · 35 GCD(97, 35) = 1 97 · (13 · 13) − 35 · (36 · 13) = 13

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-103
SLIDE 103

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. First we need to find GCD(97, 35) and make sure that it divides 13. 97 = 2 · 35 + 27 27 = 97 − 2 · 35 35 = 27 + 8 8 = 35 − 27 = 35 − (97 − 2 · 35) = 3 · 35 − 97 27 = 3 · 8 + 3 3 = 27 − 3 · 8 = 4 · 97 − 11 · 35 8 = 2 · 3 + 2 2 = 8 − 2 · 3 = 25 · 35 − 9 · 97 3 = 2 + 1 1 = 3 − 2 = 13 · 97 − 36 · 35 GCD(97, 35) = 1 97 · 169 − 35 · 468 = 13

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-104
SLIDE 104

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. So we found that one solution of this equation is: x0 = 169, y0 = −468.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-105
SLIDE 105

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. So we found that one solution of this equation is: x0 = 169, y0 = −468. Then the complete set of solutions is {(xn = x0 + b GCD(a, b)n, yn = y0 − a GCD(a, b)n) | n ∈ Z}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-106
SLIDE 106

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. So we found that one solution of this equation is: x0 = 169, y0 = −468. Then the complete set of solutions is {(xn = x0 + 35 · n, yn = y0 − 97 · n) | n ∈ Z}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-107
SLIDE 107

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. So we found that one solution of this equation is: x0 = 169, y0 = −468. Then the complete set of solutions is {(xn = 169 + 35 · n, yn = −468 − 97 · n) | n ∈ Z} Focus on the notation for a bit. Why is there a bracket around (xn, yn)?

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-108
SLIDE 108

Example a)

Give the complete set of solutions of 97x + 35y = 13, x, y ∈ Z. So we found that one solution of this equation is: x0 = 169, y0 = −468. Then the complete set of solutions is {(xn = 169 + 35 · n, yn = −468 − 97 · n) | n ∈ Z} Focus on the notation for a bit. Why is there a bracket around (xn, yn)? It’s a PAIR. Formally, we should write (x0, y0) too. In the set notation there is no room for informality!

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-109
SLIDE 109

Example b)

Give the complete set of solutions of 98x + 35y = 13, x, y ∈ Z.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-110
SLIDE 110

Example b)

Give the complete set of solutions of 98x + 35y = 13, x, y ∈ Z. First we need to find GCD(98, 35) and make sure that it divides 13. 98 = 2 · 35 + 28 35 = 28 + 7 28 = 4 · 7

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-111
SLIDE 111

Example b)

Give the complete set of solutions of 98x + 35y = 13, x, y ∈ Z. First we need to find GCD(98, 35) and make sure that it divides 13. 98 = 2 · 35 + 28 35 = 28 + 7 28 = 4 · 7 So GCD(98, 35) = 7. But 7 |13, so this equation has no solutions!

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-112
SLIDE 112

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-113
SLIDE 113

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. First we need to find GCD(258, 147) and make sure that it divides 369.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-114
SLIDE 114

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. First we need to find GCD(258, 147) and make sure that it divides 369. 258 = 147 + 111 147 = 111 + 36 111 = 3 · 36 + 3 36 = 12 · 3 So GCD(258, 147) = 3.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-115
SLIDE 115

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. First we need to find GCD(258, 147) and make sure that it divides 369. 258 = 147 + 111 147 = 111 + 36 111 = 3 · 36 + 3 36 = 12 · 3 So GCD(258, 147) = 3. 3|369

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-116
SLIDE 116

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. Now we need to express GCD(258, 147) as a linear combination of 258 and 147. 258 = 147 + 111 111=258-147 147 = 111 + 36 36 = 147 − 111 = 2 · 147 − 258 111 = 3 · 36 + 3 3 = 111 − 3 · 36 = 4 · 258 − 7 · 147 36 = 12 · 3 So GCD(258, 147) = 3. 3|369

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-117
SLIDE 117

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. Now we need to express GCD(258, 147) as a linear combination of 258 and 147. 258 = 147 + 111 111=258-147 147 = 111 + 36 36 = 147 − 111 = 2 · 147 − 258 111 = 3 · 36 + 3 3 = 111 − 3 · 36 = 4 · 258 − 7 · 147 36 = 12 · 3 369 3 = 123 So: 258 · (4 · 123) + 147 · (−7 · 123) = 369 is a solution.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-118
SLIDE 118

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. Now we need to express GCD(258, 147) as a linear combination of 258 and 147. 258 = 147 + 111 111=258-147 147 = 111 + 36 36 = 147 − 111 = 2 · 147 − 258 111 = 3 · 36 + 3 3 = 111 − 3 · 36 = 4 · 258 − 7 · 147 36 = 12 · 3 369 3 = 123 So: 258 · 492 + 147 · (−861) = 369 is a solution.

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-119
SLIDE 119

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. Now we know that x0 = 492, y0 = −861 is a solution. Then so are all: {(xn = 492 + 147 3 n, yn = −861 − 492 3 n) | n ∈ Z}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers

slide-120
SLIDE 120

Example c)

Give the complete set of solutions of 258x + 147y = 369, x, y ∈ Z. Now we know that x0 = 492, y0 = −861 is a solution. Then so are all: {(xn = 492 + 147 3 n, yn = −861 − 492 3 n) | n ∈ Z}

Dr Ewa Infeld Ryerson University MTH314: Discrete Mathematics for Engineers