What is the expected value of the product of the number of heads you get and the number of tails you get when you flip n coins?

784 Views Asked by At

Ex. If you get $h$ heads and $n-h$ tails the product would be $n(n-h)$ I want to know the expected value of this product.

2

There are 2 best solutions below

0
On BEST ANSWER

Assuming the probability of Heads is $p$ and using linearity of expectations and standard expressions for mean and variance of the Binomial distribution,

$E[HT]=E[H(n-H)]=E[nH]-E[H^2]=n^2p-\operatorname{var}(H)-(E[H])^2=n^2p-np(1-p)-n^2p^2=n^2p(1-p)-np(1-p)=n(n-1)p(1-p)$

3
On

The general definition of the expected value of $f$ is:

$$E[f] \equiv \sum_{\text{outcome }x} f(x) \cdot \Pr(x).$$

Let's fix a number of tosses $N$. We can label the possible outcomes based on the number of heads we get; the number will be between 0 and $N$.

The probability of getting $h$ heads is

$$\Pr[h] = \frac{N \choose h}{2^N}$$

And the function we're measuring is:

$$f(h) = \mathtt{heads}(h)\cdot \mathtt{tails}(h) = h(N-h)$$

Hence the expected value is:

\begin{align} E[f] &= \sum_{\text{outcome }x}f(x) \cdot \Pr[x] & \text{Defn. of }E\\ &= \sum_{h = 0}^N h(N-h)\cdot \Pr[\text{heads = }h] & \text{Defn. of }f\text{ for this problem} \\ &= \sum_{h=0}^N (Nh - h^2) 2^{-N} {N \choose h} & \text{Defn. of }\Pr\text{ for this problem} \\ &= \left(N2^{-N}\sum_{h=0}^N h{N \choose h}\right) - 2^{-N}\left(\sum_{h=0}^N h^2 {N \choose h}\right) & \sum (A-B)C = \sum AC - \sum BC\\ &= N2^{-N}\left(2^{N-1}\cdot N\right) - 2^{-N}\left(2^{N-2} \cdot N(N+1)\right) & \text{Evalute }\sum h{N \choose h}; \sum h^2 {N \choose h} \\ &= \frac{1}{2}N^2 - \frac{1}{4}(N^2 + N)& \text{Combine like terms }\\ &= \frac{N}{4}(N- 1) & \text{Simplify} \end{align}

(Assuming I've done the calculations correctly.)

You can confirm that this answer works when $N=1$, for example (so $f$ is zero for all outcomes). And when $N=2$, so the possibilities for $f$ are 0, 1, 1, 0; the expected value is $\frac{1}{2}$ as predicted.