Geometric Distribution - Coin Flip You have a coin with unknown probability p of coming up heads. You wish to generate a random variable which takes the values 0 and 1, each with probability 1/2. Assume 0 < p < 1. You adopt the following procedure. You start by flipping the coin twice. If both flips produce the same side of the coin, you start again. If the result of the first flip is different from the result of the second flip, you report the result of the first flip and you are finished (this is a trick originally due to John von Neumann).
(a) Show that, in this case, the probability of reporting heads is 1/2.
(b) What is the expected number of flips you must make before you report a result?
I don't know how to start, any help would be appreciated!!!
 A: You report a result only when the result of the two tosses is either $\text{HT}$ or $\text{TH}.$ So you need the conditional probability that the first toss yields “heads” given that you get either $\text{HT}$ or $\text{TH}.$
\begin{align}
& \Pr(\text{1st} = \text{H} \mid {}\text{HT or TH}) \\[10pt]
= {} & \frac{\Pr(\text{1st} = \text{H})}{\Pr(\text{HT or TH})} = \frac{\Pr(\text{HT})}{\Pr(\text{HT or TH})} \\[10pt]
= {} & \frac{p(1-p)}{p(1-p) + (1-p)p} = \frac{p(1-p)}{2p(1-p)} = \frac 1 2.
\end{align}
The probability of reporting a result on each trial (where a trial is a disjoint sequence of two tosses) is
\begin{align}
& \Pr(\text{HT or TH}) \\[10pt]
= {} & \Pr(\text{HT}) + \Pr(\text{TH}) \\[10pt]
= {} & p(1-p) + (1-p)p = 2p(1-p).
\end{align}
Therefore the expected number of such trials is $\dfrac 1 {2p(1-p)}.$
A: 1: Let's look at how the sequence terminates. It can either terminate by the first flip being heads and the second being tails, or vice versa. On any given turn, the first case happens with probability: $$\frac{1}{p} \cdot \frac{1-p}{p}$$
And the second case happens with probability: 
$$\frac{1-p}{p} \cdot \frac{1}{p}$$
Since these two probabilities are equal, then given that the sequence terminates, each of these possible termination states have probability $\frac{1}{2}$ - thus heads will be the first flip exactly as often as tails will be. 
2: The expected number of flips is slightly harder. Let $x$ be the probability that we flip the same coin face $\Big($this is just $\frac{1}{p^2}+\frac{(1-p)^2}{p^2}$$\Big)$. Then our expected value is the probability that it terminates first-try times $1$ plus the probability that it terminates on the second try times $2$, etc: 
$$(1-x) + 2(1-x)x^2 + 3(1-x)x^2 + \cdots = \sum^\infty_{n=1}nx^{n-1}(1-x)$$
This is called a arithmetico-geometric series, and a formula exists to evaluate them here. Provided $x \neq 1$, we can set $a_n = n(1-x)$ and $g_n = x^{n-1}$. Plugging our values into the formula for infinite arithmetico-geometric series given at the link above gets us: 
$$\sum^{\infty}_{n=1} a_ng_n = \sum^{\infty}_{n=1} n(1-x)x^{n-1} = \frac{(1-x)x}{(1-x)^2} + \frac{1-x}{1-x} = \frac{x}{1-x} + 1$$
Feel free to plug in our value for $x$ in terms of $p$, but I'll leave it in this form. 
