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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose we flip a coin a random number $N$ of times, where $$P(N = n) = (e^{-r})\frac{r^n}{n!}\qquad n = 0,1,2,\ldots$$ that is, $N$ has a Poisson distribution. The flips are independent, and the probability of seeing heads is equal to p. Hence if we know that $N = n$, the number of heads is simply the number of heads in $n$ coin flips with success probability $p$. We write $X$ for the total number of heads, and $Y$ for the total number of tails, so $X +Y = N$.

Question: Why is $$P(X=x) = \sum_{n\geq x} P(X=x|N=n)P(N=n)\quad ?$$ Also, how does one calculate this sum?

share|cite|improve this question
This is the law of total probability. The event $\{X = x\}$ can occur only if the coin is tossed $x, x+1, x+2, \ldots $ times. That is, $N$ must necessarily take on value $n \geq x$, and if $N=n$, then $P\{X=x|N=n\}$ is a binomial probability. So, $$P\{X=x\}=\sum_{n = x}^\infty P\{X=x|N=n\}P\{N=n\}.$$ It is good to write out the formula explicitly, cancel $n!$, and sum the series (yes it can all be done quite straightforwardly). You will get a nice result if you do this. – Dilip Sarwate Feb 8 '12 at 1:54
Can you please also explain its solution. I already understood what you are explaining, but stuck at the sum part. – user669083 Feb 8 '12 at 2:02
up vote 1 down vote accepted

What you describe is called the law of total probabilities. The proof goes like this $$P(X = x) = \sum_{n=0}^\infty P(X = x\; {\rm and}\; N=n) = \sum_{n= 0}^\infty P(X = x|N=n)P(N=n)$$ Now $X$ is a sum of $n$ binomials, so if $n < x$ we cannot have $X = x$; in this case $P(X = x | N = n) = 0$.

Since we have independent trials, $P(X = x | N = n) = {n\choose x}p^x(1-p)^{n-x}$ giving the summation.

Now it is time to compute the summation. We have $$P(X=x) = \sum_{n=x}^\infty P(X=x|N=n)P(N=n) = \sum_{n=x}^\infty {n\choose x}p^x(1-p)^{n-x}{r^ne^{-r}\over n!}.$$ Regrouping and cleaning up we have $$P(X=x) = e^{-r}\sum_{n=x}^\infty {1\over x!(n-x)!}(rp)^x(r - rp)^{n-x} $$ Now reindex to obtain $$P(X=x) = e^{-r}\sum_{n=0}^\infty {1\over n!x!} (rp)^x(r-rp)^n = {(rp)^xe^{-r}\over x!}\sum_{n=0}^\infty {(r-rp)^n\over n!}= {(rp)^xe^{-r}\over x!} e^{r-rp} = {(rp)^xe^{-rp}\over x!}.$$ What you get is distrubuted Poisson(rp).

share|cite|improve this answer

You can add an intermediate step as follows:

$\begin{align} P[X = x] &= \sum_{n=1}^\infty P[X = x, N = n]\\ &= \sum_{n=1}^\infty P[X = x | N = n] P[N = n], \end{align}$

where we used Bayes' formula in the second step. Of course all terms with $n < x$ are zero because if $n < x$, it's impossible to get $x$ heads after $n$ flips.

As to how to calculate the sum, you should fill in the probabilities and see what you can do. Note that P[X = x | N = n] is the same as the probability of flipping $n$ coins and getting $x$ heads, which you can calculate.

share|cite|improve this answer

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.