# Homework Help: Penny flipped and uniform PDF generated

1. Feb 29, 2012

### alpines4

1. The problem statement, all variables and given/known data
A penny is flipped until we see the first head, and flips are assumed to be independent. For each tail we observe before the first head, the value of a continuous random variable with uniform PDF over the interval [0,3] is generated. Let the RV X be the sum of all the values obtained before the first head. We want to find the mean and variance of X.

2. Relevant equations

3. The attempt at a solution

Assuming n tails before the first head, we have E[X] = E[X_1 + ... + X_n] = E[X_1] + ... + E[X_n], and Var(X) = Var(X_1 + ... + X_n) = Var(X_1) + ... + Var(X_n) as the X_i are independent so there are no covariance terms.

Since each X_i has a discrete uniform distribution, the pdf of each X_i is 1/4 for X_i = 0,1,2, or 3.

Also, the probability of flipping n tails before the first head is (0.5)^n.

However, I'm not sure how to put all of this together. I think the mean of X will be (1/4) + ...+ (1/4) n times, but this doesn't take into account the probability of flipping n tails. Any help would be appreciated.

2. Feb 29, 2012

### Ray Vickson

You have one expression wrong: the probability of flipping n tails before the first head is 1/2 for n = 0 (i.e., the first toss is heads) and is (1/2)^n for n >= 1. Since it is possible that there are no tails before the first head, your generation scheme also needs to handle that case. I can see two "reasonable" ways: (i) ignore that case and do another sequence of flips; or (ii) when there are no tails, generate the single value "0".

In case (ii) the generated random variables would be mixed discrete and continuous, with a finite probability of the point 0. In case (i) the number of tails distribution would be P{Tails=n}= (1/2)^(n-1), n=1,2,... (the conditional probability of having first toss = tails).
So, case (i) is easier to work with and I will do that. You have $$EX =\sum_{n=1}^{\infty} P\{\text{Tails}=n\} E(X_1 + \cdots + X_n),$$
and similarly for Var(X).

RGV

3. Feb 29, 2012

### alpines4

Thank you for your help, Ray.