Induction proofs

25
1 Induction proofs To prove that some proposition P (n) is true for all n n 0 by induction on n n 0 . Basis : Check that P (n 0 ) is true. 2. Inductive step . Assume that P (n ) is true for n = k , where k is some integer, k n 0 Prove that P (n) is true for n = k +1 , in inductive step we prove that for any n n 0 P (n) P (n+1) lly this is simpler than prove directly that for an ).

description

Induction proofs. To prove that some proposition P ( n ) is true for all n  n 0 by induction on n  n 0. 1. Basis : Check that P ( n 0 ) is true. 2. Inductive step . Assume that P ( n ) is true for n = k , where k is some integer, k  n 0 - PowerPoint PPT Presentation

Transcript of Induction proofs

Page 1: Induction proofs

1

Induction proofs

To prove that some proposition P (n) is true for all n n0 by induction on n n0

1. Basis : Check that P (n0) is true.

2. Inductive step. • Assume that P (n ) is true for n = k , where k is some integer, k n0

• Prove that P (n) is true for n = k +1

So, in inductive step we prove that for any n n0 P (n) P (n+1)

Usually this is simpler than prove directly that for any n n0

P (n).

Page 2: Induction proofs

2

Example. Let P (n) : n3n is divisible by 6

To prove that P (n) is true for all n 0:

1. Basis. P (0): “03 0=0 is divisible by 6”. P (0) is true

2. Inductive step P (n =k ) P (n =k +1), k 0.

Assume P (n =k ) is true, where k is some integer, k 0.

So, we assume that k 3 k is divisible by 6 i.e. k 3 k = 6 s (s is any integer)

Goal: to prove that P (n =k +1) is true, i. e. that(k +1)3 (k +1) is divisible by 6.

(k +1)3 (k +1) = k 3 +3 k2 + 3 k +1 k 1 = = (k 3 k ) + 3 k2 + 3 k = = 6 s + 3 k (k +1)

Page 3: Induction proofs

3

Suppose we want to prove the formula for the sum of ‘geometric progression’

q

qq...qqq

nn

1

11

132

where 10 q , and n is any integer, n0

How can we prove that the formula is correct for any n0 ?

Notation:

n

i

in

n qq...qqS0

21

q

qS

n

n

1

1 1

• Show it for arbitrary fixed n0 (prove directly, without induction)• Use induction on n0

Two alternatives:

Page 4: Induction proofs

4

• Show it for some n0 (prove P (n) for any n directly)

1212 1)(1 nnn

n qq...qqq...qqSq

nS11 n

nn qSSq

11)(1 n

n qqS

q

qS

n

n

1

1 1

Page 5: Induction proofs

5

1) Base: n=0

1;00

00

qqSi

i 11

1

1

1 10

q

q

q

q

2) Induction Hypothesis: Assume the formula is correct for n=k, where k is some integer, k0

q

qS

k

k

1

1 1

Induction Step: prove the formula for n=k+1, i. e. q

qS

k

k

1

1 11)(

1

112

1 1 k

k

kk

k qSqq...qqS

q

q

q

qqq

qq

q

k

kkk

kk

1

1

1

1

1

1

11)(

11)(11

11

• Proof by induction on n0 that q

qS

n

n

1

1 1

Page 6: Induction proofs

6

(n n0) P (n) •P (n0)•(n n0) [P (n) P (n+1)]

?

Induction Principle . If A is a subset of N that satisfies twoproperties:

1) n0 A 2) n n0 [n A(n+1)A],

then A =N

We just can think about A as a set of integers, that satisfy P:A ={nN | P (n)}

Then,1) n0 A P (n0 ) 2) n n0 [nA(n+1)A] n n0 (P(n) P (n +1))

Page 7: Induction proofs

7

Although it sounds very obvious, the induction principle hinges on the property of integers, so called Well-Ordering principle (accept it as an axiom).

Well-Ordering Principle. Any nonempty subset of N contains a smallest element.

Neither rational, no real numbers has this property!

