ps9 Sol
ps9 Sol
(a) [5 pts] Show that of any n + 1 distinct numbers chosen from the set {1, 2, . . . , 2n}, at
least 2 must be relatively prime. (Hint: gcd(k, k + 1) = 1.)
Solution. Treat the n + 1 numbers as the pigeons and the n disjoint subsets of the form
{2j − 1, 2j} as the pigeonholes. The pigeonhole principle implies that there must exist a
pair of consecutive integers among the n + 1 chosen which, as suggested in the hint, must
be relatively prime.
(b) [5 pts] Show that any finite connected undirected graph with n ≥ 2 vertices must have
2 vertices with the same degree.
Solution. In a finite connected graph with n ≥ 2 vertices, the domain for the vertex
degrees is the set {1, 2, . . . , n − 1} since each vertex can be adjacent to at most all of the
remaining n−1 vertices and the existence of a degree 0 vertex would violate the assumption
that the graph be connected. Therefore, treating the n vertices as the pigeons and the n−1
possible degrees as the pigeonholes, the pigeonhole principle implies that there must exist
a pair of vertices with the same degree.
Each of the forbidden words contain the digit 6 and since he must choose each number
exactly once, the only way two forbidden words can appear in the same password is if they
overlap at 6. The only case where this can happen is if the password contains 35876042
and there are 3 · 2! such passwords.
By inclusion-exclusion the total number of passwords not containing any of the forbidden
words is
10! − (6 · 5! + 7 · 6! + 6 · 5!) + 3 · 2! = 3622326
Problem 3. [50 points] Be sure to show your work to receive full credit. In this problem
we assume a standard card deck of 52 cards.
(a) [4 pts] How many 5-card hands have a single pair and no 3-of-a-kind or 4-of-a-kind?
(value of pair, suits of pair, value of other three cards, suits of other three cards)
4
13 · 2
· 12 · 4 · 11 · 4 · 10 · 4
= 1, 098, 240
3!
(b) [4 pts] For fixed positive integers n and k, how many nonnegative integer solutions
x0 , x1 , . . . , xk are there to the following equation?
k
X
xi = n
i=0
Problem Set 9 3
Solution. There is a bijection from the solutions of the equation to the binary strings
containing n zeros and k ones where x0 is the number of 0s preceding the first 1, xk is the
number of 0s following the last 1 and xi is the number of 0s between the ith and (i + 1)th
1 for 0 < i < k.
n+k
k
(c) [4 pts] For fixed positive integers n and k, how many nonnegative integer solutions
x0 , x1 , . . . , xk are there to the following equation?
k
X
xi ≤ n
i=0
(d) [4 pts] How many simple undirected graphs are there with n vertices?
Solution. There are n2 potential edges, each of which may or may not appear in a given
(e) [4 pts] How many directed graphs are there with n vertices (self loops allowed)?
Solution. There are n2 potential edges, each of which may or may not appear in a given
graph. Therefore, the number of graphs is:
2
2n
4 Problem Set 9
distinct vertices a and b, either a → b or b → a but not both. Therefore, the number of
tournament graphs is:
n
2( 2 )
(g) [4 pts] How many acyclic tournament graphs are there with n vertices?
Solution. For any path from x to y in a tournament graph, an edge y → x would create
a cycle. Therefore in any acyclic tournament graph, the existence of a path between
distinct vertices x and y would require the edge x → y also be in the graph. That is, the
”beats” relation for such a graph would be transitive. Since each pair of distinct players are
comparable (either x → y or y → x) we can uniquely rank the players x1 < x2 < · · · < xn .
There are n! such rankings.
(h) [4 pts] How many numbers are there that are in the range [1..700] which are divisible
by 2, 5 or 7?
Solution. Let S be the set of all numbers in range [1..700]. Let S2 be the numbers in this
range divisible by 2, S5 be the numbers in this range divisible by 5 and S7 be the numbers
in this range divisible by 7. By inclusion-exclusion, the number of elements in S divisible
by 2, 5 or 7 is
n = |S2 | + |S5 | + |S7 | − |S2 S5 | − |S2 S7 | − |S5 S7 | + |S2 S5 S7 |
700 700 700 700 700 700 700
= + + − − − +
2 5 7 2·5 2·7 5·7 2·5·7
= 350 + 140 + 100 − 70 − 50 − 20 + 10
= 460.
(i) [9 pts] In how many ways can you arrange n books on k bookshelf (assuming the order
of books on a shelf matters?)
Solution.
n+k−1
n! ·
k−1
(j) [9 pts] How about if there has to be at least 1 book at each bookshelf?
Solution.
n n−1
k! · · (n − k)! ·
k k−1
Problem Set 9 5
(Hint: Consider the set of all length-n sequences of 0’s, 1’s and a single *.)
Solution. Let P = {0, . . . , n − 1} × {0, 1}n−1 . On the one hand, there is a bijection from
P to S by mapping (k, x) to the word obtained by inserting a * just after the kth bit in
the length-n − 1 binary word, x. So
|S| = |P | = n2n−1 (1)
by the Product Rule.
On the other hand, every sequence in S contains between 1 and n nonzero entries since the
∗, at least, is nonzero. The mapping from a sequence in S with exactly k nonzero entries
to a pair consisting of the set of positions of the nonzero entries and the position of the *
among these entries is a bijection, and the number of such pairs is nk k by the Generalized
Product Rule. Thus, by the Sum Rule:
n
X n
|S| = k
k=1
k
Equating this expression and the expression (1) for |S| proves the theorem.
Problem 5. [15 points] At a congressional hearing, there are 2n members present. Exactly
n of them are Democrats and n of them are Republicans. The members want to select a
smaller subcommittee of size n from within those present at the hearing. However, since the
Democrats currently hold majority, they want there to be more Democrats then Republicans
in the committee. In how many ways can you select such a committee? (Hint: Consider two
cases: n odd and n even.)
Solution. First, look at the case when n is odd. There are are
2n
n
ways to choose any subcommittee of size n. n is odd, so the number of Democrats is
always different than the number of Republicans in a committee. Each of these committees
will therefore either have more Democrats or more Republicans. However, there is an
equal number of Democrats and Republicans present at the hearing, so the number of
committees with more Republicans in them should by symmetry equal to the number of
committees with more Democrats in them. Consequently, the number of committees with
more Democrats than Republicans is
1 2n
.
2 n
6 Problem Set 9
If, however, n is even, then nn nn committees will have an equal number of Democrats
2 2
and Republicans (select n2 out of n Democrats and n2 out ofn Republicans). The number of
committees where one party has a majority is therefore 2n n
n
n
− n n . Again by symmetry,
2 2
there must be
1 2n n n
− n n
2 n 2 2
committees with more Democrats than Republicans.