Solutions For Homework 1 Problems: TH TH
Solutions For Homework 1 Problems: TH TH
row. Each candidate gets n votes so both the rows are completely filled. Increasing
order in a row is guaranteed by the way the numbers are filled. At any prefix of
the sequence the number of votes for the first candidate has at least as many votes
as the second so the increasing order in the columns are also guaranteed.
The other direction of the mapping and its correctness follows using the similar
arguments.
Problem 5. A Full binary tree is one where every node has either 2 or 0 children.
Set up a bijection between binary trees with n nodes and full binary trees with
2n + 1 nodes.
Let the set of all Full Binary Trees with 2n + 1 nodes be denoted by F BT2n+1
and the set of all Binary Trees with n nodes by BTn . Now take K F BT2n+1 .
First I show by induction that K has n + 1 leaves (i.e nodes with no children).
If n = 1, then K must have 3 nodes, 1 of which is the root and 2 are the children.
So it has 2=1+1 leaves.
Now assume for K F BT2k+1 , it has k + 1 leaves. Then if we want to add nodes
to get a F BT , K 0 , with exactly 2(k + 1) + 1 = 2k + 3 nodes then the only way we
can do that is by adding 2 nodes to an F BT which we can only do by adding them
both to the same leaf. Which in that case will give us k + 1 1 + 2 = (k + 1) + 1
nodes. Thus by induction an F BT of 2n + 1 nodes has n + 1 leaves.
Now for an F BT , K, assign the map : F BT2n+1 BTn which takes K and
deletes all of its leaves. Clearly (K) is a binary tree which has (2n+1)(n+1) = n
nodes. So this map is well defined. It is also not hard to see that if K1 , K2
F BT2n+1 dont have exactly the same configuration of leaves then they cant have
exactly the same configuration of non-leaves (since every non-leaf is forced to have
2 children by definition). That is, if we have a leaf p that is in K1 but not in K2 ,
then we must have a non-leaf (the parent of p) that is in K1 but not in K2 . Thus
is injective.
Also if given a K BTn , there is exactly one way to fill it up into an F BT
with 2n + 1 nodes without changing any of the existing nodes. That is to add one
child to every node with only one child, two children to every node with 0 children,
and 0 children to every node with 2 children. This is the smallest F BT with K
inside and will have exactly 2n + 1 nodes because this is exactly the process which
is inverse to . So we then have 1 : BTn F BT2n+1 that is well defined and
injective since this process of adding nodes is unique.
Thus is a bijective map which gives us that the number of Full Binary Trees
with 2n + 1 nodes is equal to the number of Binary Trees with n nodes.
Problem 6 All points of the plane that have integer coordinates are colored red,
blue, or green. Prove that there will be a rectangle whose vertices are all of the
same color. (Hint: use the pigeonhole principle!)
proof:
Claim: Any 4 (34 + 1) section of the lattice will have such a rectangle. This
proof uses the pigeonhole principle twice.
First, note that a set of four vertices will have two vertices of the same color by
the pigeonhole principle.
Next, note that there are 34 distinct ways to color four distinct vertices. So by
the pigeonhole principle, a collection of 34 + 1 such colorings will have a repeat.
(i)
(i)
mj
(i)
mN
as i = 2m1 + 2m2 + + 2
(i)
where each mj
(i)
mk
6=
whenever j 6= k. Since the binary representation of any positive integer
is unique, and the terms a1 , . . . , a1+1 ++l1 are odd and distinct, we have that
the following partition must have distinct parts:
(1)
(1)
(1)
(2)
(2)
(l)
mN
a1+1 ++l1 = n
So we have a map from a partition with odd parts to a partition with distinct parts.
The inverse map can be defined as follows. Begin with a partition of distinct terms:
b1 + b2 + + bk = n and write it as:
b2
bk
b1
+ 2l2 l2 + + 2lk l = n
2l1
2
2k
are odd. Now rewrite this as:
2l1
Where
b1
2 l1
, . . . , 2blkk
b1
b1
b2
b2
bk
bk
+ + l1 + l2 + + l2 + + l + + l = n
2l1
2
2
2
2k
2k
Where each group of terms with indices i and li have multiplicity 2li . This partition
has odd parts. Clearly the two above processes are inverses of one another since
applying one map to the result of the other will return us to the original partition,
so we have our bijection. Therefore, the number of partitions of n with distinct
parts is the same as the number of partitions of n with odd parts.
Problem 8. what is the number of conjugacy classes in Sn ? How would you determine the cardinality of a conjugacy class? Suppose you choose a permutation in
Sn uniformly at random. What is the expected number of cycles?
Solution: It is an elementary fact from algebra (proof omitted here) that two
elements are conjugate in Sn if and only if they are of the same cycle type. Therefore, the conjugacy classes in Sn are indexed by the different cycle types. The cycle
types are denoted by c = (c1 , c2 , . . . , cn ), where ci denotes the number of cycles of
length i. We have c1 + 2c2 + + ncn = n. Thus, the number of possible conjugacy
So take
k=1
k=1
X
d X
(
c(n, k)xk ) = (
kc(n, k)xk1 )
dx
and
n1
d Y
x + j = [(x + 1) (x + (n 1))] + [x(x + 2) (x + (n 1))]
dx j=0
+ + [x (x + (n 2))]
Now then
n
X
(
kc(n, k)xk1 ) = [(x + 1) (x + (n 1))] + [x(x + 2) (x + (n 1))]
k=1
+ + [x (x + (n 2))]
and in fact this has to be true for all values of x so let x = 1 and we get
n
n
X
X
n!
1
n! n!
+
+ ... +
= n!
kc(n, k) =
1
2
n
k
k=1
thus
k=1
n
X
c(n, k)
k=1
n!
n
X
1
k=
k
k=1