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
    $\begingroup$ What is your effort? $\endgroup$ – kludg Jun 26 '17 at 2:00

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


| cite | improve this answer | |

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.

| cite | improve this answer | |
  • $\begingroup$ I understand the concept you are proposing but got lost in some of your algebra simplifications good solution nonetheless. $\endgroup$ – Anirudh Jun 26 '17 at 2:33
  • $\begingroup$ Your answer agrees with kludg if $p=\frac 12$ $\endgroup$ – Ross Millikan Jun 26 '17 at 4:21
  • $\begingroup$ @Ross, Oh good, you're right. Thanks. $\endgroup$ – user326210 Jun 26 '17 at 4:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.