Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quiz 6 The way I expected it..

Similar presentations


Presentation on theme: "Quiz 6 The way I expected it.."— Presentation transcript:

1 Quiz 6 The way I expected it.

2 How to do it! 1. Use mathematical induction to prove that (2n + 1)2 = (n + 1)(2n + 1)(2n + 3)/3 whenever n is a nonnegative integer. Be sure to use the formula provided in class.

3 State what you are trying to prove!
Prove (2n + 1)2 = (n + 1)(2n + 1)(2n + 3)/3 whenever n is a nonnegative integer using mathematical induction. Nonnegative means 0, 1, 2, …

4 Basis Step Prove (2n + 1)2 = (n + 1)(2n + 1)(2n + 3)/3 whenever n is a nonnegative integer using mathematical induction. (a) Basis Step: plugging in n = 0 we have that P(0) is the statement: (2 * 0 + 1)2 = (0 + 1)(2 * 0 + 1)(2 * 0 + 3)/3. Expanding both sides we have: 1 = 1 * 1 * 3/3 = 1 Both sides of P(0) shown in part (a) equal 1. Here we are just plugging in the smallest nonnegative integer and showing that both sides are equivalent.

5 Inductive Hypotheses (b) Inductive Hypotheses: The inductive hypothesis is the statement that (2k + 1)2 = (k + 1)(2k + 1)(2k + 3)/3. 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 (2k + 1)2 + (2(k + 1) + 1)2 = ((k + 1) + 1)(2(k + 1) + 1)(2(k + 1) + 3)/3 We take the last k term on the left side , (2k + 1)2, add another similar term with the k value replaced by k + 1, and replay 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 ( (2k + 1)2 = (k + 1)(2k + 1)(2k + 3)/3), we have (k + 1)(2k + 1)(2k + 3)/3 + (2(k + 1) + 1)2 = ((k + 1) + 1)(2(k + 1) + 1)(2(k + 1) + 3)/3 ((k + 1)(2k + 1)(2k + 3) + 3(2(k + 1) + 1)2)/3 = ((k + 2)(2k )(2k )/3 (k + 1)(2k + 1)(2k + 3) + 3(2k )2 = ((k + 2)(2k + 3)(2k + 5) {divide both sides by 3} (k + 1)(2k + 1)(2k + 3) + 3(2k + 3)2 = ((k + 2)(2k + 3)(2k + 5) (k + 1)(2k + 1) + 3(2k + 3) = ((k + 2)(2k + 5) {divide both sides by (2k + 3)} 2k2 + 3k k + 9 = 2k2 + 9k + 10 2k2 + 9k = 2k2 + 9k + 10 we have shown that both sides are equal as we desired. 

8 N Factorial 2. Give a recursive algorithm
(in the pseudo format specified in appendix A3) for computing:  a. n! (n factorial). 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 an
2. Give a recursive algorithm (in the pseudo format specified in appendix A3) for computing:  b. an (a to the nth power). procedure power(a: nonzero real number, n: nonnegative integer) if n = 0 then return 1 else return a ∙ power (a, n − 1) {output is an}

10 Bonus 3. Bonus question: Using 2.b. above, show the value of an generated at each step given a=5 and n= 4 (starting with n = 0). hint1: procedure power(a, n) hint2: {54} N 1 2 3 4 an 5 25 125 625


Download ppt "Quiz 6 The way I expected it.."

Similar presentations


Ads by Google