# Math Help - probability(mean of a random variable)

1. ## probability(mean of a random variable)

we flip a fair coin n times,if k is the number of 'heads' we get,we then flip the coin until we get k+1 heads(the number of flips is not given for the second round),let Y be the number of flips(for the second round)

determine the mean of Y.

here's my logic:

for the first round,this is a bionomial disribution so the mean is:np=n/2

for the second time,we need to get k+1 heads so the mean for the first k heads
is just like before: n/2..and to get the "extra" heads we need to add 2
so the mean is n/2 + 2

now here comes the tricky part..if I add those two i.e n/2 + (n/2 +2 ) = n+2
I get the right answer...but I dunno if it's correct,or why am I allowed to do that.

2. Originally Posted by parallel
we flip a fair coin n times,if k is the number of 'heads' we get,we then flip the coin until we get k+1 heads(the number of flips is not given for the second round),let Y be the number of flips(for the second round)

determine the mean of Y.

here's my logic:

for the first round,this is a bionomial disribution so the mean is:np=n/2

for the second time,we need to get k+1 heads so the mean for the first k heads
is just like before: n/2..and to get the "extra" heads we need to add 2
so the mean is n/2 + 2

now here comes the tricky part..if I add those two i.e n/2 + (n/2 +2 ) = n+2
I get the right answer...but I dunno if it's correct,or why am I allowed to do that.

Given k heads occur on the first round, the number of tails required to get k+1 heads on the second round has a negative binomial distribution with parameters r = k+1 and p = 1/2. The mean of this distribution is k+1. So given k heads on the first round, the expected number of tails is on the second round is k+1 and the expected number of flips including the heads is 2(k+1). Thus E(Y|k) = 2k+2.

Using the law of total expectation,

E(Y) = E(E(Y|k)) = E(2k+2) = 2E(k) + 2 = 2(n/2) + 2 = n + 2

since E(k) is just the mean n/2 of the binomial(n,1/2) distribution.

3. thank you very much for your help.