Вы находитесь на странице: 1из 3

CIS 160

Recitation Guide - Week 8

Topics Covered: Graphs, Expectation

Problem 1:
Prove that G or the complement of G is connected.
Solution:
If G is connected we are done.
If G is not connected then G is composed of multiple connected components. We want to prove
that given two arbitrary vertices in G there must be a path between them in G. Let these two
arbitrary vertices be u and v.
Case 1: u and v do not share an edge in G
This means they must share an edge in G and thus there is a path from u to v in G.
Case 2: u and v share an edge in G
This means they were part of the same connected component in G. Take an arbitrary vertex x in
a different connected component in G. Edges u − x and v − x must both exist in G. Thus, there
is a path u − x − v between vertices u and v.
Thus, we have shown that there exists a path between any two arbitrary vertices in G. By definition
G must be connected. The claim is proved.

1
Problem 2:
Let P1 and P2 denote two paths in a connected graph G with maximum length. Prove that P1 and
P2 have a common vertex.
Solution:
Assume towards a contradiction that P1 and P2 (where the length of P1 and P2 is l) do not share
a common vertex. Since the graph is connected, there exists a shortest path connecting P1 to P2
with endpoints at vertices u in P1 and v in P2 . Call this shortest path connecting u to v P3 . P3
contains no vertices in P1 or P2 other than u and v (If it did, then we could find a shorter path
connecting vertices in P1 and P2 by cutting out the extra vertices in P3 .)
Call the endpoints of P1 a and b and the endpoints of P2 c and d. Since u is in P1 , there exists
paths from a to u and from b to u. Call the maximum of the two paths P4 . (if u is equal to a (or
b), let P4 be the path from b (or a) to u).
Since v is in P2 , there exists paths from v to c and from v to d. Call the maximum of the two paths
P5 . (If v is equal to c (or d), let P5 be the path from v to d (or c)).
Note that the lengths of P4 and P5 must be at least l/2.
By combining paths P4 , P3 , and P5 to get the path P4 P3 P5 , we obtain a path that is of length at
least l/2 + l/2 + 1 = l + 1. This path is therefore longer than P1 and P2 , which contradicts the
assumption that P1 and P2 were paths of maximum length.

2
Problem 3:
Yonah says to Rohan, “We are playing a game. I first roll a fair 6-sided die. If the number that
shows is divisible by 3, I roll again and I pay you the dollar amount that shows up on the second
roll. If not, then I flip a fair coin. If its tails, I take 10 dollars from you, and if its heads, I pay you
5 dollars. What is your expected payoff?”
Rohan, stumped, has asked you to help him out.
Solution:
We will denote the payoff using a random variable X. In this case, its actually easiest to determine
X using the basic formula for expected value, where we calculate the probability and payoff of each
outcome in the sample space.
For each outcome in which the first roll is divisible by 3 (which happens with probability 26 = 13 ),
then the payoff for the outcome is just equal to the value of the second roll, and the probability of
each outcome is 31 · 16 .
For each outcome in which the first roll is not divisible by 3, then the payoffs are equal to -10 or
5, depending on the coin flip, and both outcomes have probability 23 · 12 . Thus, the expected value
is:
X 1 1 2 1 1 1 1
E[X] = Pr(ω) · X(ω) = · (1 + 2 + 3 + 4 + 5 + 6) + · (−10 + 5) = (21) + (−5) = −
3 6 3 2 18 3 2
ω∈Ω

Вам также может понравиться