Download Solutions for Assignment 4

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Assignment 4, due Wednesday November 9, 2005
n+2
, so that n < 2m ≤ n + 2.
2
Show that if S is a subset of the set {1, 2, . . . , n} which contains more than m of the elements of {1, 2, . . . , n},
then some three of the integers in S have the property that one of the three is the sum of the other two.
Problem 1. Let n be a positive integer greater than 3 and let m =
Solution: Let S = {x1 , x2 , . . . , xk } be any subset of X = {1, 2, . . . , n}, where k ≥ m + 1, and where we
assume that
x1 < x 2 < · · · < x k .
Now consider the k − 1 differences
x2 − x 1 , x 3 − x 1 , . . . , x k − x 1 ,
each of which is in the set X = {1, 2, . . . , n}.
The set X−(S−{x1 }), that is, the set of integers in X = {1, 2, . . . , n} which are not in S−{x1 } = {x2 , . . . , xk },
has only
|X − (S − {x1 })| = n − (k − 1) = n − k + 1
integers in it, and since k − 1 ≥ m, then 2k − 2 ≥ 2m > n, so that k − 2 > n − k, that is, k − 1 > n − k + 1,
and by the pigeonhole principle, one of the differences
x2 − x 1 , x 3 − x 1 , . . . , x k − x 1 ,
is in the set S − {x1 }.
Therefore, there exist i 6= j, with i 6= 1, such that
xi = x j − x 1 ,
so that xj = x1 + xi .
Alternate Solution: Let S be any subset of {1, 2, . . . , n}, where |S| ≥ m + 1, and let
M = max S.
We will show that there exist distinct integers i and j in S such that
i + j = M.
For each k ∈ S − {M }, define
ak =





k