Induction principle is equivalent to the Well-ordering principle.

Page 8: Induction proofs

8

Theorem. Well-ordering principle (WOP) implies Induction Principle(IP)

Proof. Suppose WOP is true, i.e. any nonempty subset of N contains a smallest element. We want to prove that IP is true, i. e. if any set A satisfies properties

i) 0Aii) n 0 [nA(n+1)A],

then A =N.

Page 9: Induction proofs

9

We are going to prove it by contradiction. 1) Assume that A satisfies both properties, but A N . 2) Then N A = B , i. e. B is nonempty subset of N .3) By WOP B contains the smallest element. Let denote it s, s B, so sA. 4) Since s is the smallest element of B, s1B. 5) Since 0A by i), 0B, so s >0 and s1 0, i. e. s1N.6) s1N and s1B imply s1A .7) By ii) s1A sA , contradiction with sA.

Page 10: Induction proofs

10

n

012

.

.

.

i) 0A

A = {n N | P(n)}

ii) n 0 [nA(n+1)A]

B = N A

Proof by contradiction:Assume that A N.

s 1 A, since s is the smallest

B

s A by ii)

sB, since B = N A

sB (by WOP)

in contradiction with sB

Page 11: Induction proofs

11

Example. Prove that the number of different binary strings of length n is 2n.

Proof by induction on n1.We want to prove: n1 [P (n)], where P (n): the number of binary strings of length n is 2n.

1) Basis. n=1. We have two strings of the length one: 0 and 1.

2) Assume P (n) for n=k, where k is some integer, k 1 (IH).

So, we assume that for some k 1 there are 2k binary strings.

In the IS we need to prove P (n) for n=k+1

I. e. we need to show that there are 2(k+1) binary stringsof the length (k +1).

Page 12: Induction proofs

12

Here is the proof that there are 2(k+1) binary strings of length (k+1).

Any binary string of length (k+1) can be represented as a binarystring of length k with one extra bit (let it be the last one). There are two choices for the last bit: 0 or 1.

By IH there are 2k strings of length k. Then, we have 2k strings of length (k+1) that end with 0 and 2k strings of length (k+1) that end with 1, so the total number is 2k + 2k =2 2k =2(k+1)

QED.

By IP we conclude, that for any n 1 the number of binary strings is 2n.

Page 13: Induction proofs

13

Let’s use the induction to prove the following known fact.

Example. Prove that for any set A cardinality of a power set is |Power(A)|=2|A|.To apply induction we need to chose the integer variable.Here we can prove by induction on n = |A|.

So, we want to prove that the propositionP : |Power(A)|=2|A| is true for any n=|A| 0.

1) Basis: n=|A|=0, A= , There is only one subset of the empty set, so |Power()|=1=20

2) IH: Assume that for n=k, k is any integer k 0, we have that any set A with |A|=k has 2k subsets. IS: we need to imply that any set B with cardinality |B|=k+1 has the property P, i. e. has 2(k+1) subsets.

Page 14: Induction proofs

14

Here we need to do the job…Take any set B of k+1 elements. Pick any element x. Then all subsets of B can be divided into two parts: i) subsets that do not contain x. How many such subsets exist? We can argue, that subsets of B that do not contain x constitute subsets of the set B {x}, that has cardinality k. | B {x}| = k and by IH there exist 2k subsets.

ii) subsets that include x. How many such subsets exist?Again, the number of such subsets equals the number of Subsets of the set B {x}, this number is 2k. Now, the total number of subsets is the sum of two groups, 2k + 2k =2 2k= 2k+1. So, from assumption that the proposition is true for n=k ( k is any integer k 0) we can imply that the proposition is true for n =k+1.By Induction principle we conclude that the proposition is true for all integer n 0, i. e. for sets of any size |A|=n.

Page 15: Induction proofs

15

What is wrong with the following reasoning?

All horses are the same color

P (n): n horses are the same color

Basis. P (1)=true.

IS . Assume that for some k 1 P (k) is true. We need to prove that P (k +1) is true.

k

k

