Solutions Assignment 7 - Discrete Structures | CS 173, Assignments of Discrete Structures and Graph Theory

Material Type: Assignment; Class: Discrete Structures; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2007;

Typology: Assignments

Pre 2010

Uploaded on 03/11/2009

koofers-user-uz3-1
koofers-user-uz3-1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS173 Discrete Mathematical Structures
Spring 2007
Homework #7
Due Sun 03/04/07, 8AM.
Solutions, Grading rubric (41 points)
1) (10 Points, For each problem: 1 point for base case, 1 point for the induction hypothesis, 3
points for the step. )
Let f
i
be the i-th Fibonacci number. Prove that:
1. f
21
+f
22
+... +f
2n
=f
n
f
n+1
.
2. f
0
f
1
+f
1
f
2
+f
2
f
3
+...+f
2n-1
f
2n
=f
22n
. (Hint: note that 2n is always even!)
Solutions:
1.1)
Base case: n=1.
f
21
= f
1
f
2
1
2
= 1*1
IH: for all k<=n, f
21
+f
22
+... +f
2n
=f
n
f
n+1
holds.
Step: nn+1
f
21
+f
22
+... +f
2n
+f
2n+1
=[IH]= f
n
f
n+1
+f
2n+1
= f
n+1
(f
n
+f
n+1
)= f
n+1
f
n+2
1.2)
Base case
n=0.
f
0
f
1
=f
20
1=1
n=1 (not really needed)
f
0
f
1
+f
1
f
2
=f
22
0*1+1*1=1*1
IH: for all k<=n, f
0
f
1
+f
1
f
2
+f
2
f
3
+...+f
2n-1
f
2n
=f
22n
holds.
Step: nn+1
(f
0
f
1
+f
1
f
2
+f
2
f
3
+...+f
2n-1
f
2n
)+f
2n
f
2n+1
+f
2n+1
f
2n+1
=[IH]= f
22n
+f
2n
f
2n+1
+f
2n+1
f
2n+2
= f
2n
(f
2n
+f
2n+1
)+f
2n+1
f
2n+2
=
f
2n
f
2n+2
+f
2n+1
f
2n+2
= f
2n+2
(f
2n
+f
2n+1
) = f
22n+2
2) (5 points. 1 point for base case, 1 point for the induction hypothesis, 3 points for the step.)
Use strong induction to prove that any non-prime positive integer number n can be written as a
product of primes.
Solution:
Base case: 4=2*2.
IH: Assume that any non-prime number x<n can be written as a product of primes.
We need to prove that if the IH holds and n is non-prime, n can be written as a product of primes.
Since n is non-prime, it can be written as a product of two numbers n=a*b, where a,b1,n.
Therefore, a,b<n. Since both a and b can be written as a product of primes (by IH), n can be written
too by just multiplying the prime factorizations of a and b.
pf3

Partial preview of the text

Download Solutions Assignment 7 - Discrete Structures | CS 173 and more Assignments Discrete Structures and Graph Theory in PDF only on Docsity!

CS173 Discrete Mathematical Structures

Spring 2007

Homework

Due Sun 03/04/07, 8AM.

Solutions, Grading rubric (41 points)

  1. (10 Points, For each problem: 1 point for base case, 1 point for the induction hypothesis, 3 points for the step. ) Let fi be the i-th Fibonacci number. Prove that:
  1. f^21 +f^22 +... +f^2 n =fn fn+1.
  2. f 0 f 1 +f 1 f 2 +f 2 f 3 +...+f2n-1f2n=f^2 2n. (Hint: note that 2n is always even!)

Solutions: 1.1) Base case: n=1. f^21 = f 1 f 2 12 = 1* IH: for all k<=n, f^21 +f^22 +... +f^2 n =fn fn+1 holds. Step: nn+ f^21 +f^22 +... +f^2 n +f^2 n+1 =[IH]= fn fn+1 +f^2 n+1= fn+1 (fn +fn+1)= fn+1 fn+

1.2) Base case n=0. f 0 f 1 =f^20 1= n=1 (not really needed) f 0 f 1 +f 1 f 2 =f^22 01+11=1* IH: for all k<=n, f 0 f 1 +f 1 f 2 +f 2 f 3 +...+f2n-1f2n=f^2 2n holds. Step: nn+ (f 0 f 1 +f 1 f 2 +f 2 f 3 +...+f2n-1f2n)+f2nf2n+1+f2n+1f2n+1 =[IH]= f^2 2n+f2nf2n+1+f2n+1f2n+2= f2n(f2n+f2n+1)+f2n+1f2n+2= f2nf2n+2+f2n+1f2n+2= f2n+2 (f2n+f2n+1) = f^2 2n+

  1. (5 points. 1 point for base case, 1 point for the induction hypothesis, 3 points for the step.) Use strong induction to prove that any non-prime positive integer number n can be written as a product of primes.

Solution: Base case: 4=22. IH: Assume that any non-prime number x<n can be written as a product of primes. We need to prove that if the IH holds and n is non-prime, n can be written as a product of primes. Since n is non-prime, it can be written as a product of two numbers n=ab, where a,b≠1,n. Therefore, a,b<n. Since both a and b can be written as a product of primes (by IH), n can be written too by just multiplying the prime factorizations of a and b.

  1. (6 points. For each part- 1 points for the base, 2 points for the step) Give a recursive definition for:
  1. The set of positive integers not divisible by 5.
  2. S={(a,b) | a,b positive integers and (a+b) is even} (Hint- plot the points on the plane and look for patterns)

Solution: 3.1) {1,2,3,4}∈S For any i∈S, i+5∈S. 3.2) (1,1) ∈S For any (a,b)∈S, (a+2,b) and (a,b+2) and (a+1,b+1) ∈S.

  1. (20 Points.)A complete binary tree is defined as follows: a) A single vertex v is a complete binary tree of height 0. b) If v is a vertex and T1 and T2 are complete binary trees of height n, then

is a complete binary tree of height n+1. Prove the following:

  1. Each complete binary tree with n nodes has n-1 edges.
  2. Each complete binary tree with height n has 2n+1^ -1 nodes (For your intuition- the height is the maximum number of edges from any leaf node to the root node of the tree, and the leaf is the most “bottom” node).
  3. Each complete binary tree with height n has 2n^ leaves.
  4. Each complete binary tree with height n has 2n^ -1 non-leaves (internal nodes).

Solution: 4.1) Base case: for n=1, we have n=1 node, and n-1=0 edges. IH: Each tree of with k<n nodes has k-1 edges. Step: prove for k=n