# Sum of $Y$ i.i.d Binomial Random variables $(n,p)$, where $Y$ follows poisson distribution

The Question

Let $$X \sim \operatorname{Bin}(n, p)$$, and $$Y \sim \operatorname{Poisson}(\lambda)$$. Let $$T=X_1+X_2+\cdots+X_Y,$$ with $$X_i{ }^{\prime}$$ 's i. i. d. $$\operatorname{Bin}(n, p)$$ (and independent to $$Y$$ ), and $$S=Y_1+Y_2+\cdots+Y_X,$$ with $$Y_i$$ 's i. i. d. Poisson ( $$\lambda$$ ) (and independent to $$X$$ ). Compare Expectations of $$T$$ and $$S$$ and Variances of $$T$$ and $$S$$.

Thoughts To me it seems that the expectation of $$T$$ and expectation of $$S$$ should be $$np\lambda$$, somehow using linearity of expectation, $$Y$$ times $$np$$ and then $$Y$$ has expectation $$\lambda$$ so, $$np\lambda$$. But I am not able to go beyond this intuition and hand waving. For the Variance part as well, it seems the Variance of $$T$$ should be $$(np(1-p))^{2}\lambda$$ but again not any clue or if this is even right. Kindly help.

• Is $Y$ independent of $X_{i}$'s and $X$ independent of $Y_{i}$? In that case, you can use the identity $E(X)=E(E(X|Y))$ to get the elementary version of Wald's Lemma. Otherwise, you have to go with the Martingale approach and prove Wald's Lemma. Commented Apr 30 at 12:33
• I didn't know this identity. But I will try this, but this again brings me to a new question, why is the above identity holds?
– Debu
Commented Apr 30 at 12:35
• If you know about conditional expectation (measure theoratic definition), then it's very very easy to prove. Otherwise, there's no general proof of this result. But, you can show it by assuming that $X$ and $Y$ have discrete distributions or continuous distributions with pdf's by exploiting the joint pdf. Commented Apr 30 at 12:36
• Btw, I meant that the idenity holds for all random variables $X,Y$ and not just for this question. i.e. for $Z$ and $W$ be any two random variables with finite expectation, you have that $E(Z)=E(E(Z|W))$. So you need to apply this to $Z=T$ and $W=Y$ and then exploit the independence of $X_{i}$'s and $Y$. Commented Apr 30 at 12:40
• @Mr.GandalfSauron OKay so i think now i can handle the Expectation part, any suggestions about the Variance part? I specifically want to understand how to deal with $E(T^{2})$ term.
– Debu
Commented Apr 30 at 12:43

Assuming that $$X$$ is independent of $$Y_{i}$$'s and $$Y$$ is independent of $$X_{i}$$'s , you can apply the following two identities,

For any two random variables $$Z$$ and $$W$$ with finite expectation and Variance, $$\Bbb{E}(Z)=\Bbb{E}\bigg(\Bbb{E}(Z|W)\bigg)$$ known as Law of Total Expectation and $$\text{Var}(Z)=\Bbb{E}\bigg(\text{Var}(Z|W)\bigg)+\text{Var}\bigg(\Bbb{E}(Z|W)\bigg)$$ known as Law of Total Variance

I'll show you the first one and leave the rest to you as this answer is meant more as a hint .

Apply the first identity to $$Z=T$$ and $$W=Y$$.

Then you have that $$\Bbb{E}(T|Y=y)=\sum_{k=1}^{y}\Bbb{E}(X_{k}|Y=y)$$

But, $$X_{k}$$'s are independent of $$Y$$. So you have $$\Bbb{E}(T|Y)=Y\cdot n p$$

and so, $$\Bbb{E}(T)=\Bbb{E}(Y)\cdot np = \lambda\cdot np$$

Please see here. In particular, the expectation follows from Wald's equation.