*This preview shows
pages
1–4. Sign up
to
view the full content.*

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
**Unformatted text preview: **CS 173 Homework 3 Solutions Spring 2008 CS 173: Discrete Mathematical Structures, Spring 2008 Homework 3 Solutions 1. Prove the following by induction on n . (a) If n ≥ is an integer, then n X j =0 j 2 j = ( n- 1)2 n +1 + 2 . Solution: The proof is by induction on n . Base case: if n = 0 , then ∑ j =0 j 2 j = 0 = (0- 1)2 0+1 + 2 , so the formula holds. Inductive step: let n ≥ 1 . We have that n X j =0 j 2 j = n- 1 X j =0 j 2 j + n 2 n = ( n- 2)2 n + 2 + n 2 n (inductive hypothesis) = (( n- 2) + n ) 2 n + 2 = (2 n- 2)2 n + 2 = 2( n- 1)2 n + 2 = ( n- 1)2 n +1 + 2 , so the theorem holds for n also. (b) If n ≥ is an integer, then n X i =0 i 2 = n ( n + 1)(2 n + 1) 6 . Solution: The proof is by induction on n . Base case: if n = 0 , then ∑ i =0 = 0 = · 1 · 1 6 , so the theorem holds. Inductive step: let n ≥ 1 . We have that n X i =0 i 2 = n- 1 X i =0 i 2 ! + n 2 = ( n- 1)(( n- 1) + 1)(2( n- 1) + 1) 6 + n 2 (inductive hypothesis) = ( n- 1) n (2 n- 1) 6 + n 2 = ( n- 1) n (2 n- 1) + 6 n 2 6 = n (( n- 1)(2 n- 1) + 6 n ) 6 = n ( 2 n 2- 3 n + 1 + 6 n ) 6 = n ( 2 n 2 + 3 n + 1 ) 6 = n ( n + 1)(2 n + 1) 6 , so the theorem holds for n also. 1 CS 173 Homework 3 Solutions Spring 2008 Grading: 10 points total; 5 points per part. In each part, award 1 point for introducing the proof as a proof by induction on n , 1 point for the base case, and 3 points for the inductive step. 2. Let H n = ∑ n j =1 1 /j be the n th harmonic number. Harmonic numbers are common through- out discrete mathematics and computer science, particularly in the analysis of randomized algorithms and approximation algorithms. It is useful to know that H n ≈ ln n ; in fact, ln n ≤ H n ≤ ln n + 1 . In this exercise, we prove bounds on H n when n is a power of two. (a) Compute H 4 (without a calculator). Solution: By definition, H 4 = ∑ 4 j =1 1 /j = 1 + 1 / 2 + 1 / 3 + 1 / 4 = 25 12 . (b) Prove that k/ 2 + 1 ≤ H 2 k ≤ k + 1 for each k ≥ . 2 CS 173 Homework 3 Solutions Spring 2008 Solution: The proof is by induction on k . Base case: if k = 0 , then H 2 = H 1 = 1 . Because / 2 + 1 ≤ 1 ≤ 0 + 1 , the inequalities are satisfied. Inductive step: let k ≥ 1 . The idea here is to split the sum H 2 k up into two sums, apply the inductive hypothesis to one of the sums, and directly bound the terms in the other sum. By definition of H 2 k , we have H 2 k = 2 k X j =1 1 j = 2 k- 1 X j =1 1 j + 2 k X j =2 k- 1 +1 1 j = H 2 k- 1 + 2 k X j =2 k- 1 +1 1 j Consider the sum ∑ 2 k j =2 k- 1 +1 1 j . This sum has 2 k- 1 terms, the largest term in the sum occurs when j is smallest, and the smallest term in the sum occurs when j is largest....

View
Full
Document