You are on page 1of 2

Proof Assignment #4

1. If X, Y are two discrete random variables, we define the covariance of X and Y in the
following manner:
Cov(X, Y ) = E((X E(X))(Y E(Y ))).

(a)(2 points) Show that this formula can be simplified to

Cov(X, Y ) = E(XY ) E(X)E(Y ).

First, we can observe that

Cov(X, Y ) = E((X E(X))(Y E(Y )))


= E(XY XE(Y ) E(X)Y + E(X)E(Y ))
= E(XY ) E(X)E(Y ) E(X)E(Y ) + E(X)E(Y ),

by linearity of expectation (i.e. Theorem 1 part (3) from class). Canceling the last term
with one of the subtracted terms yields the desired result.
(b)(1 point) Show that if X and Y are independent, then Cov(X, Y ) = 0.
If X and Y are independent, then we know from class that E(XY ) = E(X)E(Y ). Thus,

Cov(X, Y ) = E(XY ) E(X)E(Y ) = E(X)E(Y ) E(X)E(Y ) = 0.

2.(2 points) What is the expected number of runs of k heads in a string of n coin flips?
Carefully prove your answer, labeling all expected values properties that you use.
Let

1 if the ith coin flip turns up heads after k 1 consecutive heads
Xi =
0 otherwise

Then, if X is defined to be the number of runs of k heads, we have X = ni=k Xi . Now


P
P (Xi = 1) = 21k , since there is a 21 chance of getting heads on a fair coin and each flip is
independent. Thus,
Xn Xn
E(X) = E( Xi ) = E(Xi ),
i=k i=k

by linearity of expectation (i.e. Theorem 1 part (3) from class). Since


1
E(Xi ) = 1 P (Xi = 1) + 0 P (Xi = 0) = ,
2k
then we have n n
X X 1 nk+1
E(Xi ) = = .
i=k i=k
2k 2k

1
Proof Assignment #4

Bonus (+2 points) We construct a random graph by flipping a fair coin to determine whether
any given pair of vertices should be connected by an edge (i.e. Pick a pair of vertices and
flip the coin. If the coin lands heads, then we draw an edge between them. If the coin lands
tails, then we dont draw an edge between them. We repeat this experiment for all possible
pairs of vertices). What is the expected number of edges in a random graph with n vertices?
What is the expected number of triangles?

First, we will compute the expected number of edges in a random graph. Let

1 if the ith pair of vertices has an edge connecting them
Xi =
0 otherwise
Note that there are n2 ways of choosing pairs of vertices out of a total of n. Then, if we


define X to be the number of edges in a random graph, we have


(n2 )
X
X= Xi .
i=1

Now, P (Xi = 1) = 21 since we determine whether to connect the ith pair of vertices by
flipping a fair coin once. Thus,

X(n2 ) (n2 )
X
E(X) = E( Xi ) = E(Xi ),
i=1 i=1

by linearity of expectation. We have


1
E(Xi ) = 1 P (Xi = 1) + 0 P (Xi = 0) = ,
2
so
(n2 ) (n2 ) n

X X 1 2
E(X) = E(Xi ) = = .
i=1 i=1
2 2
Now, we will compute the expected number of triangles. The probability that three
vertices are connected by three edges (to form a triangle) is 213 since we have probability
1 n

2
for each edge and the coin flips are independent. There are 3 ways to pick a triple of
vertices in a graph on n vertices and compare them. So, if we define

1 if the ith triple of vertices forms a triangle
Xi =
0 otherwise
P(n3 )
then X = # of triangles in a random graph = i=1 Xi . Therefore,

(n3 ) (n3 ) (n3 ) (n3 ) n



X X X X 1
E(X) = E( Xi ) = E(Xi ) = 1 P (Xi = 1) + 0 P (Xi = 0) = 3
= 3 .
i=1 i=1 i=1 i=1
2 8

You might also like