Joint probability of sum of $n$ random variables with exponential distribution Regards. I would like to ask some view on this.
If it is known that random variables $X_{i}$, $i=1,2,..,$ are independent and each has exponential distribution with mean $\theta$. The sum of the random variables $X= X{1} + X_{2} + .... + X_{n} $, has gamma distribution :
$$ f(x) = \frac{x^{n-1} e^{-x/\theta}}{(n-1)! \: \theta^{n}} $$
Now if the number of summation $n$ has Poisson distribution with df $g(n)$ and mean $\mu=1$, and $N$ and all the $X_{i}$'s are independent of each other , i would write the pdf of the random variable $S= X_{1} + X_{2} + ..... + X_{N}$ as below :
\begin{align*} P(S=x) &= \sum_{n} f_{n}(x) \times g(n) \\ &=
\sum_{n} \frac{x^{n-1} e^{-x/\theta}}{(n-1)! \: \theta^{n}}  \times \frac{e^{-1}}{n!} \\
&= e^{-x/\theta}( x \: e)^{-1} \sum_{n} \frac{(x/ \theta)^{n}}{(n-1)!  \: n!}
 \end{align*}
The form in the summation does not have exact form, according to The sum of power series with denominators $n!(n+1)!$
This is to calculate the mgf of $S$. Without paying attention the simplest form of the sum, i integrate by mgf wrt $x$ and calculate $M_{S}(1)=3$, and found value of $\theta$ does not fit with a reference.
Does this probability distribution incorrect?
*($M_{S}(1)$ does refer to mgf at point $1$ right?)
Thanks.
 A: If $N$, the number of exponential random variables in the sum, is independent of the sequence of random variables $\{X_i\}$ and is Poisson distributed then
$$
S = \sum_{n = 1}^N X_n
$$
is called a compound Poisson distributed random variable.
Calculating the distribution function or the density function of such random variable can be quite nasty. Fortunately you can avoid that if you are looking for the moment generating function!
Here is a hint: to calculate the moment generating function of $S$, use the independence in a towering argument. That is, 
$$
M_S(x) = E\left[e^{xS}\right] = E\left[e^{x\sum_{n = 1}^N X_i}\right]
=
E\Bigl[E\left[
e^{xNX_1}
\mid N \right]\Bigr]
=
E\left[E\left[e^{xX_1}
\right]^N\right]
$$
Can you take it from here?
A: This is what I found, noting $F_n$ the cumulative distribution function of $S_n=X_1+\dots+X_n$ :
\begin{align*}
  P(S\le x) &= \sum_{n\in\mathbb N^\ast} P(S\le x \cap N=n) \\
            &= \sum_{n\in\mathbb N^\ast} F_n(x)P(N=n) \\
            &= \frac1e\sum_{n\in\mathbb N^\ast} \frac{1}{n!} \int_0^x
                  f_n(t)\,dt \\
            &= \frac1e\sum_{n\in\mathbb N^\ast} \frac{1}{(n-1)!n!\theta^n}
                  \int_0^x t^{n-1}e^{-t/\theta}\,dt 
\end{align*}
Now you have to compute the integral. By induction, I found :
$$\int_0^x t^{n-1}e^{-t/\theta}\,dt = (n-1)!\theta^n\left[ 1-e^{-x/\theta} \sum_{k=1}^{n-1} \frac{(x/\theta)^k}{k!}\right]$$
So
$$P(S\le x) = \frac1e\sum_{n\in\mathbb N^\ast} \frac{1}{n!}\left[ 1-e^{-x/\theta} \sum_{k=1}^{n-1} \frac{(x/\theta)^k}{k!}\right]$$
Now I differentiate wrt $x$, obtaining the density function of $S_N$ :
$$f(x)=\frac1e\sum_{n\in\mathbb N^\ast} \frac{e^{-x/\theta}}{n!\,\theta} \left[\frac{(x/\theta)^{n-1}}{(n-1)!}-1\right]$$
I'm quite sure there must be about a dozen mistakes in my computations, but it may be a good basis for the right solution :-)
