Homework 6, Fri 10-28-11 CS 2050, Intro Discrete Math for

Homework 6, Fri 10-28-11
CS 2050, Intro Discrete Math for Computer Science
Due Mon 11-7-11, Note: This homework has 2 pages and 5 problems.
Problem 1: 20 Points
What is wrong with this ”proof”?
Theorem: For every positive integer n,
n
X
i=1
2
1
i = n+
/2.
2
Basis Case: The formula is true for n = 1.
Inductive Hypothesis: Suppose that for n = k ≥ 1,
2
k
X
1
/2.
i = k+
2
i=1
Inductive Step: We want to show that for n = k+1,
2
k+1
X
1
i = (k+1)+
/2.
2
i=1
But,
k+1
X
i =
i=1
k
X
!
i
+ (k+1) , regrouping so as to bring in the inductive hypothesis
i=1
=
=
=
=
=
=
=
2
1
/2 + (k+1) , using the inductive hypothesis for n = k
k+
2
1
calculations to rewrite the expression
2
k +k+
/2 + (k+1) ,
as the right hand side of the inductive step
4
1
k 2 +k+
/2 + 2(k+1)/2
4
1
2
k + k + + 2k + 2 /2
4
1
2
(k + 2k + 1) + (k + 1) +
/2
4
2 !
1
1
(k + 1)2 + 2(k + 1) +
/2
2
2
2
1
(k+1)+
/2 , which completes the proof of the inductive step
2
Answer: The formula is not true for n = 1, thus the base case does not go
through. In particular:
2
1
X
1
9
i=1
while
1+
/2 =
2
8
i=1
1
Problem 2: 20 Points
(a) Where n is an integer, show that the statement below is false:
2
n X
1
1
i+
= n+
/2 , ∀n ≥ 1 .
2
2
i=0
Hint: It suffices to give a single counter-example.
That is, identify a single positive integer
Pn
1
1 2
n such that i=0 i+ 2 6= n+ 2 /2 . Note: Realize that, where n is an integer, the hint
Pn
1
1 2
is formally equivalent to ∃n ≥ 1 :
/2 .
i=0 i+ 2 6= n+ 2
Answer to part (a): We will show that, for n = 1, the left-hand-side and the right-handside are not equal. For n = 1 the left-hand-side is
1 X
1
1
1
1
1
i+
= 0+
+ 1+
= +1+ = 2 .
2
2
2
2
2
i=0
For n = 1 the right-hand-side is
1
1+
2
2
2
3 1
9
/2 =
= .
2 2
8
We have thus formally shown that
∃n ≥ 1 :
n X
i=0
1
i+
2
2
1
6= n+
/2 .
2
Remark: Realize that part (b) establishes something stronger:
2
n X
1
1
i+
6= n+
/2 , ∀n ≥ 1 .
2
2
i=0
This is because, part (b) establishes that
n X
1
= (n+1)2 /2 , ∀n ≥ 1 .
i+
2
i=0
It is now trivial to check that
2
1
(n+1) /2 6=
n+
/2 , ∀n ≥ 1 ,
2
2
thus
2
n X
1
1
2
i+
= (n+1) /2 6= n+
/2 , ∀n ≥ 1 .
2
2
i=0
2
(b) Where n is an integer, show that the statement below is true:
n X
1
i+
= (n+1)2 /2 , ∀n ≥ 1 .
2
i=0
Hint:
either
proof, or observe that
Pn use an
Pinductive
Pn You1may
n
1
i=0 i) +
i=0 2 and use known closed forms (and simple calculations).
i=0 i+ 2 = (
Answer to part (b):
First Proof, by induction on n:
Base Case: We have to verify that, for n = 1,
1 X
1
i+
= (1+1)2 /2 .
2
i=0
P
This can be trivially verified, since, for n = 1, the left-hand-side is: 1i=0 i+ 12 = 0+ 12 +
1+ 12 = 12 +1+ 12 = 2 , while for n = 1, the right-hand-side is: (1+1)2 /2 = 22 /2 = 4/2 = 2 .
P
Inductive Hypothesis: Assume that, for some n = k ≥ 1, ki=0 i+ 12 = (k+1)2 /2 .
P
1
Inductive Step: We have to show that for n = k+1, k+1
i+
= ((k+1)+1)2 /2 .
i=0
2
k+1 X
i=0
1
i+
2
k X
1
1
=
i+
+ (k+1)+
2
2
i=0
1
(k+1)2
+ (k+1)+
=
2
2
=
(k+1)2 2(k+1) + 1
+
2
2
=
(k+1)2 + 2(k+1) + 1
2
((k+1)+1)2
=
2
.
Second Proof, direct using well known summation formulas:
n X
1
i+
=
2
i=0
n
X
i=0
!
i
+
n
X
1
i=0
!
2
n(n+1) 1
+ (n+1)
2
2
(n+1)
=
(n + 1)
2
= (n + 1)2 /2 .
=
3
Problem 3: 20 Points
Show, by induction,
that for every positive integer n that is a power of 2,
n
if f (n) = f 2 + n, for n > 1, and f (1) = 0, then f (n) = 2n − 2.
Hint: Realize that if n is a positive integer and n is a power of 2, then n = 2N , where N is
an integer and N ≥ 0. Then the above statement is equivalent to:
N
if f (2N ) = f 22 + 2N , for every positive integer N , and if f (20 ) = 0,
then f (2N ) = 2 × 2N − 2, for every integer N such that N ≥ 0.
Answer:
N
N
Given the definition f (2 ) = f 22 + 2N , for every positive integer N ,
and f (20 ) = 0,
we need to show that f (2N ) = 2 × 2N − 2, for every integer N such that N ≥ 0.
The proof is inductive on N .
Base Case: We need to verify that f (2N ) = 2 × 2N − 2, for N = 0,
is equal to f (20 ) = 0 as in the definition.
This is trivial to see, since f (20 ) = 2 × 20 − 2 = 2 − 2 = 0 .
Inductive Hypothesis: Assume that, for some N = k ≥ 0, f (2k ) = 2 × 2k − 2.
Inductive Step: We have to show that for N = k+1, f (2k+1 ) = 2 × 2k+1 − 2.
k+1 2
k+1
f (2 ) = f
+ 2k+1
2
= f 2k + 2k+1
= 2 × 2k − 2 + 2k+1
= 2k+1 − 2 + 2k+1
= 2 × 2k+1 − 2 .
4
Problem 4: 20 Points
Show, by induction,
that for every positive integer n that is a power of 2,
n
if f (n) = f 2 + 1, for n > 1, and f (1) = 0, then f (n) = log2 n.
Hint: Realize that if n is a positive integer and n is a power of 2, then n = 2N , where N is
an integer and N ≥ 0. Then proceed to form an equivalent statement, in terms of N , along
the lines of the hint of Problem 3. (Recall also that log2 n = log2 2N = N .)
Answer:
Realize that if n is a positive integer and n is a power of 2, then n = 2N , where N is an
integer and N ≥ 0. Then
log2 n = log2 2N = N
and the above statement is equivalent
N to:
N
Given the definition f (2 ) = f 22 + 1, for every positive integer N ,
and f (20 ) = 0,
we need to show that f (2N ) = N , for every integer N such that N ≥ 0.
The proof is inductive on N .
Base Case: We need to verify that f (2N ) = N , for N = 0,
is equal to f (20 ) = 0 as in the definition.
This is trivially true.
Inductive Hypothesis: Assume that, for some N = k ≥ 0, f (2k ) = k.
Inductive Step: We have to show that for N = k+1, f (2k+1 ) = k + 1.
k+1 2
k+1
f (2 ) = f
+1
2
= f 2k + 1
= k+1 .
5
Problem 5: 20 Points
Which amounts of money can be formed using just 2 dollar bills and 7 dollar bills? Prove
your answer using induction.
Answer:
The question is equivalen to: which positive integers n can be written as
n=2×p+7×q
for integers p ≥ 0 and q ≥ 0 ?
Towards identifying the range of n we note:
2
3
4
5
6
7
8
9
10
11
12
13
= 2×1
cannot be written
= 2×2
cannot be written
= 2×3
= 2×0+7×1
= 2×4
= 2×1+7×1
= 2×5
= 2×2+7×1
= 2×6
= 2×3+7×1
e.t.c.
We thus see that integers n ≥ 6 appear to fall in the range, moreover, the pattern appears
to be that each integer x is expressed using the integer x−2:
6
7
8
9
10
11
12
13
=
=
=
=
=
=
=
=
2×3
2×0+7×1
2×4
2×1+7×1
2×5
2×2+7×1
2×6
2×3+7×1
e.t.c.
=
=
=
=
=
=
2+6
2+7
2+8
2+9
2 + 10
2 + 11
We will thus establish, in the next page, that the range is n ≥ 6, using strong induction.
6
Theorem: For every integer n ≥ 6, there exist integers p ≥ 0 and q ≥ 0 such that
n=2×p+7×q
.
Proof: Strong induction on n.
Base Case: For n = 6 and n = 7 we verify that 6 = 2 × 3 + 7 × 0 and 7 = 2 × 0 + 7 × 1.
Inductive Hypothesis: Let n = k ≥ 7, and assume that,
for every integer k 0 in the range 6 ≤ k 0 ≤ k,
there exist integers p0 ≥ 0 and q 0 ≥ 0 such that
k 0 = 2 × p0 + 7 × q 0
.
Inductive Step: For n = k + 1, we need to show that
there exist integers p ≥ 0 and q ≥ 0 such that
k+1=2×p+7×q
.
We proceed to establish the inductive step as follows:
k+1 =
=
=
=
=
=
=
k + (−1 + 1) + 1
(k − 1) + (1 + 1)
(k − 1) + 2
k0 + 2
2 × p0 + 7 × q 0 + 2
2 × (p0 + 1) + 7 × q 0
2 × p + 7 × q for p = p0 + 1 and q = q 0 .
7