260 likes | 379 Views
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
E N D
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).
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 stepP (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)
where , and n is any integer, n0 Notation: Two alternatives: • Show it for arbitrary fixed n0 (prove directly, without induction) • Use induction on n0 Suppose we want to prove the formula for the sum of ‘geometric progression’ How can we prove that the formula is correct for any n0 ?
Proof by induction on n0 that 1) Base: n=0 2) Induction Hypothesis: Assume the formula is correct for n=k, wherek is some integer, k0 Induction Step: prove the formula for n=k+1, i. e.
? • P (n0) • (n n0)[P (n) P (n+1)] (n n0)P (n) • Induction Principle . If A is a subset of N that satisfies two • properties: • 1) n0A • 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) n0A P (n0) 2) n n0 [nA(n+1)A] n n0 (P(n) P (n +1))
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.
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) 0A • ii) n 0 [nA(n+1)A], • then A =N.
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.
B B = N A sB (by WOP) s A by ii) sB, since B = N A Proof by contradiction: Assume that A N. n A = {n N | P(n)} s 1 A, since s is the smallest . . . ii) n 0 [nA(n+1)A] 2 1 in contradiction with sB 0 i) 0A
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 strings of the length (k +1).
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 binary string 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.
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 proposition P : |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.
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 n0, i. e. for sets of any size |A|=n.
k … k 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.
Tiling problem. 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. A special square
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: Proof by induction on k1, where m=2k is the side of the board.
Such a board consists of 4 boards of 2k2k squares. 2k 22k=2k+1 2k 2k 2k 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 22k=2k+1 2k 2k 2k 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.
Induction and Recursion. Recursive definition Explicit definition • Factorial • Geometric progression • Power of relation on a set
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.
Example. Prove that for all positive integers m and n, 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) 2) IH: Assume that for some k 1 we have IS: We need to prove that ……..definition of composition ….association of composition …..by IH ……..definition of composition
, n 2 Fibonacci Numbers 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. :
Let’s prove the closed formula for the sum for all integers n 0 ? 1) Basis. Take n=0 and check that By 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. Proof by induction on n 0.
2) IH: Assume that the summation formula is correct for n=k, where k is some integer k 0, i. e. IS: We need to prove that …………by IH ..by recurrence formula for (k+3) >1