# How to calculate expectation of random variable?

Let $$\{X_1, X_2, X_3,\ldots \}$$ be a sequence of random variables with mean of $$1$$.   If $$N$$ is a geometric random variable with probability mass function:- $$\mathsf P(N=k) ~=~ \frac 1{2^k} ~ \big[k\in \{1,2,3,\ldots\}\big]$$ > ... and it is independent of all $$X_k$$, then what is ?:- $$\mathsf E(X_1+X_2+X_3+\cdots+X_N)$$

I know that $$E[aX+bY]=a E[X]+b E[Y]$$

Also I know that $$\sum_{n = 1}^\infty \frac{1}{2^n}=1.$$

So $$E[X_1+X_2+...+X_N]=E[X_1]+E[X_2]+...+E[X_N]=\sum_{n = 1}^N\frac{1}{2^n}$$

As limit n-> $$\inf$$ above term becomes one.

Am I correct ?
Thanks

• I don't understand the question: is $\;N\;$ a random variable that also indexes in $\;X_1+\ldots+ X_N\; ?$ Feb 15, 2016 at 10:39
• Your answer, and more importantly the way you achieved it is not correct. Note that the LHS is a number and the RHS is a random variable. Feb 15, 2016 at 10:53
• @Joanpemo Yeah, the random variable $S$ of interest is defined as $$S(\omega)=\sum_{k=1}^{N(\omega)}X_k(\omega).$$
– Did
Feb 15, 2016 at 10:53
• Thank you @did. I see this is way over my actual knowledge of probability. Feb 15, 2016 at 10:58

Theorem If $X_1,X_2...$ are r.v.i.i.d. with $E[X_i]=\mu<\infty$ and $N$ is a random variable with $E[N]<\infty$ independent respect to $X_i$, then $E[X_1+...+X_N]=\mu E[N]$

Proof

$\begin{eqnarray} E[X_1+...+X_N]&=&E[E[X_1+...+X_N|N]]\\ &=&\sum_{n=0}^\infty P(N=n)E[X_1+...+X_N|N=n]\\ &=&\sum_{n=0}^\infty P(N=n)E[X_1+...+X_n|N=n]\\ &=&\sum_{n=0}^\infty P(N=n)E[X_1+...+X_n]\\ &=&\sum_{n=0}^\infty P(N=n)n\mu\\ &=&\mu\sum_{n=0}^\infty nP(N=n)\\ &=&\mu E[N] \end{eqnarray}$

• $\mathbb E\sum_{i=1}^NX_i=\mathbb E(\sum_{i=1}^NX_i\mid N=n)P(N=n)$
• $\mathbb E(\sum_{i=1}^NX_i\mid N=n)=\mathbb E(\sum_{i=1}^nX_i\mid N=n)=\sum_{i=1}^n\mathbb E(X_i\mid N=n)$
• $N$ and $X_i$ are independent.