Prove that $E\!\left[\sum_{i=1}^NX_i\right]=\mu E[N]$

Let $X_1, X_2, \cdots$ be independent and identically distributed random variables with expectation $\mu$. Let $N$ be a positive integer-valued random variable such that $E[N] < \infty$ and such that $I_{N≥n}$ is independent of $X_n$ for all $n$. Prove that $$E\!\left[\sum_{i=1}^NX_i\right]=\mu\, E[N]$$

This is a question from an exam a few years ago. I don’t even know where to start here. What is meant by $I_{N≥n}$?

You have to condition on the event that $N=k$ for some integer $k$; $$E \left[ \sum_{i=1}^N X_i \right] = \sum_{k=0}^{+\infty} E \left[ \sum_{i=1}^N X_i \bigg| N = k \right] P(N=k)\\ =\sum_{k=0}^{+\infty} \sum_{i=1}^k E \left[ X_i \right] P(N=k), \quad \text{by independence of } X_i \text{ and } N \\ = \mu \sum_{k=0}^{+\infty} k P(N=k), \quad \text{since } E[X_i] = \mu \\ = \mu E[N]$$
• "You have to condition on the event that $N=k$ for some integer $k$" How did you see that this has to be done? And I don't understand the first line at all. An also, what does $I_{N\ge n}$ mean? – Parseval May 15 '18 at 16:15
• You would like to make E[Xi] appear, but N is a random variable, so it is not possible to permute the summation over i and the expectation directly. Conditioning over the value of N fixes the upper bound to some constant k, but then N=k only happens with probability P(N=k). So you need to consider all possible events N=k for all values of k. This is called the law of total expectation en.wikipedia.org/wiki/Law_of_total_expectation and explains the first line. $I_{N \geq n}$ is a random variable equal to 1 if $N \geq n$ and 0 otherwise. – monty47 May 15 '18 at 17:06
First of all, $I_{N\geq n}$ is the random variable defined by $$I_{N\geq n}(\omega)=I_{N(\omega)\geq n}=\begin{cases} 1\quad\text{if } N(\omega)\geq n\\0\quad \text{if } N(\omega)<n\end{cases}$$ and is often called an indicator function (for the set $\{N\geq n\}$). Now, led by the assumption that $I_{N\geq n}$ is independent of $X_n$ for all $n$, we have that $$\mathrm{E}\Big[\sum_{n=1}^NX_n\Big]=\mathrm{E}\Big[\sum_{n=1}^\infty X_n I_{N\geq n}\Big]=\sum_{n=1}^\infty \mathrm{E}[X_nI_{N\geq n}]=\sum_{n=1}^\infty \mu P(N\geq n),$$ where we in the last equality used the independence, and in the second-to-last equality used dominated convergence. All there is left now is to conclude that $$\sum_{n=1}^\infty P(N\geq n)=\mathrm{E}[N].$$