# Toss a fair coin four times independently. Let X be the number of heads minus the number of tails. Find the distribution of X.

This is what I have right now:

\begin{array}{l|c} %l/c/r = left-align/centre/right-align | for a vertical bar \mathrm{Outcome} & X = \mbox{#heads} - \mbox{#tails}\\\hline HHHH & 4 \\ HHHT & 2 \\ HHTH & 2 \\ HHTT & 0 \\ HTHH & 2 \\ HTHT & 0 \\ HTTT & -2 \\ THHH & 2 \\ THHT & 0\\ THTH & 0 \\ THTT & -2 \\ TTHH & 0 \\ TTHT & -2 \\ TTTH & -2 \\ TTTT & -4 \\ \\ \end{array}

Then distribution function $$F(x)= P(X\leq x) = \begin{cases} 0, & \text{if } x < -4, \\ \frac{1}{15}, & \text{if } -4 \leq x < -2 \\ \frac{1}{3}, & \text{if } -2 \leq x < 0 \\ \frac{3}{5}, & \text{if } 0 \leq x < 2 \\ \frac{14}{15} & \text{if } 2 \leq x < 4\\ 1, & \text{if } x \geq 4 \end{cases}$$ Do I have this right?

• There should be 16 outcomes. You missed one. HTTH. Commented Feb 23, 2017 at 23:27

You forgot about one outcome: $\color{red}{HTTH}$.

The corrected list is then

\begin{array}{l|c} %l/c/r = left-align/centre/right-align | for a vertical bar \mathrm{Outcome} & X = \mbox{#heads} - \mbox{#tails}\\\hline HHHH & 4 \\ HHHT & 2 \\ HHTH & 2 \\ HHTT & 0 \\ HTHH & 2 \\ HTHT & 0 \\ \color{red}{HTTH}& 0\\ HTTT & -2 \\ THHH & 2 \\ THHT & 0\\ THTH & 0 \\ THTT & -2 \\ TTHH & 0 \\ TTHT & -2 \\ TTTH & -2 \\ TTTT & -4 \\ \\ \end{array}

The probabilities are equal: $\frac1{16}$ but not $\frac1{15}$.

Now, we can redo the cdf:

$$F(x)= P(X\leq x) = \begin{cases} 0, & \text{if } x < -4, \\ \frac{1}{16}, & \text{if } -4 \leq x < -2 \\ \frac{5}{16}, & \text{if } -2 \leq x < 0 \\ \frac{11}{16}, & \text{if } 0 \leq x < 2 \\ \frac{15}{16} & \text{if } 2 \leq x < 4\\ \frac{16}{16}, & \text{if } x \geq 4 \end{cases}$$

Almost, but not quite.

Each of the 4 coins can be one of two possibilities: either be heads or tails, so there are $2^4 = 16$ different ways for the four fair coins, not 15. When you make a list, be sure to check that you didn't leave out any case.

Actually, there are ways to make sure you are correct.

$x < -4$ : $0$. The reason is obvious, as there cannot be more than 4 tails.

$-4 \leq x < -2$ : $\frac{1}{16}$. There is only one case: $TTTT$.

$-2 \leq x < 0$ : $\frac{5}{16}$. There are 4 extra ways: as you can place the "$H$" in 4 positions. $HTTT$, $THTT$, $TTHT$, and $TTTH$.

$0 \leq x <2$ : $\frac{11}{16}$. We place the $H$ in one of 4 spots, and the other $H$ in one of the other 3. Be careful! We have to divide by 2, as the heads are indistinguishable, so $H_1H_2T_3T_4$ is the same as $H_2H_1T_3T_4$. $\frac{3\cdot4}{2}= 6$, and $5+6 = 11$.

$2 \leq x <4$ : $\frac{15}{16}$ We do the same thing as $-2 \leq x < 0$.

And finally, $x \geq 4$. Obviously, this is 1.

Aside from missing one of the sixteen outcomes (HTTH), you do have the right idea.

We can also do it thusly:

The count of heads is binomially distributed, and the count of tails is complementary (they add to 4), so we can use the binomial distribution, $$\mathcal{Bin}(4,1/2)$$, to obtain the distribution of the difference.

\def\P{\operatorname{\sf P}} \begin{align}\P(H-T=-4) ~&=~ \P(H=0, T=4) &= 1/16\\[1ex]\P(H-T=-2) ~&=~ \P(H=1, T=3) &= 4/16\\[1ex]\P(H-T=\;0\;) ~&=~ \P(H=2,T=2) &= 6/16\\[1ex]\P(H-T=\;2\;) ~&=~ \P(H=3, T=1) &= 4/16\\[1ex]\P(H-T=\;4\;) ~&=~ \P(H=4, T=0) &= 1/16\end{align}