Proof by Induction

44
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca [email protected] © 2006-2013 by Douglas Wilhelm Harder. Some rights reserved. Proof by Induction

description

Proof by Induction. Outline. This topic gives an overview of the mathematical technique of a proof by induction We will the inductive principle Look at ten different examples Four examples where the technique is incorrectly applied Well-ordering of the natural numbers Strong induction - PowerPoint PPT Presentation

Transcript of Proof by Induction

Page 1: Proof by Induction

ECE 250 Algorithms and Data Structures

Douglas Wilhelm Harder, M.Math. LELDepartment of Electrical and Computer Engineering

University of Waterloo

Waterloo, Ontario, Canada

ece.uwaterloo.ca

[email protected]

© 2006-2013 by Douglas Wilhelm Harder. Some rights reserved.

Proof by Induction

Page 2: Proof by Induction

2

Proof by Induction

This topic gives an overview of the mathematical technique of a proof by induction– We will describe the inductive principle– Look at ten different examples– Four examples where the technique is incorrectly applied– Well-ordering of the natural numbers– Strong induction– Geometric problems

Outline

Page 3: Proof by Induction

3

Proof by Induction

Definition

Suppose we have a formula F(n) which we wish to show is true for all values n ≥ n0

– Usually n0 = 0 or n0 = 1

For example, we may wish to show that

for all n ≥ 0

0

1

2

n

k

n nF n k

1.4

Page 4: Proof by Induction

4

Proof by Induction

Definition

We then proceed by:– Demonstrating that F(n0) is true

– Assuming that the formula F(n) is true for an arbitrary n– If we are able to demonstrate that this assumption allows us to also

show that the formula is true for F(n + 1), the inductive principle allows us to conclude that the formula is true for all n ≥ n0

1.4

Page 5: Proof by Induction

5

Proof by Induction

Definition

Thus, if F(n0) is true, F(n0 + 1) is true

and, if F(n0 + 1) is true, F(n0 + 2) is true

and, if F(n0 + 2) is true, F(n0 + 3) is true

and so on, and so on, for all n ≥ n0

1.4

Page 6: Proof by Induction

6

Proof by Induction

Formulation

Often F(n) is an equation:– For example, F(n) may be an equation such as:

It may also be a statement:– The integer n3 – n is divisible by 3 for all n ≥ 1

0

1for 0

2

n

k

n nk n

2

1

2 1 for 1n

k

k n n

1

0

2 2 1 for 0n

k n

k

n

1.4.1

Page 7: Proof by Induction

7

Proof by Induction

Examples

We will now look at ten examples

At each case, we will show the inductive process...

1.4.2

Page 8: Proof by Induction

8

Proof by Induction

Prove that is true for n ≥ 0

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

1

0 0

1n n

k k

k n k

0

1

2

n

k

n nk

Example 1

0

1

2

n

k

n nk

0

0

0 0 10

2k

k

1.4.2.1

Page 9: Proof by Induction

9

Proof by Induction

Prove that is true for n ≥ 0

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

2 1 1

22 1 1 2

2 2

n n n

n n n n

11

2

n nn

1

0 0

1n n

k k

k n k

0

1

2

n

k

n nk

Example 1

0

1

2

n

k

n nk

0

0

0 0 10

2k

k

1.4.2.1

Page 10: Proof by Induction

10

Proof by Induction

Prove that the sum of the first n odd integers is n2:

– When n = 1:

– Assume that the statement is true for a given n:– We now show:

1

1 0

2 1 2 1 1 2 1n n

k k

k n k

2

1

2 1n

k

k n

Example 2

2

1

2 1 for 1n

k

k n n

1

2

1

2 1 1 1k

k

1.4.2.2

Page 11: Proof by Induction

11

Proof by Induction

Prove that the sum of the first n odd integers is n2:

– When n = 1:

– Assume that the statement is true for a given n:– We now show:

2

1

2 1n

k

k n

Example 2

1

1 1

2

2

2

2

2 1 2 1 1 2 1

2 1 1

2 2 1

2 1

1

n n

k k

k n k

n n

n n

n n

n

2

1

2 1 for 1n

k

k n n

1

2

1

2 1 1 1k

k

1.4.2.2

Page 12: Proof by Induction

12

Proof by Induction

Example 3

Prove that for n ≥ 0

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

1

0

2 2 1n

k n

k

0

0 0 1

0

2 2 1 2 1k

k

1

0

2 2 1n

k n

k

1

1

0 0

2 2 2n n

k n k

k k

1.4.2.3

Page 13: Proof by Induction

13

Proof by Induction

Example 3

Prove that for n ≥ 0

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

00 0 1

0

2 2 1 2 1k

