more about induction
play

More About Induction Reading: EC 2.4 Peter J. Haas INFO 150 Fall - PowerPoint PPT Presentation

More About Induction Reading: EC 2.4 Peter J. Haas INFO 150 Fall Semester 2019 Lecture 9 1/ 15 More About Induction Overview Sums as Recursive Sequences Proving Properties of a Recursive Sequence Closed-Form Sequences General Inductive


  1. More About Induction Reading: EC 2.4 Peter J. Haas INFO 150 Fall Semester 2019 Lecture 9 1/ 15

  2. More About Induction Overview Sums as Recursive Sequences Proving Properties of a Recursive Sequence Closed-Form Sequences General Inductive Proofs Fundamental Theorem of Arithmetic Lecture 9 2/ 15

  3. Overview Goal I Connect induction on recursive sequences and sums I Illustrate fancier applications of induction I Use induction in a variety of settings Lecture 9 3/ 15

  4. Sums as Recursive Sequences Recall: with a 1 = 1 and a k = a k − 1 + (2 k − 1), prove that a n = n 2 I Inductive step to show that a m = m 2 : a m = a m − 1 + (2 m − 1) = ( m − 1) 2 + (2 m − 1) using a m − 1 = ( m − 1) 2 = m 2 − 2 m + 1 + 2 m − 1 = m 2 Lecture 9 4/ 15

  5. Sums as Recursive Sequences Recall: with a 1 = 1 and a k = a k − 1 + (2 k − 1), prove that a n = n 2 I Inductive step to show that a m = m 2 : a m = a m − 1 + (2 m − 1) = ( m − 1) 2 + (2 m − 1) using a m − 1 = ( m − 1) 2 = m 2 − 2 m + 1 + 2 m − 1 = m 2 Recall: Prove that P n i =1 i = n ( n +1) 2 I Inductive step to show S ( m ): 1 + 2 + · · · + m = � 1 + 2 + · · · + ( m − 1) � + m = ( m − 1) m + m using S ( m − 1) 2 = m 2 − m = m 2 + m + 2 m = m ( m + 1) 2 2 2 2 Lecture 9 4/ 15

  6. Sums as Recursive Sequences Recall: with a 1 = 1 and a k = a k − 1 + (2 k − 1), prove that a n = n 2 I Inductive step to show that a m = m 2 : a m = a m − 1 + (2 m − 1) = ( m − 1) 2 + (2 m − 1) using a m − 1 = ( m − 1) 2 = m 2 − 2 m + 1 + 2 m − 1 = m 2 Recall: Prove that P n i =1 i = n ( n +1) 2 I Inductive step to show S ( m ): 1 + 2 + · · · + m = � 1 + 2 + · · · + ( m − 1) � + m = ( m − 1) m + m using S ( m − 1) 2 = m 2 − m = m 2 + m + 2 m = m ( m + 1) 2 2 2 2 Both proofs have a common structure I First step: Establish relationship between a m and a m − 1 [or S ( m ) and S ( m − 1)] I Second step: use that information Lecture 9 4/ 15

  7. Sums as Recursive Sequences, Continued Key idea: sums are recursive by nature I Sum of 101 numbers = (sum of 100 numbers) + (final number) I Will write s n instead of a n to emphasize that given sequence is defined by a sum Lecture 9 5/ 15

  8. Sums as Recursive Sequences, Continued Key idea: sums are recursive by nature I Sum of 101 numbers = (sum of 100 numbers) + (final number) I Will write s n instead of a n to emphasize that given sequence is defined by a sum Example I Consider s n = P n i =1 (2 i − 1) = 1 + 3 + 5 + · · · + (2 n − 1) I E.g., s 5 = 1 + 3 + 5 + 7 + 9 (five terms) I Find a recursive description of s n I s n = sum of first ( n − 1) terms plus n th term: n X s n = (2 i − 1) i =1 = 1 + 3 + 5 + · · · + (2 n − 1) � � = 1 + 3 + 5 + · · · + (2 n − 3) + (2 n − 1) = s n − 1 + (2 n − 1) I So s n = s n − 1 + (2 n − 1) is recurrence relation (with s 1 = 1) Lecture 9 5/ 15

  9. Sums as Recursive Sequences, Continued Key idea: sums are recursive by nature I Sum of 101 numbers = (sum of 100 numbers) + (final number) I Will write s n instead of a n to emphasize that given sequence is defined by a sum Example I Consider s n = P n i =1 (2 i − 1) = 1 + 3 + 5 + · · · + (2 n − 1) I E.g., s 5 = 1 + 3 + 5 + 7 + 9 (five terms) I Find a recursive description of s n I s n = sum of first ( n − 1) terms plus n th term: n X s n = (2 i − 1) i =1 = 1 + 3 + 5 + · · · + (2 n − 1) � � = 1 + 3 + 5 + · · · + (2 n − 3) + (2 n − 1) = s n − 1 + (2 n − 1) I So s n = s n − 1 + (2 n − 1) is recurrence relation (with s 1 = 1) Itt ) i =1 (2 i + 1)? ( Example: What is the recursive form of s n = P n 921 it - Lecture 9 5/ 15

  10. Example: Finding a Closed Form for a Sum Example: Show that P n 3 i = 1 − 1 2 3 n for every positive integer n i =1 1. Let s n = P n 3 i : will show that s n = 1 − 1 2 3 n i =1 2. Recurrence relation: s n = s n − 1 + 2 3 n with s 1 = 2 3 3. s 1 = 1 − 1 3 1 = 2 3 X 1 4. Fix m ≥ 2 & assume that statements up to s m − 1 = 1 − 3 m − 1 have been checked 5. Consider s m : s m = s m − 1 + 2 from recurrence relation 3 m 1 + 2 1 ⇣ ⌘ = 1 − since s m − 1 = 1 − 3 m − 1 3 m 3 m − 1 = 1 − 3 3 m + 2 3 m = 1 − 1 3 m X Lecture 9 6/ 15

  11. Example: Finding a Closed Form for a Sum Example: Show that P n 3 i = 1 − 1 2 3 n for every positive integer n i =1 1. Let s n = P n 3 i : will show that s n = 1 − 1 2 3 n i =1 2. Recurrence relation: s n = s n − 1 + 2 3 n with s 1 = 2 3 3. s 1 = 1 − 1 3 1 = 2 3 X 1 4. Fix m ≥ 2 & assume that statements up to s m − 1 = 1 − 3 m − 1 have been checked 5. Consider s m : s m = s m − 1 + 2 from recurrence relation 3 m 1 + 2 1 ⇣ ⌘ = 1 − since s m − 1 = 1 − 3 m − 1 3 m 3 m − 1 = 1 − 3 3 m + 2 3 m = 1 − 1 3 m X Moral: Finding nice formulas for sums is a special case of finding closed formulas for recurrence relations Lecture 9 6/ 15

  12. Another Example 4in ) Exercise: Show that P n she i =1 (4 i − 1) = n (2 n + 1) ✓ ) Chitti Si 4.1-1=3 1. I ' Cti Me = . . ; is correct for .gs closed formula . ,sm that the , . , . . Assume 2. sni-sm.tt/m-D=cm-Dkcm-iH-ilt4m-l by induction hyp . 3 . 4th I ) " I It 2cm - the - = - ' )t5m -2 Llm -2mW = 4mt2t5m 2 2Mt - - = m( 1) ✓ 2Mt " tm Lm = = Lecture 9 7/ 15

  13. Proving Properties of a Recursive Sequence Key idea: You can prove properties of a sequence even if you can’t find a closed form Lecture 9 8/ 15

  14. Proving Properties of a Recursive Sequence Key idea: You can prove properties of a sequence even if you can’t find a closed form Example: For a n = 2 a n − 1 + a n − 2 with a 1 = 5 , a 2 = 10, show that a n < 3 n for n ≥ 3 1. Calculate: a 1 = 5, a 2 = 10, a 3 = 25, a 4 = 60 2. We see that a 3 < 3 3 and a 4 < 3 4 3. Fix m ≥ 5 such that inequalities up to a m − 1 < 3 m − 1 have been checked 4. Consider a m and show that a m < 3 m : a m = 2 a m − 1 + a m − 2 by recurrence relation < 2 · 3 m − 1 + a m − 2 since a m − 1 < 3 m − 1 is true < 2 · 3 m − 1 + 3 m − 2 since a m − 2 < 3 m − 2 is true < 2 · 3 m − 1 + 3 m − 1 since 3 m − 2 < 3 m − 1 = 3 · 3 m − 1 = 3 m X Lecture 9 8/ 15

  15. Proving Properties of a Recursive Sequence Key idea: You can prove properties of a sequence even if you can’t find a closed form Example: For a n = 2 a n − 1 + a n − 2 with a 1 = 5 , a 2 = 10, show that a n < 3 n for n ≥ 3 1. Calculate: a 1 = 5, a 2 = 10, a 3 = 25, a 4 = 60 2. We see that a 3 < 3 3 and a 4 < 3 4 3. Fix m ≥ 5 such that inequalities up to a m − 1 < 3 m − 1 have been checked 4. Consider a m and show that a m < 3 m : I a m = 2 a m − 1 + a m − 2 by recurrence relation < 2 · 3 m − 1 + a m − 2 since a m − 1 < 3 m − 1 is true < 2 · 3 m − 1 + 3 m − 2 since a m − 2 < 3 m − 2 is true < 2 · 3 m − 1 + 3 m − 1 since 3 m − 2 < 3 m − 1 = 3 · 3 m − 1 = 3 m X =3 n Observations because I We checked initially for n = 3 instead of n = 1 (why?) I We checked both n = 3 and n = 4 before inductive step—what if we only not induction For to This checked n = 3? need ay on as is use ) is false . , C and proven I Moral: It is not always su ffi cient to check only one initial statement Lecture 9 8/ 15

  16. Fibonacci Numbers Recall definition I F n = F n − 1 + F n − 2 with F 1 = 1 , F 2 = 1 I Sequence looks like 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , . . . Prove: P ( n ) : “ F 3 n is always even” (i.e., F k is even if k is divisible by 3) 1. By inspection, P (1) is true, since F 3 = 2 2. Fix m ≥ 2 and assume that P (1) , P (2) , . . . , P ( m − 1) have been checked; i.e., F 3 , F 6 , . . . , F 3( m − 1) are all even 3. Consider P ( m ): F 3 m = F 3 m − 1 + F 3 m − 2 by recurrence relation for F 3 m = ( F 3 m − 2 + F 3 m − 3 ) + F 3 m − 2 by recurrence relation for F 3 m − 1 = F 3( m − 1) + 2 F 3 m − 2 rearranging terms and simplifying 4. that F 3( m − 1) is even has been checked & 2 F 3 m − 2 is clearly even 5. F 3 m = F 3( m − 1) + 2 F 3 m − 2 is the sum of two even numbers, and hence is even X Lecture 9 9/ 15

  17. Another Fibonacci Example i =1 ( F i ) 2 = ( F n )( F n +1 )” Prove: P ( n ): “ P n 1. ( F 1 ) 2 = ( F 1 )( F 2 ) is true, since 1 2 = 1 · 1, so P (1) is true 2. Fix a positive integer m and assume that P (1) , P (2) , . . . , P ( m − 1) have been checked to be true 3. Consider P ( m ): m ( F i ) 2 = ( F 1 ) 2 + ( F 2 ) 2 + · · · + ( F m ) 2 X i =1 = ( F 1 ) 2 + ( F 2 ) 2 + · · · + ( F m − 1 ) 2 + ( F m ) 2 m − 1 ! X ( F i ) 2 + ( F m ) 2 = i =1 = ( F m − 1 )( F m ) + ( F m ) 2 by P ( m − 1) = ( F m )( F m + F m − 1 ) = ( F m )( F m +1 ) X by recurrence relation for F m +1 Lecture 9 10/ 15

  18. Exercise , E- 2,4=3 F- I I IT - n - - . - , , Prove: P ( n ): “ F n < 2 n for all positive integers n ” true Ph ) and PCD are ' I File f so 22 I - I - . , that true put Dare Plm 3 and assume - Pick > m . . . , r . Fm = Fm Fm . it 3 . , i ) and up assumed Plm - ' In Plm are I - t since - true < ' 2 zm " zm - - " +2M since a zm < I m - 2 2 - = ✓ In = Lecture 9 11/ 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend