Download Mathematical Induction: Proofs for Algorithms and Abstract Data Types and more Papers Computer Science in PDF only on Docsity! CMPS 101 Algorithms and Abstract Data Types Summer 2005 Induction Proofs Let )(nP be a propositional function of an integer n, i.e. P is a function whose domain is (some subset of) the set of integers and whose codomain is the set {true, false}. Informally this means )(nP is an assertion whose truth or falsity depends on the integer n. Mathematical Induction is a proof technique which can be used to prove statements of the form )(:0 nPnn (“for all n greater than or equal to 0n , )(nP is true”). Here 0n is some fixed integer, and often 10 n . Such a proof consists of two steps: I. Base Step: Prove directly that the proposition )( 0nP is true. IIa. Induction Step: Prove ))1()((:0 nPnPnn . To do this pick an arbitrary 0nn , and assume for this n that )(nP is true. Then show as a consequence that )1( nP is true. The statement )(nP is often called the induction hypothesis, since it is what is assumed in the induction step. When I and II are complete we conclude that )(nP is true for all 0nn . Induction is sometimes explained in terms of a domino analogy. Consider an infinite set of dominos which are lined up and ready to fall. Each domino is labeled by a positive integer, starting with 1 (i.e. 10 n ). Let )(nP be the assertion: “the nth domino falls”. First prove )1(P , i.e. “the first domino falls”, then prove ))1()((: 1 nPnPn which says “if any particular domino falls, then the next domino must also fall”. When this is done we may conclude )(:1 nPn , “all dominos fall”. There are a number of variations on the induction step. The first is just a reparametrization of IIa. IIb. Induction Step: Prove ))()1((:0 nPnPnn Let 0nn , assume )1( nP is true, then prove )(nP is true. Forms IIa and IIb are said to be based on the first principle of mathematical induction. The validity of this principle is proved in the appendix of this handout. Another important variation is called the second principle of mathematical induction, or strong induction. IIc. Induction Step: Prove ))1())( :((:0 nPkPnknn Let 0nn , assume that for all k in the range nkn 0 , )(kP is true. Then prove as a consequence that )1( nP is true. In this case the term induction hypothesis refers to the stronger assumption: )( : kPnk . The strong induction form is often reparameterized as in IIb: IId. Induction Step: Prove ))())(:((:0 nPkPnknn Let 0nn , assume for all k in the range nkn 0 , that )(kP is true, then prove as a consequence that )(nP is true. In this case the induction hypothesis is )( : kPnk . In terms of the Domino analogy, the strong induction form IId says we must show: (I) the first domino falls, and (II) for any n, if all dominos up to but not including the thn domino fall, then the thn domino falls. From (I) and (II) we may conclude that all dominos fall. Strong Induction is most often parameterized as in IId, and form IIc is uncommon. We present here a number of examples of IIa, IIb, and IId. Example 1 Prove that for all 1n : 6 )12)(1( 2 1 nnn i n i Proof: Let )(nP be the boxed equation above. We begin the induction at 10 n . I. Base step Clearly 6 )112()11(1 1 1 1 2 i i , showing that )1(P is true. IIa. Induction Step Let 1n and assume )(nP is true. That is, for this particular value of n, the boxed equation holds. Then 22 1 2 1 1 )1( nii n i n i 2)1( 6 )12)(1( n nnn (by the induction hypothesis) 6 )1(6)12)(1( 2 nnnn 6 1)1(21)1()1( nnn (by some algebra) showing that )1( nP is true. We conclude that )(nP is true for all 1n . /// One should always state explicitly what is being assumed in the induction step (i.e. what is the induction hypothesis.) One should also make note of the point in the proof at which the induction hypothesis is used. Example 2 Let Rx and 1x . Show that for all 0n : 1 1 1 1 x x x n i n i Proof: Here we will use form IIb. Again let )(nP be the boxed equation. We begin the induction at 00 n . I. Base step 1 1 1 0 0 0 x x xx i i , showing that )1(P is true. IIb. Induction Step Let 0n and assume that )1( nP is true, i.e. assume for this particular n that: 1 11 0 x x x n i n i . Then Proof: Let )(nP be the boxed inequality above. I. Base Step The inequality )1lg()1( T reduces to simply 00 , which is obviously true, so )1(P holds. IId. Induction Step (Strong Induction) Let 1n and assume for all k in the range nk 1 that )(kP is true, i.e. )lg()( kkT . In particular 2/lg2/ nnT when 2/nk . Therefore 12/)( nTnT (by the recurrence for )(nT ) 12/lg n (by the induction hypothesis) 1)2/lg( n (since xx for any x) 1)2lg()lg( n )lg(n , showing that )(nP is true. Therefore )lg()( nnT for all 1n as claimed. /// Exercise Define )(nS for Zn by the recurrence 2 if12/ 1 if0 )( nnS n nS Prove that for all 1n : )lg()( nnS (whence )(lg)( nnS .) Induction Fallacies The next few examples illustrate some pitfalls in constructing induction proofs. The result in Example A below was proved correctly in Example 3. We give an invalid proof of the same fact which illustrates an argument some authors have called the “induction trap”. Example A For all 1n , if T is a tree on n vertices then T has 1n edges. Proof: (Invalid) Base Step: If 1n then T has no edges, being acyclic. Induction Step: Let 1n and let T be a tree on n vertices. Assume that T has 1n edges. Add a new vertex and join it to T with a new edge. The resulting graph has 1n vertices and n edges (and is clearly a tree since connectedness is maintained and no cycles were created.) By the principle of mathematical induction, all trees on n vertices have 1n edges. Let us first observe that this argument does not follow the induction paradigm. In this example )(nP is of the form )()( nBnA where )(nA is the statement “T is a tree on n vertices”, and )(nB is “T has 1n edges”. The induction step should therefore be to prove, for all 1n , )1()( nPnP . That is ))1()1(())()(( nBnAnBnA . To prove this we should assume )()( nBnA , then assume )1( nA , then show as a consequence that )1( nB is true. In other words we should: Assume all trees on n vertices have 1n edges Assume T has 1n vertices Show as a consequence that T has n edges The above argument did not follow this format however. Instead the arguer does the following. Assume T has n vertices Assume T has 1n edges Construct a new tree from T having 1n vertices and n edges Therefore the above argument was not a proof by induction. Some students would nevertheless hold that the above argument is still valid, even though it is not a true induction proof. The next example shows convincingly that it cannot be valid. First we introduce a few more definitions related to graphs. A graph G is called simple if it contains no loops (i.e. edges whose end vertices are identical) and no multiple edges (i.e. pairs of edges with the same end vertices). Example B For all 1n , if G is a simple graph on n vertices, then G has 1n edges. (False!) We notice right away that the above statement is false since the graph below provides an elementary counter-example. But consider the following “proof” in light of Example A. Proof: (Invalid) Base Step: If 1n then G has no edges, being simple. Induction Step: Let 1n and let G be a simple graph on n vertices. Assume that G has 1n edges. Add a new vertex and join it to G with a new edge. The resulting graph has 1n vertices and n edges (and is clearly simple since no loops or multiple edges were created.) By the principle of mathematical induction, all simple graphs on n vertices have 1n edges. Observe that Example B follows the format of Example A word for word. Thus if A is valid, so must B be valid. But the assertion “proved” in B is false! Therefore B cannot be a valid argument, and so neither is A. Another fallacy comes about by not proving the induction step for all 0nn . Example C All horses are of the same color. Proof: (Invalid) We prove that for all 1n : if S is a set of n horses, then all horses in S have the same color. The result follows on letting S be the set of all horses. Let )(nP be the boxed statement, and proceed by induction on n. Base Step: Let 1n . Obviously if S is a set consisting of just one horse, then all horses in S must have the same color. Thus )1(P is true. Induction Step: Let 1n and assume that in any set of n horses, all horses are of the same color. Let S be a set of 1n horses, say 1321 ,,,, nhhhhS . Then the sets }{},,,{ 1132 hShhhS n and }{},,,{ 2131 hShhhS n each contain exactly n horses, and so by the induction hypothesis all horses in S are of one color, and likewise for S . Observe that SSh 3 and that 3h can have only one color. Therefore the color of the horses in S is identical to that of the horses in S . (Note 31 2 1 nnn , so there is in fact a third horse, and he can have only one color.) Since SSS it follows that all horses in S are of the same color. Thus )1( nP is true, showing that )1()( nPnP for all 1n . The result now follows by induction. Obviously the proposition being proved is false, so there is something wrong with the proof, but what? The base step is certainly correct, and the induction step, as stated, is also correct. The problem is that the induction step was not quantified properly. We should have proved )1()(:1 nPnPn Instead we proved (correctly) that )1()(:1 nPnPn . Indeed it is true that )3()2( PP , )4()3( PP , and )5()4( PP , etc.., but we never proved (and it is false that) )2()1( PP . In terms of the domino analogy, it is as if the first domino falls; and if any domino indexed 2 or above were to fall, then the next domino would fall; but the first domino is not sufficient to topple the second domino, and hence no domino other than the first actually falls. Appendix: Proof of the first principle of mathematical induction (form IIb). We prove for any propositional function )(nP defined on the positive integers Z , that )(:1)()1(:1)1( nPnnPnPnP is a tautology. The proof is based on the well ordering property of the positive integers which says: Any non-empty set of positive integers contains a least element. We assume this property without proof. Proof: Assume that the statements )1(P and )()1(:1 nPnPn are true. Let }false is )(:{ nPZnS . It will be sufficient to show that S , for then )(nP is true for all 1n . Assume, to get a contradiction, that S . Then S contains a smallest element m by the well ordering property. Since )1(P is true, S1 and so 1m . Therefore 1m , and 11 m . Since m is the smallest element in S, we have Sm 1 , whence )1( mP is true. By setting mn in the statement )()1(:1 nPnPn we have )()1( mPmP , and since )1( mP is true, we conclude that )(mP is also true . Thus Sm , contradicting the very definition of m as the smallest element in S. This contradiction shows that our assumption was false, and therefore S as required. ///