# Trying to understand better $\mathbb E[Y\mid N]$.

Let $N$ a r.v. (let say that $\mathbb P\{N\in\mathbb N\}=1.$) Let $X_1,X_2,...$ iid random variables and we set $\mathbb E[X_i]=\mu$. Set $$Y=X_1+X_2+...+X_N,$$ Does $\mathbb E[Y]$ has a sense ? Because it looks to be $$\mathbb E[Y]=\sum_{i=1}^N \mathbb E[X_i]=\mu N,$$ and thus it looks to be a r.v. and not a number. And what would be $\mathbb E[Y\mid N]$ here ? When we write $\mathbb E[Y,\mid N]$ do we consider $N$ a fixed element in $Y$ or not ?

The problem is that the sumation is itself random, so you can't compute $\mathbb E[Y]$ without any information on $N$. In your calculation you suppose $N$ fixed (but unfortunately it's not). In fact, $\mu N$ is precisely $\mathbb E[Y\mid N]$. Therfore, $$\mathbb E[Y]=\mathbb E[\mathbb E[Y\mid N]]=\mathbb E[\mu N]=\mu\mathbb E[N].$$

Indeed, when you conditionate, it's if you suppose that $N$ is fixed (in a certain way).

• Thank you. And could you explain how to compute $\mathbb P\{Y\leq x\}$ ? and what is $\mathbb P\{Y\leq x\mid N\}$ ? – user352653 Jun 8 '18 at 12:40
• Use Law of total probability for $\mathbb P\{Y\leq x\}$. Notice that $\mathbb P\{Y\leq x\mid N\}$ is a r.v. – Surb Jun 8 '18 at 12:48

Here, $\mathbb E [ Y \vert N ]$ is simply $\mu N$. Intuitively speaking, this is what you expect the value of $Y$ to be on average, given that you know what $N$ is.

Note that you don't really need this to calculate $\mathbb E[Y]$, since

\begin{align*} \mathbb E[Y] &= \mathbb E\left [\sum_{i=1}^N X_i \right] \\ &= \sum_{n\in \mathbb N}\mathbb E\left[\left.\sum_{i=1}^N X_i \right\vert N=n \right] \mathbb P (N=n)\\ &= \sum_{n\in \mathbb N}\mathbb E\left[\sum_{i=1}^n X_i \right] \mathbb P (N=n) \\ &= \sum_{n\in \mathbb N}n\mu \mathbb P (N=n) \\ &= \mu \mathbb E[N]. \end{align*}

Note that in the third equality, I implicitly make use of the assumption that $N$ is independent of the $X_i$'s. Otherwise, this calculation is not valid.

However, if you'd like to see how to calculate $\mathbb E [ Y \vert N ]$, you can see my answer here.

• Thank you. And could you explain how to compute $\mathbb P\{Y\leq x\}$ ? and what is $\mathbb P\{Y\leq x\mid N\}$ ? – user352653 Jun 8 '18 at 12:40
• @user352653 $$\Pr (Y \le x) = \sum_{n\in \mathbb N} \Pr (Y \le x \vert N = n) \Pr(N=n).$$ Hence you only need to know how to calculate $\Pr (\sum_{i=1}^n X_i \le x)$. $\Pr(Y \le x \vert N)$ is interpreted the same way as $E[Y \vert N]$, and is also calculated in exactly the same way. See the answer I linked to above. Note that you really should have included these questions in your original questions, or possibly asked a new question to follow up. – Theoretical Economist Jun 8 '18 at 12:44
• @r.e.s. Yes, of course. Thank you. – Theoretical Economist Jun 8 '18 at 14:11