variance of sum of independent random variables where $N$ is a random variable Let be $S$ a r.v. define as $S=\sum_{i=1}^N X_i$, where:   $-$ $X_i$ has mean $\mu_x$ and variance $\sigma_x^2$;  $-$ $N \sim Poisson(\lambda)$; $-$ $X_i$ are i.i.d. and $X_i$ and $N$ are independent.
I've found a topic where is shown that $E[S]=E[N]E[X_j]$; but what about $var(S)$?
Could be $var(S)=var(\sum_{i=1}^N X_i)prob(N=n)=\sum_{i=1}^N var(X_i)prob(N=n)=Nprob(N=n)var(X_i)=n(\frac{\lambda^n}{n!})\sigma_x^2=\frac{\lambda^n}{n-1!}\sigma_x^2$?
Thanks for your help.
KB
 A: In this situation one can show that $V(S) = E(N)V(X) + V(N)[E(X)]^2.$
One proof of this uses a conditioning argument. Proofs are shown
in many beginning and intermediate level probability texts (perhaps including yours). 
So in your case $V(S) = \lambda\sigma_x^2 + \lambda\mu_x^2.$
Here is a simulation in R for a million repetitions of such an
experiment, where $\lambda = 10$ and 
$X_j \sim Norm(\mu = 100, \sigma=15)$. In this case, we
should have $E(S) = 10(100) = 100$ and 
$V(S) = 10(225) + 10(10000) = 102250$ or $SD(S) = 319.7655.$
I chose these values of the parameters to illustrate the
importance of the second term in the expression for the variance.
The simulation is accurate to about the nearest integer.
 m = 10^6;  s = numeric(m)
 for (i in 1:m) {
    n = rpois(1, 10)
    s[i] = sum(rnorm(n, 100, 15)) }
 mean(s);  sd(s)
 ## 999.7464
 ## 319.9339

The histogram of simulated values of $S$ shows a skewed distribution.
(A sum of a fixed number $n=10$ of these iid normal terms would, of
course, be normal--and with much smaller variance.)

