# For a random sum, how do you find the distribution?

The following experiment is performed. An observation is made of a poisson random variable N with parameter $$\lambda$$. Then N independent Bernoulli trials are performed, each with probability p of success. Let Z be the total number of successes observed in the N trials. Find the distribution of Z

So I formulated Z as a random sum, Z=$$\xi_1+\xi_2+...+\xi_n$$ where $$\xi\sim$$Bernoulli(p) and N$$\sim$$Poisson($$\lambda$$). and I then conditioned on Z to find the distribution $$P(Z=z)=\sum_{n=1}^{\infty}P(N=n)P(Z=z|N=n)$$. I'm assuming $$Z=z|N=n$$ is a binominal random variable but I don't know how to deduce it. If I do assume its binomial the sum works out and I get a poisson distribution.

• If you perform $\ N\$ independent Bernoulli trials, each with probability $\ p\$, then the distribution of the number $\ Z\$ of successes will be $\ B(N,p)\$, which is therefore the conditional distribution of $\ Z\$ given $\ N\$, if $\ N\$ is chosen randomly. You seem to have come to this conclusion yourself already, so what is it about this process of deduction that you find unsatisfactory? Feb 4 '20 at 2:47
• I'm trying to show it explicitly Feb 4 '20 at 2:49

Given $$\ N=n\$$, the random variables $$\ \xi_1, \xi_2, \dots, \xi_n\$$ are independent with $$\ P\left(\left.\xi_j=1\,\right|N=n\right)=p\$$ and $$\ P\left(\left.\xi_j=0\,\right|N=n\right)=1-p\$$—that is, if $$\ i_1,i_2, \dots, i_n\$$ is a sequence of ones and zeros containing $$\ m\$$ ones and $$\ n-m\$$ zeros, then \begin{align} P\left(\xi_1=i_1, \xi_2=i_2, \dots, \xi_n=i_n |\,N=n\right)&=\prod_{j=1}^nP\left(\xi_j=i_j|\,N=n\right)\\ &=p^m(1-p)^{n-m} \end{align} Therefore \begin{align} P \left(\xi_1+ \xi_2+ \dots +\xi_n=m \,|\,N=n\right)&=\sum_{i_1,i_2, \dots, i_n\in \{0,1\}^n:\\ i_1+i_2+ \dots+i_n=m} p^m(1-p)^{n-m}\\ &={n\choose m} p^m(1-p)^{n-m}\ , \end{align} because $$\ \left|\left\{i_1,i_2, \dots, i_n\in \{0,1\}^n\,|\, i_1+i_2+ \dots+i_n=m\right\}\right|= {n\choose m}\$$.