Consider the sum, where $N$ is a random variable that takes nonnegative integer values, and $X_1, X_2, …, X_n$ are identically distributed random variables. Assume that $N, X_1, X_2, …, X_n$ are independent.
$$Y = X_1, X_2, …, X_N$$
Then
$$E[Y] = E[N] E[X] $$
$$\var{Y} = E[N] \var{X} + (E[X])^2 \var{N} $$
</span>
</span>
<span class="proof__expand"><a>[expand]</a></span>
</span>
</span>
<span class="proof__expand"><a>[expand]</a></span>
Let $X_1, X_2, …, X_n$
We let $N$ be geometrically distributed with parameter $p$. We also let each random variable $X_i$ be geometrically distributed with parameter $q$. We assume that all of these random variables are independent. Let $Y = X_1, X_2, …, X_n$. We have
$$M_N(s) = \frac{ p e^s }{ 1 - (1 - p) e^s }, M_X(s) = \frac{ q e^s }{ 1 - (1 - q) e^s }$$
To determine $M_Y(s)$, we start with the formula for $M_N(s)$ and replace each occurrence of $e^s$ with $M_X(s)$. This yields
$$M_Y(s) = \frac{ p M_X(s)}{ 1 - (1 - p) M_X(s)} $$
and, after some algebra,
$$M_Y(s) = \frac{ pq e^s }{ 1 - (1 - pq) e^s } $$
We conclude that $Y $ is geometrically distributed, with parameter $pq$.