You are flipping a fair coin n times. Let X be the number of times you get a head followed by a tail (HT) and Y is the number of times you get tail and then a head (TH).
Find Var(X) and Var(Y).
Here is how I approached it:
My approach is the break up the variables X and Y into sums of Bernoulli random variables. For instance, X = X1 + X2 +...+ Xn-1
(because there are n-1 slots for a HT in n flips).
So Xi = 1 if the ith slot of two flips contains a HT and 0 otherwise
I am using the fact that Cov(X, X) = Var(X) and that
Cov(Xi, Xj) = E(Xi Xj) - E(Xi)E(Xj) and then summing this up over all i and j.
For the case where i=j I got 3/16, which seems reasonable. I am have trouble with the case where i≠j, my answers keeps coming out negative and therefore making my whole variance negative, which is not right.
What I've done is:
Cov(Xi, Xj) = E(Xi Xj) - E(Xi)E(Xj)
= P(Xi Xj =1) - (1/4)(1/4)
= P(Xi = 1, Xj = 1) - (1/16)
Here is seems to me that P(Xi = 1, Xj = 1) = 0 since if you have HT in the ith slot then the jth slot begins with a T and thus cannot be HT so Xj = 0. But then this gives you that Cov(Xi, Xj) for i≠j = -1/16. Then summing up you get
(n-1)(3/16) + (n2 - n)(-1/16)
=(1/16)(-n2 + 4n - 3) and this is not positive for most legitimate values of n.
Can anyone help explain what I am missing? Thanks.