1 / 21

Mathematical Induction.

Mathematical Induction. Induction is the most important proof method in computer science. Suppose you want to prove that the proposition P ( n ) is true for all n  N , where N = {0, 1, 2, …} (an infinite set). ( i. e. every natural number n has some property P ).

reeves
Download Presentation

Mathematical Induction.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mathematical Induction. • Induction is the most important proof method in computer science. • Suppose you want to prove that the proposition P (n) is true • for all n N, where N = {0, 1, 2, …} (an infinite set). • ( i. e. every natural number n has some property P) • You might be able to prove it for 0, 1, 2, … But you can’t check • one-by-one that all natural numbers have property P.

  2. The key idea of mathematical induction is start with 0 and • repeatedly add 1. • Suppose you can show that • i) 0 has property P and • ii) whenever you add 1 to a number that has property P • the resulting number alsohas property P. This guarantees that as you go through the list of all natural numbers, every number you encounter must have property P.

  3. Induction Hypothesis: • fix some k 0 • assumeP (k) • Induction Step • Using assumption P (k) • prove that P (k+1) In this way we prove that for any n [P(n) P(n+1)] • The proof method of mathematical induction says that you • just need to do two things: • i) prove it for n = 0 (basis case) • ii) prove “if it’s true for n=k, then it’s true for n =k+1”

  4. The pattern is: • To prove n 0 (P (n)) it’s enough to show: • 1) (Base) P (0) • 2)  n 0 (P(n)  P (n +1)) Why does this prove it for all n  N? Actually it relies upon the property of integers N={0, 1, 2, …} How can we prove  n 0 (P(n)  P (n +1)) ? Pick arbitrary k 0 and prove it for n = k. So, in the second step we say: “take some k 0 and assume that property P holds for n = k“ (Induction Hypothesis). Then, (based upon this assumption) we need to show that the property P can be implied for n = k +1.

  5. where , and n is any integer, n0 Notation: Suppose we want to prove the formula for the sum of ‘geometric progression’ How can we prove that the formula is correct for any n0 ? • Show it for arbitrary fixed n0 • Use inductionon n0

  6. Show it for some n0

  7. Proof by induction on n0 1) Base: n=0 2) Induction Hypothesis: Assume the formula is correct for n=k, wherek is some integer, k0 Induction Step: prove the formula for n=k+1, i. e.

  8. To prove  n  n0(P (n)) it’s enough to show: • 1) (Base) P ( n0) • 2)  n  n0 (P(n)  P (n +1)) There is a variant if you want to prove it for n  n0: 1) In the base case we explicitly check n = n0 2) Pick arbitrary k  n0 and assume that the property P holds for n = k . (Induction Hypothesis) Based upon this assumption prove that the property P can be implied for n = k +1. (Induction Step)

  9. Example. Prove that for all n1 n!  2n1. Proof by induction on n1. 1). Basis: n =1. 1!=1=211=20. So, for the case n=1, we checked that n!2n1. 2). Assume that for n=k, k is some integer k1, inequality holds, i. e. k!  2k1 (IH). We want to prove that n!  2n1 for n = k +1, i. e. we want to show that (k+1)!  2(k+1)1 Using the definition of factorial we have (k+1)!= (k+1)k!  (k+1)2k1 ……by IH  (1+1)2k1 ……because k1 = 2 2k1 = 2k……QED, because 2(k+1)1= 2k By Induction Principle we conclude that n!  2n1for all n1

  10. Let’s prove the formula for the sum of integers from 1 to n: n 0 P (n) Alternative notation for the LHS: Thus we want to prove: n 0 Induction proof for the summation formula

  11. Let’s stop for a moment and check that the formula we are to prove makes sense: n 0 • Consider a few particular cases: • n =1 • n = 0

  12. In accordance with induction pattern: 1) (Base) P (0) 2)  n 0 (P(n)  P (n +1)) P (n) here is the predicate: • Prove:  n 0 • (Base) • (Inductive step)  n 0 P (n) P (n+1)

  13. Show that the P(n=k+1): can be implied (IS) ……..by IH ….algebra 1) Basis: check that the formula is correct for the case of no terms 2) fix some k 0 and assume that proposition holds for n = k P(n=k) (induction hypothesis, IH)

  14. Why induction proofs work? Intuitively, because we can reach any number n if we start with the smallest one and add 1 step-by-step. So, induction principle express this obvious fact. More formally, induction principle is formulated in terms of a set A = {n N | P (n)} • Induction Principle . If A is a subset of N that satisfies two • properties: • 1) 0A • 2) n  0 [n A(n+1)A], • then A =N

  15. 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.

  16. 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) 0A • ii) n  0 [nA(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 sA. • 4) Since s is the smallest element of B, s1B. • 5) Since 0A by i), 0B, so s >0 and s1 0, i. e. s1N. • 6) s1N and s1B imply s1A . • 7) By ii) s1A  sA , contradiction with sA.

  17. B  B = N A sB (by WOP) s A by ii) sB, 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 [nA(n+1)A] 2 1 in contradiction with sB 0 i) 0A

  18. Example. Prove that the number of different binary strings of length n is 2n. Proof by induction on n1. We want to prove:  n1 [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).

  19. 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.

  20. 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. • Basis: n=|A|=0, A= , • There is only one subset of the empty set, so • |Power()|=1=2 • 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.

  21. 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.

More Related