Flip coin until more heads

expected valueprobabilitystochastic-processes

Suppose we flip a coin until we get more heads than tails. What is our expected number of flips?

I'm struggling with my approach here. Suppose our expected number of flips is $X$. We can say $$X = \frac12\cdot1 + \frac12(1 + Y)$$ where $Y$ is the number of flips needed to get $2$ more heads than tails. The problem is I think $Y = 2X$ which does not leave me with a solvable equation. Any guidance would be appreciated.

Best Answer

Actually, the expected number of flips is $\infty$. Let $n$ denote (the number of tails $-$ the number of heads). Let $X_{n+1}$ denote the expected number of flips when you have $n$ more tails than heads. Suppose the process also ends when $n+1=w>0$, then \begin{align} X_{0}&=0&\\ X_{1}&=1+\frac12X_{0}+\frac12X_2&\\ X_{n}&=1+\frac12X_{n-1}+\frac12X_{n+1}&\\ \dots&=\dots\\ X_{w}&=0& \end{align} The solution of this inhomogeneous system of equations is $$X_n=n(w-n)$$ The expected number of flips is $$X_1=w-1\to\infty\:(w\to\infty)$$ if the flipping can continue indefinitely. The process ends with probability $1$ (eventually we will get more heads than tails), but the expected number of flips is infinite.