M − k
if k ≤
M
2
if k >
M
.
2
Note that the number of integers in S − {M } is
|S − {M }| = |S| − 1 ≥ m.
Now, for each k ∈ S − {M }, we note that
ak ≤
if k ≤
n
M
≤ <m
2
2
M
, while
2
ak = M − k < M −
if k >
M
, that is,
2
ak ≤
M
M
n
=
≤ <m
2
2
2
n
<m
2
for all k ∈ S − {M }.
Therefore, since |S −{M }| ≥ m, there must be two elements ai and aj , with i 6= j, such that ai = aj . Clearly,
from the definition of ak , we can assume that
i≤
M
2
and
j>
M
,
2
so that
i = ai = aj = M − j,
that is, i + j = M.
Problem 2. You have at your disposal a three pan balance, and a collection of n coins, one of which is a
counterfeit and slightly heavier than all the rest. The genuine coins all weigh the same. If you are allowed
to make k weighings (k = 1, 2, 3, . . . ), what is the maximum n for which you can find the counterfeit?
Solution: We will show that if you are allowed k weighings, you can find the counterfeit among 4 k coins
but you may not be able to find it if there are more than 4k coins. The proof is by induction on k.
Base Case: k = 1. If you have 4 coins, put one on each pan and leave 1 aside. This reveals the counterfeit.
If you have 5 or more coins, then you can only divide the coins into 4 groups (3 groups for the pans and 1
group left aside). One of the groups must contain 2 or more coins. One weighing can identify which group
contains the counterfeit, but if the counterfeit is in the group with 2 or more coins, it cannot be determined
which one it is.
Inductive Step: Let k ≥ 1 and suppose the result is true for k weighings, we will show this implies that it is
true for k + 1 weighings, that is, the maximum n for which we can find the counterfeit is n = 4 k+1 .
Given n = 4k+1 coins, we divide them into 4 groups each containing 4k . Put one group in each of the pans,
and leave one group aside. This weighing will identify the group that contains the counterfeit, and by the
induction hypothesis we can find the counterfeit in k more weighings. Thus, we can find the counterfeit with
a total of k + 1 weighings.
If we have more than 4k+1 coins, then when we divide them into 4 groups, one of the groups will contain
more than 4k coins. If the counterfeit is in that group, then by the induction hypothesis you may not be
able to find it with k more weighings. So if we have more than 4k+1 coins, we may not be able to find the
counterfeit in k + 1 weighings.
By the principle of mathematical induction, if we are allowed k weighings, the maximum number of coins
for which we can find the counterfeit is 4k coins.
Problem 3. You have a jar containing 200 pennies. You and your friend will play a game which goes like
this:
One of you will take anywhere from 1 to 15 pennies from the jar. Then the other will take anywhere from
1 to 15 pennies from the jar. You continue alternating like this. The person who takes the last penny from
the jar is the winner. Presuming you want to win, how many pennies should you remove if you have the
first turn?
Solution: If your opponent has to play, and there are 16 pennies left in the jar, then you will win. Thus,
the objective is to leave 16 pennies in the jar.
If your opponent has to play, and there are 32 pennies left in the jar, then after she takes her turn, you will
be able to leave 16 pennies.
If your opponent has to play, and there are 48 pennies left in the jar, then after she takes her turn, you will
be able to leave 32 pennies.
In general, if you leave your opponent with 16k pennies, on the next move you can leave her with 16(k − 1)
pennies.
So, on your first move, you should leave your opponent with the largest multiple of 16 that is less than 200,
namely, 192, thus you should take 8 pennies on your first move.
Problem 4. You have an unlimited supply of 5 and 8 cent stamps. What is the smallest positive integer
N such that for each integer n ≥ N, you can use a combination of 5 and 8 cent stamps to obtain n cents in
postage.
Solution: Clearly, the denominations
6, 7, 9, 11, 12, 14, 17, 19, 22, 22, 27
cannot be obtained, and it appears that any denomination greater than or equal to N = 28 can be obtained.
We prove this by induction.
Base Case: For n = 28, we have 28 = 4 · 5 + 1 · 8.
Inductive Step: Suppose that n ≥ 28 and
n = 8a + 5b
for some nonnegative integers a and b.
I If a = 1, then since n ≥ 28, we must have 5b ≥ 20, so that b ≥ 4. In this case we may replace 3 of the 5
cent stamps with 2 of the 8 cent stamps to get
n + 1 = 8(a + 2) + 5(b − 3).
I If a = 2, then since n ≥ 28, we must have 5b ≥ 12, and since b is an integer, then b ≥ 3. Again, in this
case, we may replace 3 of the 5 cent stamps with 2 of the 8 cents stamps to get
n + 1 = 8(a + 2) + 5(b − 3).
I If a ≥ 3, then we may replace 3 of the 8 cent stamps with 5 of the 5 cent stamps to get
n + 1 = 8(a − 3) + 5(b + 5).
Thus in all cases, we may write n + 1 = 8a0 + 5b0 for some nonnegative integers a0 and b0 .
Therefore, by the principle of mathematical induction, for any integer n ≥ N = 28, we can use a combination
of 5 cent and 8 cent stamps to obtain n cents in postage.
Alternate Solution: We can make postage for 28, 29, 30, 31, and 32 as follows:
28 = 4 · 5 + 8
29 = 5 + 3 · 8
30 = 6 · 5
31 = 3 · 5 + 2 · 8
32 = 4 · 8.
We now note that this implies that we can do it for all n ≥ 33 as well:
Suppose we can do it for 28, 29, 30, 31, 32, . . . , n − 1, then given n, we consider the integer k = n − 5. Here
k is one of the integers for which we can do it, and by adding a five cent stamp, we can do it for k + 5, that
is, for n.
Problem 5. Find a closed form expression for the sequence
an = 1 + 2a + 3a2 + 4a3 + · · · + nan−1 , n ≥ 1,
where a is a fixed real number.
Solution: If we multiply an by a and subtract the result from an , we have
(1 − a)an = 1 + a + a2 + a3 + · · · + an−1 − nan
for all n ≥ 1. We showed in class that for n ≥ 1,
1 + a + a2 + a3 + · · · + an−1
and therefore

n
1 − a
1−a
=
 n
an = 1 + 2a + 3a2 + 4a3 + · · · + nan−1 =
for all n ≥ 1.
if a 6= 1
if a = 1,
 1 − an
