# Tossing 2 coins, distribution

We are tossing 2 fair coins once. Then for the next toss we are only tossing the coin(s) that came up heads before.

Let $X$ be the total number of heads.

The question is $EX$ and the distribution of $X$

I tried to calculate the expected values for small $X=x$-es but it gets really complicated soon.

• Perhaps you should include what you have calculated thus far so that people will know exactly where you are stuck or made a wrong turn. Also, you might want to start with something smaller. If $Y$ is the number of Heads on the first toss of 2 fair coins, what is the distribution of $Y$ and what is $E[Y]$? – Dilip Sarwate Oct 12 '14 at 19:25
• $TT, THT, THH, HTT, HTH, HHTT, HHHT, HHTH, HHHH$ – Dilip Sarwate Oct 12 '14 at 21:11
• Can you show some of your work? It might help to guide you. – Glen_b -Reinstate Monica Oct 12 '14 at 23:35
• What exactly do you mean by "small $X$"? It sounds like you will make at most two tosses and can observe at most four total heads; there do not seem to be any complications insofar as that goes. Thus the reference to "small $X$" suggests that maybe you are contemplating a different interpretation of the problem which somehow did not get expressed explicitly. – whuber Oct 13 '14 at 4:44
• @whuber maybe my interpretation of the problem is indeed incorrect. I thought we toss a coin that came up heads until we got a tails, so it is not just a 2 round game. – kanbhold Oct 13 '14 at 5:38

Start by considering each coin in isolation, and the question becomes easier. Let $Y$ denote the number of heads for the first coin, and $Z$ denote the number of heads for the second coin, so $X=Y+Z$. $Y$ and $Z$ are identically distributed so let's just consider $Y$.

First, we know that if $Y=y$, then the first coin must have come up heads exactly $y$ times, and then tails once. The probability of $y$ heads in a row is $\left ( \frac{1}{2} \right )^{y}$, and the probability of getting tails after that is $\frac{1}{2}$. Thus:

$P(Y=y) = \left ( \frac{1}{2} \right )^{(y+1)}$

To calculate the expected value of $Y$, we sum $y \cdot P(Y=y)$ over all values of $Y$, from zero to infinity:

\begin{align} E[Y] &= \sum_{y=0}^{\infty} y \cdot P(Y = y)\\ &= \sum_{y=0}^{\infty} y \cdot \left ( \frac{1}{2} \right )^{(y+1)} \\ &= 1 \end{align}

The expectation of the sum of two random variables is the sum of their expectations, so $E[X] = E[Y+Z] = E[Y] + E[Z] = 2$.

How do we use $P(Y)$ to get $P(X)$? Here's an example: Say $X=2$. Then we know there are three possibilities: (1) $Y=2$ and $Z=0$, (2) $Y=1$ and $Z=1$, or (3) $Y=0$ and $Z=1$. Since $Y$ and $Z$ are independent, we have: \begin{align} P(X=2) &= \left( \left( \frac{1}{2} \right)^{3}\cdot \frac{1}{2} \right ) + \left( \left( \frac{1}{2} \right)^{2}\cdot \left(\frac{1}{2} \right)^2 \right) + \left( \frac{1}{2} \cdot \left( \frac{1}{2} \right)^{3} \right )\\ &= 3 \cdot \left( \frac{1}{2} \right)^{4} \end{align}

This example gives the intuition that maybe $P(X=x) = (x+1) \cdot \left( \frac{1}{2} \right)^{(x+2)}$. It is true for $X=0$: both heads have to come up tails on the first flip, and the probability of that occurring is $\frac{1}{4} = (0+1) \cdot \left( \frac{1}{2} \right)^{(0+2)}$.

It should be simple to show by induction that this is true for all values of $X$. Here is a sketch. First note that if $X=x$ there are $x+1$ possible combinations of $Y$ and $Z$ values that can produce $y + z = x$. Each value of $Y$ corresponds to a unique series of heads and a tail (and likewise for $Z$). If we iterate, and ask what values of $Y$ and $Z$ could give $y' + z' = x+1$, we can start with our original set of possible combinations of $Y$ and $Z$ values, and just add an extra head to the start of each run for the first coin, which would multiply the probability of each combination by $\frac{1}{2}$. That is, we set $y'= y+1$ and $z'=z$. Then we need to add one new term to the sum, to account for the case where $y=0$, and $z'=x+1$.