CS103X: Discrete Structures Homework Assignment 5: Due February 29, 2008
CS103X: Discrete Structures Homework Assignment 5: Due February 29, 2008
Homework Assignment 5
Due February 29, 2008
Solution Let ai be the total number of drinks consumed up to and including the ith day, for i =
1, . . . , 365. Combine these with the numbers a1 + 100, . . . , a365 + 100, providing 730 numbers, all positive
and less than or equal to 500 + 100 = 600. Hence two of these 730 numbers are identical. Since all ai’s
and, hence, (ai + 100)’s are distinct, then aj = ai + 100, for some i < j. Thus, on days i + 1 to j, the
person consumes exactly 100 drinks.
Exercise 3 (10 points). A betting game is played by filling out a number of betting cards. Each time you
fill out a card, you pick 4 natural numbers ranging from 1 to 16. After filling out some number of cards,
you hand them in and the house picks 4 of the numbers to be ”losers” at random. A card is a winner if
it has none of those ”loser” numbers. Prove that if you fill out 6 cards, it is always possible that none of
them will win.
1
Solution To do this, find a four-member set that has at least one element in common with the six sets
representing the cards. If any one number appears on three cards this is trivial, pick that one, and one from
each other set. If this is not the case, there must be 8 numbers appearing in two sets and 8 appearing in one.
Pick a number appearing in two sets, then the union of those two sets is at most 7 distinct numbers. Thus
another number can picked that is in two different sets, and then pick one from each of the 2 remaining
sets.
Exercise 4 (10 points). Prove that if every point on a line is painted cardinal or white, there exists three
points of the same color such that one is the midpoint of the line segment formed by the other two.
Solution Pick two points A, B of the same color. Let C be the midpoint of AB, and position D, E such
that C is also the midpoint of DE and DA = AB = BE. If C, D, E are the same color then we’re done;
if not, then at least one of them is the same color as A, B and forms a trio with A, B.
Exercise 5 (10 points). Prove that at a cocktail party with ten or more people, there are either three
mutual acquaintances or four mutual strangers.
Solution Consider a person A and the 9 other people in the room. First case, suppose A has at least
4 acquaintances then if any of those acquaintances know each other, we have 3 mutual friends. If none of
those acquaintances know each other, we have at least four mutual strangers, namely A’s acquaintances.
Consider the other case where A has more than 5 strangers (less than 4 acquaintances). Then, consider
a person B in the set of A’s strangers. B has at least 3 acquaintances or 3 strangers. Suppose B has
at least 3 acquaintances, then none of these acquaintances know each other, otherwise we have 3 mutual
acquaintances. But since A does not know any of these people, B’s 3 acquaintances and A form a group of
4 mutual strangers. On the other hand, if B has at least 3 strangers, then if these strangers all know each
other, we would have 3 mutual acquaitances. Thus, suppose there are at least 2 people of B’s strangers
that do not know each other. But then we would have these 2 people who don’t know each other, B, and
A as a group of mutual strangers. In all cases, we get either three mutual acquaintances or four mutual
strangers, as desired.
Exercise 6 (20 points). Order the following functions by asymptotic growth rates. That is, list them
as f1 (n), f2 (n), . . . , f10 (n), such that fi (n) = O(fi+1 (n)) for all i. Give a brief argument to support the
inequality fi (n) = O(fi+1 (n)) for every i. (You don’t have to give all the details.)
n2 , log10 n, n log2 n, nln n , (ln n)n , ln(nn ), (ln n)ln n , (ln n)ln ln n , (ln ln n)ln n , 3n/2 .
Hint: Take logarithms to bring the exponents down. Use basic properties of logarithms.
Solution
log10 n, (ln n)ln ln n , ln(nn ), n log2 n, n2 , (ln ln n)ln n , (ln n)ln n , nln n , 3n/2 , (ln n)n .
k
For an example, we will show (ln n)ln ln n = O(ln(nn )). Let n = ee , then we need to show:
k ek k k
(ln ee )ln ln e = O(ee ln(ee ))
k
(ek )k = O(ee ek )
k +k
e2k = O(ee )
Which is obviously true since e2k ≤ e ek +k ∀k ≥ 0.
2
First take logs on both sides
2 ln n ≤ ln c + ln n ln ln n
2
Let us choose n0 = ee , then ln ln n0 = 2. Then the above inequality holds for all n ≥ n0
Exercise 7 (10 points). What’s wrong with the following induction proof?
Define f (n) = n2 . We prove by induction that f (n) = O(n). When n = 1, 12 = 1 and the
claim holds. Assume that k 2 = O(k) for some k ≥ 1. Then (k + 1)2 = k 2 + 2k + 1. Each of the
summands on the right side is O(k), and thus (k + 1)2 = O(k). This completes the proof by
induction.
We are inducting over n, so we are basically setting n0 = 1 (then if we can show that f (n) ≤ cn for all
n > 1, then we are done). The problem is in the induction step. Let us assume that k 2 ≤ cn for some c,
k > 1. Now consider for some p ≥ 1, (k + p)2 = k 2 + 2kp + 1 ≤ ck + 2kp + 1. However, if we can find some
p = p0 large enough such that 2kp + 1 ≥ k, then (k + p0 )2 = k 2 + 2kp + 1 ≤ ck + k = (c + 1)k, which is
larger than ck. Thus, in order for (k + p0 ) to be O(k), we need to choose a new c, namely c + 1. Since we
can find a p0 for any k, we need to continually choose a new c as k increases. Thus, there does not exist a
fixed c for all n ≥ n0 .
Exercise 8 (10 points). Consider a relation ∝ on the set of functions from N+ to R, such that f ∝ g if
and only if f = O(g). Is ∝ an equivalence relation? A partial order? A total order? Prove.
Solution ∝ is not an equivalence relation because it does not satisfy the symmetric property. Consider
f (n) = n and g(n) = n2 . Then f ∝ g, but g ∝ f does not hold.
∝ is not a partial order because it does not satisfy the antisymmetric property. Suppose f (n) = n + 1 and
g(n) = n + 2, then f ∝ g and g ∝ f but f 6= g. Since ∝ is not a partial order, it cannot be a total order.