Page 16: Induction proofs

16

You are given a board divided into mm equal squares, where m is a power of 2. One arbitrary square is distinguished as special. Prove that with exception of one special square that may be arbitrarily located on the board, the board can be always covered with L-shaped tiles.

Tiling problem.

A special square

Page 17: Induction proofs

17

Proof by induction on k1, where m=2k is the side of the board.

1) Basis: k=1, m=2. It is clear, that for any position of a special square, the 22 board can be covered by one tile:

Page 18: Induction proofs

18

Induction Hypothesis. Assume that for a board of 2k2k squares the tiling problem can be solved, i.e. for arbitrary location of a special square the board can be covered by L-shaped tiles. In induction step we need to prove that the tiling can be solved for the board of 2k+12k+1 squares.  

2k 2k

Such a board consists of 4 boards of 2k2k squares.

2k

2k

22k=2k+1

Page 19: Induction proofs

19

In accordance with IH, tiling problem can be solved for each of these four boards for arbitrary positions of special squares. In particular, it means that we can choose three of specials around the center, so that to use additional tile for them. The remaining special can be placed anywhere and in this way we proved that tiling problem can be solved for a 2k+12k+1 - board.

2k

2k

22k=2k+1

2k 2k

Page 20: Induction proofs

20

Induction and Recursion.

Explicit definition Recursive definition

11)...2(! nnn

0if1)!(

0if1!

n nn

n n

n

n q...qqS 21

0if

0if1

1 n qS

n S

n

n

n

R...RRRn

1if

1if1 n RR

n RR

n

n

• Factorial

• Geometric progression

• Power of relation on a set

Page 21: Induction proofs

21

• The recursive definition of a function makes reference to earlier versions of itself.

• The main connection between recursion and induction is that objects are defined by means of a natural sequence.

• Induction is usually the best (possibly the only) way to prove results about recursively defined objects.

Page 22: Induction proofs

22

Example. Prove that for all positive integers m and n, nmmn RRR

Proof. Let m be arbitrary positive integer and then prove by induction on n 1.

1) Basis. n=1: (by recursive definition of Rm+1) 11 RRR mm

2) IH: Assume that for some k 1 we have IS: We need to prove that

kmkm RRR

1)(1)( kmkm RRR

RRR km )( …..by IH

)( RRR km ….association of composition

1 km RR ……..definition of composition

1)(1)( RRR kmkm ……..definition of composition

Page 23: Induction proofs

23

The sequence named for Fibonacci (1202) is introduced in terms of rabbits. Suppose that every month a breeding pair of rabbits produce a pair of offspring. The offspring in turn start breeding two months later, and so on. Denote Fn the number of pairs in month n. Suppose you buy a pair of rabbits in month 1 (F0=0, F1=1) then you still have one pair in month 2 (F2=1), but in month 3 they start breeding, F3=2. The sequence begins 0, 1, 1, 2, 3, 5, 8, 13, 21,… You can observe, that in a month n you have all pairs from the previous month (n1), plus offspring pairs for all pairs from month (n2), i. e. :

Fibonacci Numbers

21 nnn FFF , n 2

Page 24: Induction proofs

24

1if

1if1

0if0

21 n FF

n

n

F

nn

n

Proof by induction on n 0.

1200

0

0

FFFi

i

?1) Basis. Take n=0 and check that

101012 FFFBy the recurrent formula for n =2 we have

, so F21=0 and F0=0.

So, Fibonacci numbers can be defined recursively:

These numbers have numerous applications in CS, mathematics, theory of games.

120

n

n

ii FFLet’s prove the closed formula for the sum

for all integers n 0

Page 25: Induction proofs

25

2) IH: Assume that the summation formula is correct for n=k, where k is some integer k 0, i. e.

10

2k

k

ii FF

IS: We need to prove that 121)(

1

0

k

k

ii FF

110

1

0

kk

k

ii FF...FFF

10

k

k

ii FF

12 1 kk FF …………by IH

11 321 kkk FFF ..by recurrence formula for (k+3) >1