0% found this document useful (0 votes)
44 views5 pages

Recitation Guide - Week 9: 1 2 2k+1 1 I TH 1

The document discusses three problems related to graphs and probability. 1) It proves that a graph is bipartite if and only if it contains no odd cycles. 2) It calculates the expected number of pairs of socks one can wear after randomly receiving some socks back from the laundry. 3) It determines a general formula for the expected number of friend groups of size m in a room given the number of people n, probability of friendship p between any two people, and group size m.

Uploaded by

Chenyang Fang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views5 pages

Recitation Guide - Week 9: 1 2 2k+1 1 I TH 1

The document discusses three problems related to graphs and probability. 1) It proves that a graph is bipartite if and only if it contains no odd cycles. 2) It calculates the expected number of pairs of socks one can wear after randomly receiving some socks back from the laundry. 3) It determines a general formula for the expected number of friend groups of size m in a room given the number of people n, probability of friendship p between any two people, and group size m.

Uploaded by

Chenyang Fang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CIS 160

Recitation Guide - Week 9

Topics Covered: Graphs, Expectation

Problem 1:
Prove that a graph is bipartite if and only if it has no odd cycles.
Solution:
First let us prove that if a graph is bipartite, then it has no odd cycle. Let G = (U, V, E) be a
bipartite graph. Suppose for the sake of contradiction that it has some odd cycle C of length 2k + 1
and let C = x1 , x2 , . . . x2k+1 , x1 , where xi is the ith vertex in C. WLOG, let x1 be in U . By the
definition of bipartite graphs and the fact that every consecutive pair of vertices in a cycle must
have an shared edge, x1 ∈ U =⇒ x2 ∈ V , x2 ∈ V =⇒ x3 ∈ U , x3 ∈ U =⇒ x4 ∈ V ,. . .
Note that the ith vertex in C is in U if i is odd, and in V if i is even. Thus, x2k+1 must be in U .
However, there is an edge between x2k+1 and x1 , which is also in U . This is a contradiction to the
fact that G is bipartite, as two vertices in U share an edge.
Now let us prove that if a graph has no odd cycles, then it is a bipartite graph. Let P (m) be the
following property:
If G be a graph with m edges and no odd cycles, then it is bipartite.
We wish to prove P (m), for m ∈ N. We proceed by induction on m.
Base Case: m = 0. The graph is bipartite – any partition of the vertices U , V will suffice.
Induction Hypothesis: Assume that P (k) holds for some k ∈ N.
Induction Step: Let G is a graph with k + 1 edges. Let us consider two different cases.
Case 1 - The graph is acyclic
We have a forest! Let us select an arbitrary edge e = {x, y} where x is a leaf. Let G0 = G \ {e}.
Note that G0 is also a forest, so by the induction hypothesis, we have that G0 is bipartite. Let
G0 = (U 0 , V 0 , E 0 ).
We want to now show that we can express G = (U, V, E). Now let us consider what happens when
we add e to G0 . Assume W.L.O.G. that x ∈ U 0 . Then let U = U 0 \ {y} and V = V 0 ∪ {y}. In
other words, keep the partitions from G0 and fix y into V 0 . Since y was an isolated vertex in G0 , the
change in the partition that it belongs to does not affect the bipartiteness of the graph. Further, e
crosses the partition U, V as needed.
Case 2 - The graph has at least one even cycle
Select an arbitrary edge e = {x, y} that belongs to a cycle C. Let G0 = G\{e}. Note that G0 has no
odd cycles, so by the induction hypothesis, we have that G0 is bipartite. Let G0 = (U 0 , V 0 , E 0 ).
We want to now show that we can express G = (U, V, E) Now let us consider what happens when
we add e to G0 . Note that when we removed e from C, we created an odd length path P from
x to y in G0 . Therefore, it must be there x and y are in different partition in G0 . W.L.O.G. let

1
x ∈ U 0 and y ∈ V 0 . Therefore we can simply let U = U 0 and V = V 0 , and observe that e crosses
the partition U, V as required, so G is bipartite.

2
Problem 2:
Yonah, as a busy college student, hasn’t done laundry in weeks. He goes to the laundry room and
throws in 2 distinct pairs of socks. However, the machine is broken, and so it only returns 2 of his
socks at random!
(a) What is the expected number of pairs that he can wear now?
(b) What if he throws in 8 pairs and only gets 12 socks back?
(c) What if he throws in n pairs and only gets k (k > 1) socks back?
Solution:
(a) We will denote the number of pairs he can wear using random variable S.
2
 2
1 ∗ 1 2
P r[S = 0] = 4
 =
2
3

2 ∗ 22

1
P r[S = 1] = 4
 =
2
3
Hence,
1
E[S] = 0 ∗ P r[S = 0] + 1 ∗ P r[S = 1] =
3
(b) If he throws in 8 pairs, let’s denote indicator random variables I1 , I2 , ..., I8 , where Ik = 1
when pair k is returned to Yonah, and Ik = 0 when pair k is not returned to Yonah. Now,
we want to find the expected value of s where S = I1 + I2 + ... + I8 . We know that each pair
has the same expectation of being returned by the washing machine, thus by LOE,
E[S] = E[I1 + I2 + ... + I8 ] = E[I1 ] + E[I2 ] + ... + E[I8 ] = 8 ∗ E[Ik ]
Now, we want to compute E[Ik ]. This equals to P r[Ik = 1] which is the probability that
Yonah gets back pair k. There are a total of 16 12 ways in which the machine can return
14

12 socks, all with equal probability. In addition, there are 10 ways in which the machine
returns the 12 socks and includes the two socks in pair k because we must choose the other
10 socks returned at random. Thus, the probability that the machine returns pair k is
14

10 1001 11
16 = 1820 = 20

12

Plugging this back into our expression for E[S], we get:


11 22
E[S] = 8 ∗ (
)=
20 5
Hence, the expected number of pairs that he can wear is 4.4 pairs
(c) More generally, if there are n pairs and k socks are returned, then
E[S] = n ∗ E[Ii ] = n ∗ P r[Ii = 1]
We calculate all E[Ii ] = P r[Ii = 1] as follows: There are a total of 2n

k ways of returning k
socks, and there are 2n−2

k−2 ways of returning k socks including pair i. Thus, by the similar
logic as (2),

3
(2n − 2)!
2n−2

k−2 (k − 2)!(2n − k)! k(k − 1) k(k − 1)
E[S] = n ∗ 2n =n∗ =n∗ =
(2n)! 2n(2n − 1) 4n − 2

k
k!(2n − k)!

4
Problem 3:
There are n people in a room. Each pair of people has probability p of being friends (uniform
probability across all pairs of people). What is the expected number of friend groups of size m in
the room (in terms of n, p, and m)? Friend groups are groups of m people in which everyone in
the group is friends with everyone else in the group.
Solution:
n

Note that there are m possible groups of size m. We will use an indicator variable Xi where
m
Xi = 1 if group i is a friend group and 0 otherwise. P (Xi = 1) for all i is p( 2 ) because every
possible friendship between any two people in the group must exist (because these are indicator
m
random variables, E[Xi ] is also equal to p( 2 ) ). By linearity of expectation, E[X] where X is a
random variable denoting the number of friend groups of size m is as follows.
n
(m
X )
E[X] = E[Xi ]
i=1

n
(m )
m
p( 2 )
X
E[X] =
i=1

 
n m
E[X] = · p( 2 )
m

You might also like