Given the problem below:
The number of customers that shop at Elmo’s World of Food on a given day is geometrically distributed with parameter $p_1$. The number of items a customer buys at Elmo’s is geometrically distributed with parameter $p_2$. The distribution of the cost of each item is exponentially distributed with parameter $\lambda$. Assume that the amount customers buy and the amount of prices of items are independent. Let $X$ denote the total sales on a given day. Find the generating function of $X$.
In my attempt on solving this I let $N_c$ denote the number of customers that shop on a given fay, $N_i$ denote the number of items a customer buys, and $C$ cost of each item. Then we can write $X = \sum_{k=1}^{N_c} N_i\cdot C$. To find the generating function I used the MGF: $E[e^{tX}]$ and to compute it I conditioned on $N_c$ first and then on $C$. However, my work became very tedious and I'm stuck at simplifying the expression I got. Therefore, I was wondering if there is a different approach I could use in finding the generating function of $X$? This is just a practice problem as I study for my exam.
Answer: The moment generating function for the total sales/profits is $$ M_X(t) = \textbf{E}[e^{t X}] = \frac{\lambda p_1 p_2}{\lambda p_1 p_2 - t} \qquad \text{where} \qquad(\lambda p_1 p_2 > t).$$
Solution: To clarify the question a bit: $X$ is the total profit (i.e., total costs of all products purchased) on a given day and since $X$ is effectively a continuous random variable and "generating functions" are typically defined as a way to encode the coefficients of an infinite sequence, I'll assume you want to calculate the moment generating function for $X$.
In order to compute the moment generating function for $X$, we need to compute the probability density function (PDF) for $X$.
By the prompt, we know that the probability that $k$ customers enter the store is $(1-p_1)^{k-1}p_1$. The probability that a single one of those customers purchases $\ell$ items is $(1-p_2)^{\ell-1} p_2$. And the probability density for the cost of a single item is $\lambda e^{-\lambda x}$.
In order to find the PDF for $X$, we need to compute the probabilities for sums of random variables. In particular, the probability that $k$ people purchase a total of $m$ items and that the total cost of these $m$ items is $X$. We note two things
Thus the probability that $m$ items are bought by $k$ customers is $\binom{m-1}{k-1} p_2^k (1-p_2)^{m-k}$, and the PDF for the total costs (i.e., profits) from $m$ items is $\lambda^m X^{m-1} e^{-\lambda X}/(m-1)!$.
The PDF for $k$ customers visiting the store and purchasing a total of $m$ items which have a total cost of $X$ is then \begin{align}p(k, m, X) &= (1-p_1)^{k-1} p_1 \times\binom{m-1}{k-1} p_2^k (1-p_2)^{m-k}\times\frac{\lambda^m }{(m-1)!}X^{m-1} e^{-\lambda X}\\[.5em] & = \lambda p_1 p_2 \frac{\left(\lambda p_2(1-p_1) X\right)^{k-1}}{(k-1)!}\frac{\left(\lambda (1-p_2) X\right)^{m-k}}{(m-k)!} e^{-\lambda X}. \end{align} To find the PDF for the cost alone, we sum over all possible values of $m$ and $k$. We have \begin{align} \rho_{\text{cost}}(X) & = \sum_{k=1}^{\infty}\sum_{m=k}^{\infty}p(k, m, X)\\[.5em] & = \lambda p_1 p_2 \exp\left( \lambda p_2(1-p_1)X\right) \exp\left( \lambda(1-p_2) X\right) \exp(-\lambda X)\\[.5em] & = \lambda p_1 p_2 \exp(-\lambda p_1 p_2 X). \end{align} The moment generating function is then $$ M_X(t) = \textbf{E}[e^{t X}] = \lambda p_1 p_2 \int^{\infty}_{0} dX\, e^{tX - \lambda p_1 p_2 X} = \frac{\lambda p_1 p_2}{\lambda p_1 p_2 - t} \qquad (\lambda p_1 p_2 > t).$$
Random Note: The problem's stated conditions/assumptions seem odd. I would expect the number of people in a store and the number of items each person purchases to follow something more like a poisson distribution and binomial distribution, respectively, rather than geometric distributions. Geometric distributions characterize discrete survival processes which doesn't seem to well model whether people enter a store or how many items they buy.