Solutions

Transcription

Solutions
Math 3012 H: Applied Combinatorics, Spring 2015
Solutions to Homework 5
Problem 1. Let k be a positive integer. You are to claim a staircase of n stairs,
in each step moving up by 1 or 2, or . . . , or k stairs. Write down a recurrence
equation for the number an of possible ways to climb n stairs in such a way. Then,
write down a generating function of the sequence (an )∞
n=0 . The generating function
should be written in a closed form, not in a form of a power series. Explain your
answers briefly.
Solution. In your first step, you can choose to move up by 1 or 2, or . . . , or min{k, n}
stairs (you cannot move up by more stairs that you are to climb in total). After you
have chosen to move up by i stairs in your first step, you are left with n − i more
stairs, which you can climb in an−i ways. This yields the following recurrence:
a0 = 1,
an = an−1 + an−2 + · · · + a0
an = an−1 + an−2 + · · · + an−k
for 1 6 n 6 k,
for n > k.
After multiplication of each formula by xn , we obtain
a0 x0 = 1,
an xn = an−1 xn + an−2 xn + · · · + a0 xn
n
n
n
an x = an−1 x + an−2 x + · · · + an−k x
for 1 6 n 6 k,
n
for n > k.
Now, summing up the equations above over all n > 0, we obtain
∞
X
an xn = 1 +
n=0
=1+
∞
X
n=1
∞
X
an−1 xn +
an xn+1 +
n=0
∞
X
=1+x
n
∞
X
n=2
∞
X
an−2 xn + · · · +
an xn+2 + · · · +
n=0
∞
X
2
an x + x
n=0
∞
X
n=k
∞
X
an−k xn
an xn+k
n=0
n
an x + · · · + x
n=0
k
∞
X
an xn .
n=0
Using the definition of the generating function
f (x) =
∞
X
an xn ,
n=0
we obtain the following linear equation for f (x):
f (x) = 1 + xf (x) + x2 f (x) + · · · + xk f (x).
It yields the following:
(1 − x − x2 − · · · − xk )f (x) = f (x) − xf (x) − x2 f (x) − · · · − xk f (x) = 1,
1−x
1−x
1
=
=
.
f (x) =
1 − x − x2 − · · · − xk
(1 − x)(1 − x − x2 − · · · − xk )
1 − 2x + xk+1
1
2
Problem 2. Let n be a positive integer. Recall that a sequence (a1 , a2 , . . . , an ) of
length n is a permutation of {1, 2, . . . , n} if each number between 1 and n occurs in
the sequence exactly once. A pair of indices (i, j) is an inversion of a permutation
(a1 , a2 , . . . , an ) of {1, 2, . . . , n} if i < j and ai > aj .
Let a permutation (a1 , a2 , . . . , an ) of {1, 2, . . . , n} be chosen at random with uniform
probability. That is, the probability that a particular permutation (a1 , a2 , . . . , an )
is the outcome of our random experiment is the same for all permutations. What is
the expected number of inversions of (a1 , a2 , . . . , an )? Explain your answer briefly.
Solution. For every pair of indices (i, j) such that i < j, let Ai,j denote the event
that ai > aj , that is, the pair (i, j) is an inversion. We claim that P(Ai,j ) = 21 . This
follows from the fact that the number of permutations (a1 , a2 , . . . , an ) in which (i, j)
is an inversion is equal to the number of those in which (i, j) is not an inversion.
Indeed, swapping the elements ai and aj defines a bijection between those two sets
of permutations.
Let Z denote the random variable that counts the number of inversions in the
random permutation (a1 , a2 , . . . , an ). For every pair of indices (i, j) such that i < j,
let Ii,j denote the indicator random variable of the event Ai,j , that is,
(
1 if (i, j) is an inversion,
Ii,j =
0 if (i, j) is not an inversion.
It follows that
Z=
X
Ii,j
and E(Ii,j ) = P(Ai,j ) = 21 .
16i<j6n
By the linearity of expectation, we conclude that
X
X
E(Z) =
E(Ii,j ) =
16i<j6n
16i<j6n
1 n
1
=
.
2
2 2
Problem 3. Let n and k be positive integers such that 2 6 k 6 n. Prove that
there exists a graph G with n vertices whose total number of cliques of size k and
independent sets of size k is at most
(k)−1
n
1 2
.
2
k
Solution. Consider a random graph on a fixed set of n vertices in which every pair
of vertices becomes an edge independently with probability 12 . For every set S of k
vertices, let AS denote the event that the set S is a clique or an independent set in
the random graph considered. We have
(k) (k)−1
1 2
1 2
P(AS ) = 2
,
=
2
2
because the event AS requires that either all or none of the k2 edges between the
vertices in S are present.
Let Z denote the random variable that counts the total number of cliques of size k
and independent sets of size k in the random graph considered. For every set S of
3
k vertices, let IS denote the indicator random variable of the event AS , that is,
(
1 if S is a clique or an independent set,
IS =
0 otherwise.
It follows that
Z=
X
S
IS
(k)−1
1 2
.
and E(IS ) = P(AS ) =
2
By the linearity of expectation, we have
k
k
X
X 1 (2)−1 n 1 (2)−1
E(Z) =
E(IS ) =
=
.
2
2
k
S
S
It follows that there is an outcome of the random experiment (a graph on n vertices)
whose total number of cliques of size k and independent sets of size k is at most
(k)−1
n
1 2
.
2
k
Problem 4. Let G be a connected graph with non-negative weights assigned to the
edges. Let T1 be a minimum weight spanning tree of G, and let T2 be some spanning
tree of G (not necessarily of minimum weight). Prove that m(T1 ) 6 m(T2 ), where
m(T ) denotes the maximum of the weights of the edges used in T .
Solution. Suppose for the sake of contradiction that m(T1 ) > m(T2 ). This means
that the tree T1 has an edge uv whose weight is greater than the weight of every
edge of T2 . Removing the edge uv disconnects T1 into two subtrees: a subtree
U containing u, and a subtree V containing v. The tree T2 must contain a path
between the vertices u and v. Since u is in U and v is in V , at least one edge of that
path must connect some vertex u0 of U with some vertex v 0 of V . Since u0 v 0 is an
edge of T2 , its weight is less than the weight of uv. Adding the edge u0 v 0 connects
the subtrees U and V back into a spanning tree of G, whose weight is therefore
less than the weight of T1 . This contradicts the assumption that T1 is a minimum
weight spanning tree.