# Compute Var(x=X1+X2+...+Xn)

Compute $Var(X_1+X_2+...+X_n)$ given $X_1,X_2...$ are iid.,$EX=\mu,Var(X)=\sigma ^2$,and $Var(N)=\sigma [n]^2$,

N is a random variable of nonnegative integers independent with X,

and my solution is:

$Var(X_1+X_2+...+X_n)$

$=E(E((X_1+X_2+...+X_n)^2)-(E(X_1+X_2+...+X_n))^2)$

$=E(E(X_1^2+X_2^2+...+X_n^2)-(n\mu )^2)$

I've already proved $E(X_1+X_2+...+X_n)=n\mu$ and it's

$=E(E(X_1^2)+E(X_2^2)+...+E(X_n^2)-(nμ)^2)$

(And it is $E(X^2)=\mu^2+Var(X)=\mu ^2+\sigma ^2$)

$=E(n(\mu ^2+\sigma ^2)-(n\mu)^2)$

$=(\mu ^2+\sigma ^2)E(N)-\mu ^2*E(N^2)$

But the key given is $\sigma ^2*E(N)+\mu ^2*Var(N)$,I wonder if there is something wrong with my solution? Thanks for your help!

• Your answer would be right if $\mu^2 (E(N) - E(N^2))$ were $\mu^2 Var(N)$. Cancelling $\mu$ from both sides says that it'd be right if $$E(N) - E(N^2) = Var(N).$$ That's almost correct, isn't it? So does that lead you to an algebra error somewhere? Apr 26, 2015 at 3:09
– user228113
Apr 26, 2015 at 3:13
• What's $X$ and what role does the random variable $N$ play? (Yes, I can guess what you mean but that's not the point.) Stating all definitions and assumptions clearly at the beginning of the question, increases the readability of your question quite a lot.
– saz
Apr 26, 2015 at 6:51
• I suspect that not $\text{Var}(X_1+\cdots+X_n)$ but $\text{Var}(X_1+\cdots+X_N)$ must be calculated. Apr 26, 2015 at 13:49
• yes thanks Sassatelli, it's my first time on this site hh May 1, 2015 at 16:30

$\mathbb{E}\left(X_{1}+\cdots+X_{N}\mid N\right)=\mu N$ so that: $$\mathbb{E}\left(X_{1}+\cdots+X_{N}\right)=\mu\mathbb{E}N$$

$\mathbb{E}\left(\left(X_{1}+\cdots+X_{N}\right)^{2}\mid N\right)=\sigma^{2}N+\mu^{2}N^2$ so that: $$\mathbb{E}\left(X_{1}+\cdots+X_{N}\right)^{2}=\sigma^{2}\mathbb{E}N+\mu^{2}\mathbb{E}N^{2}$$

Working out:$$\text{Var}\left(X_{1}+\cdots+X_{N}\right)=\mathbb{E}\left(X_{1}+\cdots+X_{N}\right)^{2}-\left[\mathbb{E}\left(X_{1}+\cdots+X_{N}\right)\right]^{2}$$ we find: $$\text{Var}\left(X_{1}+\cdots+X_{N}\right)=\sigma^{2}\mathbb{E}N+\mu^{2}\mathbb{E}N^{2}-\mu^{2}\left[\mathbb{E}N\right]^{2}=\sigma^{2}\mathbb{E}N+\mu^{2}\text{Var}N$$

Edit:

$$\mathbb{E}\left(\left(X_{1}+\cdots+X_{N}\right)^{2}\mid N=n\right)=\mathbb{E}\left(X_{1}+\cdots+X_{n}\right)^{2}=$$$$\sum_{i=1}^{n}\sum_{j=1}^{n}\mathbb{E}X_{i}X_{j}=n\mathbb{E}X_{1}^{2}+n\left(n-1\right)\mathbb{E}X_{1}X_{2}$$

Here $\mathbb{E}X_{1}^{2}=\text{Var}X_{1}+\left(\mathbb{E}X_{1}\right)^{2}=\sigma^{2}+\mu^{2}$ and $\mathbb{E}X_{1}X_{2}=\mathbb{E}X_{1}\mathbb{E}X_{2}=\mu^{2}$.

This leads to: $$\mathbb{E}\left(\left(X_{1}+\cdots+X_{N}\right)^{2}\mid N=n\right)=n\left(\sigma^{2}+\mu^{2}\right)+n\left(n-1\right)\mu^{2}=n\sigma^{2}+n^{2}\mu^{2}$$

and consequently: $$\mathbb{E}\left(\left(X_{1}+\cdots+X_{N}\right)^{2}\mid N\right)=\sigma^{2}N+\mu^{2}N^{2}$$

• Thanks for your answer! But I can't figure out as X are iid, why E((X1+⋯+XN)^2∣N)=σ^2N+μ^2N^2 instead of just σ^2N? Thanks~ May 1, 2015 at 16:39
• See my edit. Btw, what makes you think that $E((X_1+\cdots+X_N)^2\mid N)=\sigma^2N$? May 1, 2015 at 21:06
• I'm sorry to make this elementary mistake...Thank you for your patient explanation! Wish buckets of love. May 4, 2015 at 16:14