k

1

0

2 2 1n

k n

k

1 1

1

2

2 2 1

2 2 1

2 1

n n

n

n

11

0 0

2 2 2n n

k n k

k k

1

0

2 2 1n

k n

k

1.4.2.3

Page 14: Proof by Induction

14

Proof by Induction

Example 4

Prove that

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

0

2n

n

k

n

k

00

0

01 2

0k

n

k

0

2n

n

k

n

k

1

0 1

1 1 1 1

0 1

n n

k k

n n n n

k k n

1.4.2.4

Page 15: Proof by Induction

15

Proof by Induction

Example 4

Prove that

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

0

2n

n

k

n

k

00

0

01 2

0k

n

k

0

2n

n

k

n

k

1

0 1

1

1

1 1 1 0

1 1 1 1

0 1

1 11

1 11 0

n n

k k

n

k

n n n n

k k k k

n n n n

k k n

n n

k k

n n n n n n

k k k k n

1.4.2.4

Page 16: Proof by Induction

16

Proof by Induction

Example 4

Prove that

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

0

2n

n

k

n

k

00

0

01 2

0k

n

k

0

2n

n

k

n

k

1

0 1

1

1

1 1 1 0

1 1 1 1

0 1

1 11

1 11 0

2

n n

k k

n

k

n n n n

k k k k

n n n n

k k n

n n

k k

n n n n n n

k k k k n

n

k

0

n

k

1.4.2.4

Page 17: Proof by Induction

17

Proof by Induction

Example 4

Prove that

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

00

0

01 2

0k

n

k

0

2n

n

k

n

k

1

0 1

1

1

1 1 1 0

1 1 1 1

0 1

1 11

1 11 0

2

n n

k k

n

k

n n n n

k k k k

n n n n

k k n

n n

k k

n n n n n n

k k k k n

n

k

1

0

2 2 2n

n n

k

0

2n

n

k

n

k

1.4.2.4

Page 18: Proof by Induction

18

Proof by Induction

1

0

1

1

nnk

k

rr

r

Example 5

Prove that

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

1

0

1

1

nnk

k

rr

r

10

0

11

1k

k

rr

r

11

0 0

n nk n k

k k

r r r

1.4.2.5

Page 19: Proof by Induction

19

Proof by Induction

11

0 0

11

1 1

1 1

1 1 1 2

1

1

1 1

1 1

1 1

1

1 1

1 1

n nk n k

k k

nn

n n

n n

n n n n

r r r

rr

r

r r r

r r

r r r

r

r r r r r

r r

1

0

1

1

nnk

k

rr

r

Example 5

Prove that

– When n = 0:

– Assume that the statement is true for a given n:– We now show:

1

0

1

1

nnk

k

rr

r

10

0

11

1k

k

rr

r

1.4.2.5

Page 20: Proof by Induction

20

Proof by Induction

Prove by induction that n3 – n is divisible by 3 for all integers– This is slightly different

• Choose a base case, say n = 0• Next, prove that the truth of the formula for n implies the truth for n + 1• Also, prove that the truth of the formula for n also implies the truth for n – 1

– When n = 0: 03 – 0 = 0 is divisible by 3– Assume that the statement is true for a given n: n3 – 3 is divisible by 3– We now show:

In both cases, the first term is divisible by 3,the second term is divisible by 3 by assumption;

Consequently, their sum must also be divisible by 3

Example 6

3 3 3

2 3

1 1 3 3 1 1

3

n n n n n n

n n n n

3 3 3

2 3

1 1 3 3 1 1

3

n n n n n n

n n n n

1.4.2.6

Page 21: Proof by Induction

21

Proof by Induction

Of course, proof-by-induction may not always be the only approach:

Proving that n3 – n is divisible by 3 for all integers– An alternative proof could follow by observing that all integers may be

written as either

3m 3m + 1 3m + 2

and then observing that

Example 6

33 3 3

3 3 1 3 1

n n m m

m m m

33 3 1 3 1

3 3 1 3 2

n n m m

m m m

33 3 2 3 2

3 1 3 1 3 2

n n m m

m m m

1.4.2.6

Page 22: Proof by Induction

22

Proof by Induction

Prove that the derivative of xn w.r.t. x is nxn – 1 for n ≥ 1 using– the chain rule, and–

Proof– When n = 1: the derivative of x is 1– Assume that the derivative of xn w.r.t. x is nxn – 1 – We now show:

Example 7

1n n

n n

x x x

x x x x

1x

1.4.2.7

Page 23: Proof by Induction

23

Proof by Induction

Prove that the derivative of xn w.r.t. x is nxn – 1 for n ≥ 1 using– the chain rule, and–

