Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quiz 7 The way I expected it.. How to do it! 1. Let P(n) be the statement that 1 2 + 2 2 +... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n. Be.

Similar presentations


Presentation on theme: "Quiz 7 The way I expected it.. How to do it! 1. Let P(n) be the statement that 1 2 + 2 2 +... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n. Be."— Presentation transcript:

1 Quiz 7 The way I expected it.

2 How to do it! 1. Let P(n) be the statement that 1 2 + 2 2 +... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n. Be sure to use the formal proof that includes the Basis Step

3 State what you are trying to prove! Prove 1 2 + 2 2 +... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n. Positive integer n means 1, 2, 3, …

4 Basis Step Let P(n) be the statement that 1 2 + 2 2 +... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n. (a) Basis Step: plugging in n = 1 we have that P(1) is the statement: (1) 2 = (1)((1) + 1)(2(1) + 1)/6 Expanding both sides we have: 1 = 1 * 2 * 3/6 = 1 Both sides of P(1) shown in part (a) equal 1. Here we are just plugging in the smallest positive integer and showing that both sides are equivalent.

5 Inductive Hypotheses (b) Inductive Hypotheses: The inductive hypothesis is the statement that 1 2 + 2 2 +... + k 2 = k(k + 1)(2k + 1)/6 Here we substitute k for n and restate what we are trying to prove.

6 Inductive step (c) For the inductive step, we want to show for each k ≥ 1 that P(k) implies P(k + 1). In other words, we want to show that by assuming the inductive hypothesis we can prove (1 2 + 2 2 +... + k 2 ) + (k + 1) 2 = (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6 We take the last k term on the left side, (k) 2, add another similar term with the k value replaced by k + 1, and replace all k terms on the right-hand side by k + 1 terms.

7 Substitution Proof (d) Replacing the quantity in brackets on the left-hand side of part(c) by what it equals by virtue of the inductive hypothesis k(k + 1)(2k + 1)/6 + (k + 1) 2 = (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6, we have k(k + 1)(2k + 1)/6 + (k + 1) 2 = (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6 k(k + 1)(2k + 1)/6 +6 (k + 1) 2 /6 = (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6 (k(2k + 1) + 6 (k + 1))/6 = (k + 2)(2k + 3)/6{divide both sides by (k + 1)} (k(2k + 1) + 6 (k + 1)) = (k + 2)(2k + 3){multiply both sides by 6} 2k 2 + k + 6k + 6 = (k + 2)(2k + 3){expand both sides} 2k 2 + 7k + 6 = 2k 2 + 7k + 6 {divide both sides by 2k 2 + 7k + 6 } 1 = 1{both sides equal} we have shown that both sides are equal as we desired. 

8 N Factorial 2. Convert the following recursive function into a recursive algorithm (using the pseudo format specified in appendix A3): f(0) = 1 f(n + 1) = (n + 1) * f(n) procedure factorial(n: nonnegative integer) if n = 0 then return 1 else return n ∙ factorial(n − 1 ) {output is n!}

9 A Recursive Algorithm for Computing  n k=0 a k 3. Bonus: a. Give a recursive algorithm (in the pseudo format specified in appendix A3) for computing:  n k=0 a k = a 0 + a 1 + a 2 + … + a n procedure series (a: list of nonzero real numbers, n: nonnegative integer) if n = 0 then return a 0 else return a n + series (a, n − 1 ) {output is a 0 + a 1 + a 2 + … + a n }

10 Bonus b. Using 3. above, show the value of a k generated at each step given a 0 = 1 and n= 4. (missing information a 1 = 2, a 2 = 3, a 3 = 4, a 4 = 5) Green is the values that missing info would have provided! Red is what you could have provided without missing info! n01234 anan a0a0 a 0 + a 1 a 0 +a 1 + a 2 a 0 + a 1 + a 2 + a 3 a 0 + a 1 + a 2 + a 3 + a 4 1361015


Download ppt "Quiz 7 The way I expected it.. How to do it! 1. Let P(n) be the statement that 1 2 + 2 2 +... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n. Be."

Similar presentations


Ads by Google