nan

−


 (1 − a)2
1−a



 n(n + 1)
2
if a 6= 1
if a = 1
Problem 6. For n ≥ 1, let an be the number of ways that a group of n children can line up (in single file)
at a movie theatre so that there are no boys standing together?
(a) Find a recurrence relation and initial conditions satisfied by an .
(b) Solve the recurrence relation found in part (a).
Solution: Note first that an is the number of strings of length n of 0’s (boys) and 1’s (girls) that do not
contain consecutive 0’s.
(a) Given any string of 0’s and 1’s of length n that does not contain any consecutive 0’s, it either starts
with a 1 or it starts with a 0.
The number of such strings that start with a 1 is an−1 :
1x
· · · x},
| x {z
n−1
while the number of such strings that start with a 0 is an−2 :
01 x
· · · x},
| x {z
n−2
and since this exhausts all possibilities, we must have an = an−1 + an−2 for all n ≥ 3.
Clearly,
a1 = 2 :
a2 = 3 :
1, or 0
1 1, 1 0, or 0 1,
and an satisfies the recurrence relation and initial conditions
an = an−1 + an−2 ,
n≥3
a1 = 2
a2 = 3.
(b) The solution to the recurrence relation satisfying the initial conditions given above is
an = Fn+2 ,
the n + 2nd Fibonacci number, since it generates the numbers in the Fibonacci sequence, but starting
at F3 = 2 instead of F0 = 0.
Problem 7. For n ≥ 0, let an be the number of regions on the surface of a sphere formed by n great circles,
no three of which are concurrent.
(a) What are a0 , a1 , a2 , and a3 ?
(b) Find a recurrence relation and initial condition satisfied by an .
(c) Solve the recurrence relation you found in part (b).
Solution:
(a) From the figure below it is obvious that a0 = 1, a1 = 2, a2 = 4 and a3 = 8.
(b) It looks at first like an = 2n for all n ≥ 0, but this is not the case.
Suppose that n circles have been drawn on the surface of the sphere so that no three are concurrent,
and suppose that an (n + 1)st circle is added so that no three of the n + 1 circles are concurrent.
The new circle meets each of the old circles in two points, making 2n points of intersection on the new
circle, and these 2n points are all different since no three of the circles are concurrent.
The 2n points divide the new circle into 2n arcs. Each of these arcs divides one of the existing regions
into two parts, so there are
an + 2n
regions formed by the n + 1 great circles. Therefore, an satisfies the recurrence relation and initial
value
an+1 = an + 2n,
n≥1
a1 = 2.
(c) For each integer k with 1 ≤ k ≤ n − 1, we have
ak+1 = ak + 2k,
so that
an − a 1 =
n−1
X
(ak+1 − ak ) =
k=1
n−1
X
2k = n(n − 1),
k=1
and therefore
an = n(n − 1) + 2
for all n ≥ 1.
Problem 8. Let a and b be fixed positive numbers, given the recurrence relation and initial conditions
1 + an+1
,
an
a0 = a
a1 = b.
an+2 =
n≥0
(a) Find a2 , a3 , a4 , a5 , a6 .
(b) Find the exact solution to this problem.
Solution:
(a) We have
a2 =
a3 =
a4 =
a5 =
a6 =
1 + a1
a0
1 + a2
a1
1 + a3
a2
1 + a4
a3
1 + a5
a4
1+b
a
1+a+b
=
ab
ab + 1 + a + b a
(1 + a)(1 + b) a
1+a
=
=
=
ab
1+b
ab
1+b
b
1+a+b
ab
=
=a
b
1+a+b
b
= (1 + a)
=b
1+a
=
and now the sequence repeats itself.
(b) The exact solution to this recurrence relation is


a





b




 1+b



a
an =

1
+
a
+b





ab




1+a




b
for all n ≥ 0.
for n ≡ 0 (mod 5)
for n ≡ 1 (mod 5)
for n ≡ 2 (mod 5)
for n ≡ 3 (mod 5)
for n ≡ 4 (mod 5)