Proof– When n = 1: the derivative of x is 1– Assume that the derivative of xn w.r.t. x is nxn – 1 – We now show:

Example 7

1

1

1

n n

n n

n n

n n

n

x x x

x x x x

nx x x

nx x

n x

1x

1.4.2.7

Page 24: Proof by Induction

24

Proof by Induction

Prove that for integer values of n ≥ 1 – When n = 1:– Assume that – We now show:

Example 8

ln 1 ! ln 1 ln !n n n

ln ! ln( )n n nln(1!) ln(1) 0 1 ln(1)

ln ! ln( )n n n

1.4.2.8

Page 25: Proof by Induction

25

Proof by Induction

Prove that for integer values of n ≥ 1 – When n = 1:– Assume that – We now show:

Example 8

ln 1 ! ln 1 ln !

ln 1 ln

ln 1 ln 1

1 ln 1

n n n

n n n

n n n

n n

ln ! ln( )n n nln(1!) ln(1) 0 1 ln(1)

ln ! ln( )n n n

1.4.2.8

Page 26: Proof by Induction

26

Proof by Induction

Prove that

– When n = 0:

– Assume that the statement is true for a given n – We now show:

Example 9

2

21

11

2

n

n

k

nH

k

0

0

2

21

1 01 1

2k

Hk

1 1

1

2 2 2

21 1 2 1

1 1 1n n n

n

nk k k

Hk k k

1.4.2.9

Page 27: Proof by Induction

27

Proof by Induction

Prove that

– When n = 1:

– Assume that the statement is true for a given n – We now show:

Example 9

2

21

11

2

n

n

k

nH

k

0

0

2

21

1 01 1

2k

Hk

1 1

1

1

1

1

2 2 2

21 1 2 1

2

2 1

2

12 1

2

12 1

1

1 1 1

11

2

11

2 2

11 1

2 2

2 1 11 1 1

2 2 2 2 2

n n n

n

n

n

n

n

n

n

n

k k k

k

nk

nk

n

n

Hk k k

n

k

n

n

n n n

1.4.2.9

Page 28: Proof by Induction

28

Proof by Induction

23

1 1

n n

k kk k

Prove that

– When n = 1:– Assume that the statement is true for a given n – We now show:

Example 10

21 13

1 11

k kk k

2 21

1 1

22

1 1

1

1 2 1

n n

k k

n n

k k

k n k

n n k k

1.4.2.10

Page 29: Proof by Induction

29

Proof by Induction

23

1 1

n n

k kk k

Prove that

– When n = 1:– Assume that the statement is true for a given n – We now show:

Example 10

21 13

1 11

k kk k

2 21

1 1

22

1 1

2 3

1

2 3 2 3

1

3 2 3

1

3 3

1

3 3

1

1 3

1

1

1 2 1

12 1 2 1

2

2 1 2

3 3 1

1

1

n n

k k

n n

k k

n

k

n

k

n

k

n

k

n

k

n

k

k n k

n n k k

n nn n n k

n n n n n k

n n n k

n k

n k

k

1.4.2.10

Page 30: Proof by Induction

30

Proof by Induction

Non-Examples

All of these examples have been examples where proof by induction satisfies the desired result– What happens if it fails?– We will look at three cases:

• The inductive step fails• The initial inductive step is false• The “proof” is invalid

1.4.3

Page 31: Proof by Induction

31

Proof by Induction

Non-Example 1

Suppose we have an incorrect formula—what happens?

Recall Fibonacci numbers:

Suppose you saw that F(2) = 2 and F(3) = 3 and ask:

Is F(n) = n for n ≥ 1? – When n = 1: F(1) = 1 by definition– Assume that the statement is true for all k = 1, 2, …, n: F(k) = k– However:

1 0,1

1 2 2

nF n

F n F n n

1 1

1

2 1

1

F n F n F n

n n

n

n

Thus, the formula is wrong!

1.4.3.1

Page 32: Proof by Induction

32

Proof by Induction

Non-Example 2

Consider the recursive formula– Can we find a closed form?

Suppose n > 1, then

or– One may accidently conclude that – This is incorrect: F(1) = F(0) = 1: the base case is at n = 1– The correct closed-form formula is

1

0

1 0

( ) 0n

k

n

F nF k n

1

0

2

0

1

1 1

n

k

n

k

F n F k

F n F k

F n F n F n

2 1F n F n

2nF n

1

1 0

2 0n

nF n

n

+

1.4.3.2

Page 33: Proof by Induction

33

Proof by Induction

Non-Example 3

In opposition to the statement that “x is a horse of a different color”, prove all horses are the same color– A single horse has the same color as itself– Assume that all horses in a set of size n have the same color

