discrete structures & algorithms more on methods of proof / mathematical induction

38
Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction EECE 320 — UBC

Upload: neci

Post on 11-Feb-2016

55 views

Category:

Documents


0 download

DESCRIPTION

Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction. EECE 320 — UBC . What have we explored so far. Propositional logic Rules of inference Methods of proof. Problem: On an island live Greeks and Romans. Greeks always lie. Romans always tell the truth. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

Discrete Structures & Algorithms

More on Methods of Proof / Mathematical Induction

EECE 320 — UBC

Page 2: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

2

What have we explored so far

Propositional logicRules of inferenceMethods of proof

Page 3: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

3

Problem: On an island live Greeks and Romans. Greeks always lie. Romans always tell the truth. You encounter two people: A and B. A says: “B is a Roman” and B says: “We are not the same people”.What are A and B?

Page 4: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

4

Proof MethodsFor proving implications pq, we have:Direct proof: Assume p is true, and prove q.Indirect proof: Assume q, and prove p.Vacuous proof: Prove p by itself.Trivial proof: Prove q by itself.Proof by cases: Show p(a b), and (aq) and (bq).

Proof by contradiction of any statements.Existence proofs: Constructive and nonconstructive

Page 5: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

5

A Direct Proof

Prove that an integer n is even, if n2 is even.

Page 6: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

6

A … Proof

Prove that if n = a*b are positive integers then a sqrt(n) or b sqrt(n)

Page 7: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

7

A … Proof

Prove that the equation r3 + r + 1 = 0 has no rational solution.

Page 8: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

8

An existence proof(constructive or non-constrictive?)

Prove that there exist a and b irrational numbers such that ab is rational.

Page 9: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

9

A few techniques

• Forward / backward reasoning • Adapting existing proofs• Intermediary steps / Conjectures / Counter examples

Page 10: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

10

Proving by induction

Page 11: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

11

Dominoes

Domino Principle: Line up any number of dominos in a row; knock the first one over and they will all fall.

Page 12: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

12

Dominoes numbered 1 to nFk = “The kth domino falls”If we set them up in a row then each one is set up to knock over the next:For all 1 ≤ k < n:

Fk Fk+1

F1 F2 F3 …F1 All Dominoes Fall

Page 13: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

13

Dominoes numbered 1 to nFk = “The kth domino falls”

k, 0 ≤ k < n:Fk Fk+1

F0 F1 F2 …F0 All Dominoes Fall

Page 14: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

14

The natural numbers

One domino for each natural number:

0 1 2 3 …

= { 0, 1, 2, 3, . . . }

Page 15: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

15

Plato’s DominoesOne for each natural number

Theorem: An infinite row of dominoes, one domino for each natural number.Knock over the first domino and they all will fall

Suppose they don’t all fall. Let k > 0 be the lowest numbered domino that remains standing. Domino k-1 ≥ 0 did fall, but k-1 will knock over domino k. Thus, domino k must fall and remain standing. Contradiction.

Proof:

Page 16: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

16

Mathematical Induction statements proved instead of

dominoes fallenInfinite sequence ofdominoes

Infinite sequence of statements: S0, S1, …

Fk = “domino k fell” Fk = “Sk proved”

Conclude that Fk is true for all k

Establish: 1. F0

2. For all k≥0, Fk Fk+1

Page 17: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

17

Inductive proofsTo prove k , Sk

Establish “Base Case”: S0

Establish that k, Sk Sk+1

k, Sk Sk+1

Assume hypothetically that Sk for any particular k fixed;

Prove that Sk+1

Page 18: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

18

Theorem?The sum of the first n odd numbers is n2

Check on small values:1 = 11+3 = 41+3+5 = 91+3+5+7 = 16

Page 19: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

19

Theorem?The sum of the first n odd numbers is n2

The kth odd number is (2k – 1), when k > 0Sk is the statement that: “1+3+5+…+(2k-1) = k2”

Page 20: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

20

Sk = “1 + 3 + 5 + …. + (2k-1) = k2”

Establishing that n ≥ 1 Sn

Base Case: S1

Assume “Induction Hypothesis”: Sk

That means: 1+3+5+…+ (2k-1) = k2

1+3+5+…+ (2k-1)+(2k+1) = k2 +(2k+1)Sum of first k+1 odd numbers = (k+1)2

Domino Property:

Page 21: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

21

TheoremThe sum of the first n odd numbers is n2

Page 22: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

22

Primes:

Note: 1 is not considered prime

A natural number n > 1 is a prime if it has no divisors besides 1 and itself

Page 23: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

23

Theorem?

Every natural number > 1 can be factored into primes

Sn = “n can be factored into primes”

Base case:2 is prime S2 is true

Sk-1 = “k-1 can be factored into primes”How do we use the fact:

Sk = “k can be factored into primes”to prove that:

Page 24: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

24

This shows a technical point about mathe-

matical induction

Page 25: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

25

Theorem?

Every natural number > 1 can be factored into primes

A different approach:Assume 2,3,…,k-1 all can be factored into primesThen show that k can be factored into primes

Page 26: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

26

“All previous” inductionTo prove k, Sk

Establish Base Case: S0

Establish Domino Effect:Assume j<k, Sj use that to derive Sk

Page 27: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

27

All Previous InductionTo Prove k, Sk

Establish Base Case: S0

Establish Domino Effect:Assume j<k, Sj use that to derive Sk

Also called “Strong

Induction”

Page 28: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

28

Let k be any number

“All previous” inductionRepackaged As

Standard Induction

Establish Base Case: S0

Establish Domino Effect:Let k be any numberAssume j<k, Sj

Prove Sk

Define Ti = j ≤ i, Sj

Establish Base Case T0

Establish that k, Tk Tk+1

Assume Tk-1 Prove Tk

Page 29: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

29

And there are more ways to do inductive proofs

Page 30: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

30

Invariant (n): 1. Not varying; constant. 2. Mathematics. Unaffected by

a designated operation, as a transformation of coordinates.

Another way of packaging inductive reasoning is to define “invariants”

Page 31: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

31

Invariant (n): 3. Programming. A rule, such

as the ordering of an ordered list, that applies throughout the life of a data structure or procedure. Each change to the data structure maintains the correctness of the invariant

Page 32: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

32

Invariant InductionSuppose we have a time varying world state: W0, W1, W2, …

Argue that S is true of the initial worldShow that if S is true of some world – then S remains true after any permissible operation is performed

Each state change is assumed to come from a list of permissible operations. We seek to prove that statement S is true of all future worlds

Page 33: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

33

Odd/Even Handshaking Theorem At any party at any point in time define a person’s parity as ODD/EVEN according to the number of hands they have shakenStatement: The number of people of odd parity must be even

Page 34: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

34

If 2 people of the same parity shake, they both change and hence the odd parity count changes by 2 – and remains even

Statement: The number of people of odd parity must be evenInitial case: Zero hands have been shaken at the start of a party, so zero people have odd parity

Invariant Argument:

If 2 people of different parities shake, then they both swap parities and the odd parity count is unchanged

Page 35: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

35

ExerciseShow that the sum of first N positive

integers is N*(N+1)/2

Page 36: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

36

Inductive reasoning is the high level idea

“Standard” Induction“All Previous” Induction

“Invariants”all just

different packaging

Page 37: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

37

Induction is also how we can define and construct our world.

So many things, from buildings to computers, are built up stage by stage, module by module, each depending on the previous stages.

Page 38: Discrete Structures & Algorithms More on Methods of Proof /  Mathematical Induction

38

The essential elements of mathematical induction are:

•The proposition of interest

•The base case•The inductive step