Egg-laying Poisson-distributed and applying conditional variance If:

*

*an insect lays $N \stackrel{d}{=} \mathrm{Pn}(\lambda)$ eggs

*the probability of each egg hatching is $p$

*the events of eggs hatching are mutually indepndent,

evaluate the expected value of the number of eggs that hatch and the variance.
I'm struggling with finding the variance, so I'll show my working out for expected value and then ask about the variance.
Let $X$ be the number of eggs that hatch.
$\begin{align}
\mathbb{E}(X) &= \mathbb{E}(\mathbb{E}(X|N))\\
&= \mathbb{E}(X|N = 0)P(N = 0) + \mathbb{E}(X|N = 1)P(N = 1) + \dots\\
&= 0\cdot P(N = 0) + pP(N = 1) + 2p(N = 2) + \dots\\
&= p\lambda e^{-\lambda} + 2p\frac{\lambda^2e^{-\lambda}}{2!} + 3p\frac{\lambda^3e^{-\lambda}}{3!} + \dots\\
&= \sum_{n = 1}^{\infty} p\frac{\lambda^ne^{-\lambda}}{(n - 1)!}\\
&= e^{-\lambda}p\lambda\sum_{n = 1}^{\infty} \frac{\lambda^{n - 1}}{(n - 1)!}\\
&= p\lambda
\end{align}$
$\begin{align}
\mathbb{V}(X) &= \mathbb{E}(X^2) - \mathbb{E}(X)^2\\
\mathbb{E}(X^2) &= \dots\\
&= p\lambda e^{-\lambda} + 2p\frac{\lambda^2e^{-\lambda}}{1!} + 3p\frac{\lambda^3e^{-\lambda}}{2!} + \dots\\
&= \sum_{n = 1}^{\infty} np\frac{\lambda^ne^{-\lambda}}{(n - 1)!}
\end{align}$
Surely the series converges but how do you get the closed form when there's an $n$?

The process of thinning out the number of eggs laid to the number of eggs hatched is called binomial thinning, and the distribution of the number of eggs that hatch is known to be Poisson with mean $p\lambda$.
The mean and variance are therefore both $p\lambda$.
See for example my answer here:
Binomial-binomial is binomial?.
You can also derive the mean and variance directly, without summing any infinite series:
\begin{align}
E(X) &= E_N(E(X|N))\\
&= E_N(pN)\\
&= p\lambda
\end{align}
\begin{align}
\mbox{var}(X) &= E_N(\mbox{var}(X|N))+\mbox{var}_N(E(X|N))\\
&= E_N(Np(1-p))+\mbox{var}_N(Np)\\
&= \lambda p(1-p) + \lambda p^2\\
&= p\lambda\\
\end{align}
The formula I have used here to express the unconditional variance in terms of the conditional mean and variance is called the law of total variance or the variance decomposition formula, see
https://en.wikipedia.org/wiki/Law_of_total_variance.
It is a frequently-used formula for conditional or hierarchical models.