– Then, given a set of n + 1 horses {h1, h2, …, hn, hn + 1}, we may group them into two groups of size n:

{h1, h2, …, hn} and {h2, …, hn, hn + 1}

– By assumption, all the horses in both sets of size n are the same color– Therefore, all the horses in the set of n + 1 horses must be the same

color

Problem: the inductive step fails if n + 1 = 2– Given a set of two horses {Sea Horse, Barbaro}, there is no overlap in the

two subsets {Sea Horse} and {Barbaro}

1.4.3.3

Page 34: Proof by Induction

34

Proof by Induction

Non-Example 4

You cannot get full eating peas– A person cannot become full eating one pea– Assume a person is not full after eating n peas– If a person has eaten n + 1 peas, this is one more than eating n peas

and, by assumption, the person was not full after eating n peas and eating one more pea will not make him or her full, either

1.4.3.4

Page 35: Proof by Induction

35

Proof by Induction

Non-Example 4

Issues:– A person who is 130 cm in height may not be considered tall; however,

one cannot argue that just because if someone is n cm is considered not tall, then adding one more centimetre will not make them tall, either

– If one pea is eaten at a time, the rate of digestion may in fact equal the rate of consumption

– “Full” is not a well defined value, either• Hossein Rezazadeh, at his height, may have been able to clean and jerk

240 kg with every attempt• He was unable to ever achieve 265 kg• Attempts to clean and jerk weights between these two values may succeed

or fail based on numerous other factors

1.4.3.4

Page 36: Proof by Induction

36

Proof by Induction

The induction principle can either be assumed in a mathematical system as an axiom, or it can be derived from other axioms

Alternatively, it can be deduced from other axioms, such as:– The natural numbers (0, 1, 2, 3, …) are linearly ordered– Every natural number is either 0 or the successor of another natural

number– The successor is by definition greater than what it succeeds

Justification1.4.4

Page 37: Proof by Induction

37

Proof by Induction

You may ask: “Suppose you’ve proved some formula F(n) for by induction to be true for all n = 0, 1, 2, …; all we really showed was that F(0) is true—could it not fail for some larger value F(k)?

Suppose that there is a k such that F(k) is false– There must be a smallest value k > 0 such that

F(k – 1) is true but F(k) is false

– But the inductive step showed that if F(k – 1) is true, it must also be true that F(k) is true!

– Thus, no such smallest k can exist– Thus, no subset of N can have F(n) be false

Justification1.4.4

Page 38: Proof by Induction

38

Proof by Induction

Strong Induction

A similar technique is strong induction where we replace the statement– Assume that true

with– Assume that are all true

For example:Prove that with 3 and 7 cent coins, it is possible to make exact change for any amount greater than or equal to 12 cents

( )F n

0 0 0, 1 , 2 , ,F n F n F n F n

1.4.5

Page 39: Proof by Induction

39

Proof by Induction

Geometric problems

Given an n × 2 grid,how many ways canthat grid be coveredin dominos? – Come up with a

formula for dn,verify that it iscorrect for 5 × 2, andprove it is true byinduction

1 1d

2 2d

3 3d

4 5d

1.4.6

Page 40: Proof by Induction

40

Proof by Induction

Geometric problems

Another:– Come up with a recursive formula that demonstrates that lines

will divide the plane into regions and show

that the formula is correct using induction

2 2

2

n n

1.4.6

Page 41: Proof by Induction

41

Proof by Induction

Geometric problems

And another:– Demonstrate that any 2n × 2n grid

with one square deleted may betiled with triominos

1.4.6

Page 42: Proof by Induction

42

Proof by Induction

In this topic, we have discussed:– We discussed the inductive principle– Ten different examples– Proof by induction can be applied incorrectly– Why it works– Strong induction– Some geometric problems

Summary

Page 43: Proof by Induction

43

Proof by Induction

David Sumner, The Technique of Proof by Induction, http://www.math.sc.edu/~sumner/numbertheory/induction/Induction.html

Wikipedia, Mathematical induction, http://en.wikipedia.org/wiki/Mathematical_induction

Donald E. Knuth, The Art of Computer Programming,Vol 1, Fundamental Algorithms, 3rd Ed., Addison Wesley, 1997

References

Page 44: Proof by Induction

44

Proof by Induction

Usage Notes

• These slides are made publicly available on the web for anyone to use

• If you choose to use them, or a part thereof, for a course at another institution, I ask only three things:– that you inform me that you are using the slides,– that you acknowledge my work, and– that you alert me of any mistakes which I made or changes which you

make, and allow me the option of incorporating such changes (with an acknowledgment) in my set of slides

Sincerely,

Douglas Wilhelm Harder, MMath

[email protected]