discrete mathematics tutorial 11 chin [email protected]

43
Discrete Mathematics Tutorial 11 Chin [email protected]

Upload: winifred-simpson

Post on 01-Jan-2016

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Discrete MathematicsTutorial 11

[email protected]

Page 2: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Suppose– P(1) is true, and– If P(n) is true, P(n+1) is also true

• Then P(n) is true for every n ≥ 1654321

Page 3: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Suppose I proved that1. P(1) and P(2) are true.2. If P(n) is true, then P(n+2) is true.

• Can I conclude that– P(n) is true for every n?

Page 4: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

• Suppose I proved that1. P(1) and P(2) are true.2. If P(n) is true, then P(n+2) is true.

• Two stack of dominoes– P(1)→P(3)→P(5)→…– P(2)→P(4)→P(6) →…

Induction

...7531

...8642

Page 5: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Suppose I proved that1. P(1, 1) is true.2. If P(n, m) is true, then P(n+1, m+1) is true.

• Can I conclude that– P(n, m) is true for every n, m?

Page 6: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Suppose I proved that1. P(1, 1) is true.2. If P(n, m) is true, then P(n+1, m+1) is true.

• What about P(2,1)? (1,1)

(2,1) (2,2)

(3,1) (3,3)

(4,1) (4,4)

(5,1) (5,5)

(6,1) (6,6)

(7,1) (7,7)

Page 7: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Suppose I proved that1. P(1, 1) is true.2. If P(n, m) is true, then P(n+1, m) is true.3. If P(n, m) is true, then P(n-1, m+1) is true.

• Can I conclude that– P(n, m) is true for every n, m?

Page 8: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Suppose I proved that1. P(1, 1) is true.2. If P(n, m) is true, then P(n+1, m) is true.3. If P(n, m) is true, then P(n-1, m+1) is true.

(1,1) (1,2) (1,3) (1,4) (1,5)

(2,1) (2,2) (2,3) (2,4)

(3,1) (3,2) (3,3)

(4,1) (4,2)

(5,1)

(6,1)

(7,1)

2,33,2

4,11,3

2,23,11,2

2,11,1

Page 9: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Show that∑ i2 = n(2n+1)(n+1)/6n

i=1

Page 10: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Show that∑ i2 = n(2n+1)(n+1)/6

i.e. 12 + 22 + 32 + … + n2 = n(2n+1)(n+1)/6

• Base case:– when n = 1– L.H.S. = 1– R.H.S. = 1 x 3 x 2 / 6 = 1

n

i=1

Page 11: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Assume P(n) is true:∑ i2 = n(2n+1)(n+1)/6

i.e. 12 + 22 + 32 + … + n2 = n(2n+1)(n+1)/6• Then we need to show P(n+1) is also true:

∑ i2 = (n+1)(2(n+1)+1)((n+1)+1)/6

i.e. 12 + 22 + … + n2 + (n+1)2 = (n+1)(2n+3)(n+2)/6• How to use the induction assumption?

n

i=1

n+1

i=1

Page 12: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Then we need to show P(n+1) is also true:∑ i2 =(n+1)(2n+3)(n+2)/6

i.e. 12 + 22 + … + n2 + (n+1)2 = (n+1)(2n+3)(n+2)/6• How to use the induction assumption?

∑ i2 = ∑ i2 + (n+1)2

∑ i2 = n(2n+1)(n+1)/6 + (n+1)2

n+1

i=1

n+1

i=1

n

i=1

n+1

i=1

Page 13: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

• Now we have∑ i2 = n(2n+1)(n+1)/6 + (n+1)2

• Our goal is to make R.H.S. equal(n+1)(2n+3)(n+2)/6

• Just expand everything out and factorize

n+1

i=1

Page 14: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

∑ i2

= n(2n + 1)(n + 1)/6 + (n + 1)2

= (2n3 + 3n2 + n)/6 + (n2 + 2n + 1)= ((2n3 + 3n2 + n) + (6n2 + 12n + 6)) /6= (2n3 + 9n2 + 13n + 6)/6

