Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let $H_n$ be the number of heads in $n$ coin flips.
Let $T_n$ be the number of tails in $n$ coins flips.

Is there a good way to calculate $E_n = E[|H-T|]$ that isn't brute force computation, i.e. directly evaluating $$E[|H-T|] = \frac{1}{2^n} \sum {n \choose r} |n-2r|. $$

I don't see any approach that can simplify this calculation.

share|cite|improve this question
This seems equivalent to calculating the expected distance from the origin of a 1D random walk. See eg –  leonbloy May 13 '13 at 19:04

1 Answer 1

up vote 6 down vote accepted

$$\sum_r \dbinom{n}r \vert n-2r \vert = \sum_{r < n/2} \dbinom{n}r (n-2r) + \sum_{r>n/2} \dbinom{n}r (2r-n) = 2\sum_{r>n/2} \dbinom{n}r r - \sum_{r<n/2}\dbinom{n}r r$$ I trust you can take it from here. You may need to use the identities $$r \binom{n}r = n\dbinom{n-1}{r-1}$$ $$\sum_{r=0}^{k-1} \dbinom{2k}r = \dfrac{4^k - \dbinom{2k}k}2$$ $$\sum_{r=0}^{k} \dbinom{2k+1}r = 2^{2k}$$

share|cite|improve this answer
Thanks! I forgot to use the first identity which simplifies it thereafter. –  Calvin Lin May 13 '13 at 19:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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