# Mean of random sum of random variable

Suppose that we have $X_1, X_2, \ldots$ is a sequence of i.i.d random variables with $E(X_i)<+\infty$ and $N$ is a random variable taking values in $\{1,2,\ldots\}$, $N$ is independent with $X_1, X_2, \ldots$.

I know that $$E\left(\sum_{i=1}^N X_i \right) = E(N)E(X_1)$$

If I divide the sum by $N$, $$M = \frac 1N \sum_{i=1}^N X_i$$ I have sample mean of $X_1, X_2,\ldots, X_N$ but $N$ is random. In this case, what is the distribution of $M$ and how to calculate $E(M)$ and $Var(M)$. Thanks.

• The distribution of $M$ is not reachable. The technique which allows to prove the result you mention also yields $E(M)=E(X)$ and $\mathrm{var}(M)=E(1/N)\mathrm{var}(X)$.
– Did
Jun 15 '14 at 20:27
• @ Did, heropup: Thank you for your comment and answer. Could you please recommend some books about conditional expectation? Jun 15 '14 at 20:48

The law of total expectation gives $${\rm E}[M] = {\rm E}[{\rm E}[M \mid N]] = {\rm E}[(N {\rm E}[X_1])/N] = {\rm E}[X_1],$$ as you might guess. The law of total variance gives \begin{align*} {\rm Var}[M] &= {\rm Var}[{\rm E}[M \mid N]] + {\rm E}[{\rm Var}[M \mid N]] \\ &= {\rm Var}[{\rm E}[X_1]] + {\rm E}\bigl[\tfrac{1}{N^2} \cdot N {\rm Var}[X_1]\bigr] \\ &= 0 + {\rm Var}[X_1]{\rm E}[1/N] \\ &= {\rm Var}[X_1]{\rm E}[1/N]. \end{align*}