How to factor?

n+1

i=1

Page 15: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Induction

∑ i2

= (2n3 + 9n2 + 13n + 6)/6

= (n + 1)(2n2 + 7n + 6)/6= (n + 1)(2n + 3)(n + 2)/6

n+1

i=1

• How to factor?• Remember, our goal is to make R.H.S. equal

(n+1)(2n+3)(n+2)/6

• So P(n+1) is also true. Done.

Page 16: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong induction

• Suppose– P(1) is true, and– If P(s) is true for every s < n, P(n+1) is also true

• Then P(n) is true for every n ≥ 1

65 4

32 1

Page 17: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong induction

• Prove thatTo divide up a chocolate bar with m x n squares, we need at least mn - 1 splits

5 = 2x3 - 1 splits

Page 18: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong induction

• Prove thatTo divide up a chocolate bar with m x n squares, we need at least mn - 1 splits

• We prove a stronger statementP(s) := To divide up a chocolate bar with s squares, we need at least s - 1 splits

Page 19: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong Induction

• Prove thatP(s) := To divide up a chocolate bar with s squares, we need at least s-1 splits

• Base case P(1):– No need to split.

Page 20: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong Induction

• Prove thatP(s) := To divide up a chocolate bar with s squares, we need at least s-1 splits

• Induction step:– (If P(k) is true for every k < s)– Assume for any chocolate bar with 1 ≤ k < s squares,

we need at least k – 1 splits.

Page 21: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong induction

• Induction step (If P(k) is true for every k < s) :– Assume for any chocolate bar with 1 ≤ k < s squares,

we need at least k – 1 splits.

• Given a chocolate bar with s squaresSplit it into two smaller bars with i and j squares, i + j = s

j squares

i squares

s squares

Page 22: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Strong induction

• By induction assumption (P(k) is true for any k < s)

• Small chocolate bar with i < s squares– needs at least i-1 splits for one of the two bars

• Small chocolate bar with j < s squares– needs at least j-1 splits for one of the two bars

• Therefore we need (i-1) + (j-1) + 1 = s-1 splits– because i + j = s

• P(s) is true. Done.j-1 splits

i-1 splits

1 split

Page 23: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Every nonempty set of nonnegative integers has a least element

• This is equivalent to Mathematical Induction:– If MI is true, then we can prove WOP is also true.– If WOP is true, then we can prove MI is also true.

Page 24: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Prove by well-ordering principle that∑ i = n(n+1)/2n

i=1

Page 25: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Prove by well-ordering principle that∑ i = n(n+1)/2

• Prove by contradiction• Suppose there exist some m, ∑ i ≠ m(m+1)/2

• Let S be the set containing all such m– S is nonempty (exists at least one)– S is a set of nonnegative integers

n

i=1

m

i=1

Page 26: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Let S be the set containing all the m∑ i ≠ m(m+1)/2

– S is nonempty (exists at least one)– S is a set of nonnegative integers

• By well-ordering principle, – there exists a least element m’ in S– i.e. m’ is the smallest number such that

∑ i ≠ m’(m’+1)/2

m

i=1

m’

i=1

Page 27: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• m’ is the smallest number such that∑ i ≠ m’(m’+1)/2

• This means for any 0 ≤ n < m’∑ i = n(n+1)/2

m’

i=1

n

i=1

Page 28: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• This means for any 0 ≤ n < m’∑ i = n(n+1)/2

• This is true when n = 0, so – m’ > 0– m’-1 is non-negative and m’-1 < m’, so

∑ i = (m’-1)((m’-1)+1)/2

n

i=1

m’-1

i=1

Page 29: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

∑ i = (m’-1)((m’-1)+1)/2

∑ i = ∑ i + m’ = (m’-1)m’/2 + m’ = m’(m’+1)/2

• But∑ i ≠ m’(m’+1)/2

• Contradiction

m’-1

i=1

m’

i=1

m’

i=1

m’-1

i=1

Page 30: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Show thata2 + b2 = 3(s2 + t2)

has no non-zero integer solutions.

