26
Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

Embed Size (px)

Citation preview

Page 1: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

Lecture 3.1: Mathematical Induction

CS 250, Discrete Structures, Fall 2014

Nitesh Saxena

Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

Page 2: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Course Admin Mid-Term 1

Hope it went well! Thanks for your cooperation running it

smoothly We are grading them now, and should have

the results no less than two weeks Solution will be provided soon Questions?

Page 3: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Course Admin HW2 (don’t forget)

Due Oct 14 (Tues)

Page 4: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Outline

Mathematical Induction Principle Examples Why it all works

Page 5: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionSuppose we have a sequence of propositions

which we would like to prove:P (0), P (1), P (2), P (3), P (4), … P (n), …EG: P (n) = “The sum of the first n positive odd numbers is

equal to n2”We can picture each proposition as a domino:

P (n)

Page 6: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionSo sequence of propositions is a sequence

of dominos.

P (n+1)P (n)P (2)P (1)P (0)

Page 7: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionWhen the domino falls, the corresponding

proposition is considered true:

P (n)

Page 8: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionWhen the domino falls (to right), the

corresponding proposition is considered true:

P (n)true

Page 9: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionSuppose that the dominos satisfy two

constraints.1) Well-positioned: If any domino falls (to

right), next domino (to right) must fall also.

2) First domino has fallen to right

P (0)true

P (n+1)P (n)

Page 10: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionSuppose that the dominos satisfy two

constraints.1) Well-positioned: If any domino falls to

right, the next domino to right must fall also.

2) First domino has fallen to right

P (0)true

P (n+1)P (n)

Page 11: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionSuppose that the dominos satisfy two

constraints.1) Well-positioned: If any domino falls to

right, the next domino to right must fall also.

2) First domino has fallen to right

P (0)true

P (n)true

P (n+1)true

Page 12: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

P (n+1)P (n)P (2)P (1)P (0)

Page 13: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

P (n+1)P (n)P (2)P (1)P (0)

Page 14: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

…P (0)true

P (n+1)P (n)P (2)P (1)

Page 15: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

…P (0)true

P (1)true

P (n+1)P (n)P (2)

Page 16: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

P (2)true

…P (0)true

P (1)true

P (n+1)P (n)

Page 17: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

P (2)true

…P (0)true

P (1)true

P (n+1)P (n)

Page 18: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

P (2)true

…P (0)true

P (1)true

P (n)true

P (n+1)

Page 19: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionThen can conclude that all the dominos

fall!

P (2)true

…P (0)true

P (1)true

P (n)true

P (n+1)true

Page 20: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical InductionPrinciple of Mathematical Induction: If:1) [basis] P (0) is true2) [induction] k P(k)P(k+1) is true

Then: n P(n) is trueThis formalizes what occurred to dominos.

P (2)true

…P (0)true

P (1)true

P (n)true

P (n+1)true

Page 21: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Exercise 1Use induction to prove that the sum of the first

n odd integers is n2.Prove a base case (n=1)

Base case (n=1): the sum of the first 1 odd integer is 12. Yup, 1 = 12.

Prove P(k)P(k+1)

Assume P(k): the sum of the first k odd ints is k2. 1 + 3 + … + (2k - 1) = k2

Prove that 1 + 3 + … + (2k - 1) + (2k + 1) = (k+1)2

1 + 3 + … + (2k-1) + (2k+1) =

k2 + (2k + 1)= (k+1)2 By arithmetic

Page 22: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Exercise 2

Prove that 11! + 22! + … + nn! = (n+1)! - 1, nBase case (n=1): 11! = (1+1)! - 1?Yup, 11! = 1, 2! - 1 = 1

Assume P(k): 11! + 22! + … + kk! = (k+1)! - 1Prove that 11! + … + kk! + (k+1)(k+1)! = (k+2)! - 111! + … + kk! + (k+1)

(k+1)! = (k+1)! - 1 + (k+1)

(k+1)!= (1 + (k+1))(k+1)! - 1= (k+2)(k+1)! - 1

= (k+2)! - 1

Page 23: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Exercises 3 and 4 (have seen before?)

1. Recall sum of arithmetic sequence:

2. Recall sum of geometric sequence:

2

)1(

1

nni

n

i

1

)1(...

12

0

r

raarararaar

nn

n

i

i

Page 24: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical Induction - why does it work?

Proof of Mathematical Induction:

We prove that (P(0) (k P(k) P(k+1))) (n P(n))

Proof by contradiction.

Assume1. P(0)2. k P(k) P(k+1)3. n P(n) n P(n)

Page 25: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Mathematical Induction - why does it work?

Assume1. P(0)2. k P(k) P(k+1)3. n P(n) n P(n)Let S = { n :

P(n) }

Since N is well ordered, S has a least element. Call it k.

What do we know? P(k) is false because it’s in S. k 0 because P(0) is true. P(k-1) is true because P(k) is the least

element in S.

But by (2), P(k-1) P(k). Contradicts P(k-1) true, P(k)

false.

Done.

Page 26: Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

04/21/23Lecture 3.1 -- Mathematical

Induction

Today’s Reading Rosen 5.1