Page 31: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Suppose it has non-zero integer solutions.

• Let S be the collection of (a, b, s, t) such that – (a, b, s, t) ≠ (0, 0, 0, 0), and– a2 + b2 = 3(s2 + t2)

• S is nonempty, by well-ordering principle– there is a least element (a1, b1, s1, t1) such that

a12 + b1

2 = 3(s12 + t1

2)

Page 32: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• S is nonempty, by well-ordering principle– there is a least element (a1, b1, s1, t1) such that

a12 + b1

2 = 3(s12 + t1

2)

• Right idea, but…– S is a set containing 4-tuples (a, b, s, t)– not a set of non-negative integers

• Cannot apply the well-ordering principle

Page 33: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Suppose there exists (a, b, s, t) ≠ (0, 0, 0, 0), a2 + b2 = 3(s2 + t2)

• Let S be the collection of |a| such that there exist b, s and t

a2 + b2 = 3(s2 + t2)• S is a nonempty set of non-negative integers• By the well-ordering principle– There exists an a1 in S such that |a1| is smallest

Page 34: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• Let S be the collection of |a| such that there exist b, s and t

a2 + b2 = 3(s2 + t2)• By the well-ordering principle– There exists an a1 in S such that |a1| is smallest

• And for this smallest |a1|, there exist b1, s1 and t1,

a12 + b1

2 = 3(s12 + t1

2)

Page 35: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• And for this smallest |a1|, there exist b1, s1 and t1,

a12 + b1

2 = 3(s12 + t1

2)

• This means– a1

2 + b12

is a multiple of 3

– a1 and b1 are both multiples of 3

• proof by contrapositive

– a1= 3a2 and b1 = 3b2 for some a2 and b2

Page 36: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• And for this smallest |a1|, there exist b1, s1 and t1,

a12 + b1

2 = 3(s12 + t1

2)

• a1 = 3a2 and b1 = 3b2 for some a2 and b2

– (3a2)2 + (3b2)2 = 3(s12 + t1

2)

– 9a22 + 9b2

2 = 3(s12 + t1

2)

– 3(a22 + b2

2) = s12 + t1

2

– s12 + t1

2 = 3(a22 + b2

2)

• therefore (s1, t1, a2, b2) is also a solution

Page 37: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Well-ordering principle

• There is a least element (a1, b1, s1, t1)a1

2 + b12 = 3(s1

2 + t12)

• We have just showed – (s1, t1, a2= a1/3, b2 = b1/3) is also a solution

• Repeat the argument– (a2=a1/3, b2=b1/3, s2=s1/3, t2=t1/3) is also solution

• But |a2| < |a1|, contradiction.

Page 38: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Invariant Method

• The numbers 1, 2, 3, 4 and 5 are written on a board

• Repeat the following until there is only one number left:– pick any two of the numbers– erase them– write the absolute value of their difference on board

• Can the remaining number be 2?

Page 39: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Invariant Method

• Example

• 1 2 3 4 5 → 2 3 4 4• 2 3 4 4 → 2 4 1• 2 4 1 → 2 3• 2 3 → 1

Page 40: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Invariant Method

• Observe

• 1 2 3 4 5 (1 + 2 + 3 + 4 + 5 = 15)• 2 3 4 4 (2 + 3 + 4 + 4 = 13)• 2 4 1 (2 + 4 + 1 = 7)• 2 3 (2 + 3 = 5)• 1 (1)

• What is the pattern?

Page 41: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Invariant Method

• Observation– can only get an odd number in the final answer– total sum of the numbers on the board is always odd

• Suppose I pick m and n on the board– Change in total sum = m + n - (m - n) = 2n– the change in total sum must be even– Therefore the total sum is always odd

Page 42: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

Invariant Method

• At the beginning the total sum is 15– which is odd

• Therefore the total sum is always odd

• Impossible to get 2 as final answer– In fact, impossible to get any even number as final

answer

Page 43: Discrete Mathematics Tutorial 11 Chin chlee@cse.cuhk.edu.hk

End

• Questions?