Distribution question (i) Let $X\mid Y \sim \text{Poisson}(Y)$, and $Y \sim \text{Exp}(\lambda)$. Find the distribution of $X$.
(ii) Let $X\mid Y \sim \text{Poisson}(Y)$, and $Y \sim \text{Poisson}(\mu)$. Show that $G_{X+Y}(s) = \text{Exp}(\mu(se^{s-1}-1).$
I'm doing past exam paper questions and can't seem to find anything in my notes to explain how to do these types of questions or any examples. Would someone mind doing a step-by-step for dummies? Help is much appreciated!
 A: Given that $Y$ has value $3.2$, say, the conditional probability that $X$ has value $k$ where $k \geq 0$ is 
$$P\{X = k \mid Y = 3.2\} = \exp(-3.2) \frac{(3.2)^k}{k!}.$$
More generally, given that $Y$ has value $y$, 
the conditional probability that $X$ has value $k \geq 0$ is 
$$P\{X = k \mid Y = y\} = \exp(-y) \frac{(y)^k}{k!}.$$
That is what is meant when you are told that $X\mid Y \sim \text{Poisson}(Y)$:
given that $Y=y$, $X$ is a Poisson random variable with parameter $y$.
You are now asked, "What is the unconditional probability that $X$ has value $k$?"
This a law of total probability calculation which, for the case when 
the conditioning variable is continuous (as
$Y$ in this instance since you are told
it is an $\text{Exponential}$ random variable), says  that
$$P\{X = k\} = \int_{-\infty}^{\infty} P\{X = k \mid Y = y\}f_Y(y)\,\mathrm dy
= \int_0^{\infty}\exp(-y) \frac{(y)^k}{k!}\cdot\lambda \exp(-\lambda y)
\,\mathrm dy.$$
So, evaluate this integral: you will need to make a change of variable
and either remember or look up the definition of the Gamma function,
or integrate by parts $k$ times.
A: For both questions, since conditional distributions given $Y$ are known, use the law of total probability or the law of total expectation, conditioning on $Y$.
Here's the first one:
$$
\Pr(X=x) = E(\Pr(X=x\mid Y)) = E\left( \frac{Y^x e^{-Y}}{x!} \right) = \int_0^\infty \frac{y^x e^{-y}}{x!} e^{-\lambda y}\left(\lambda\,dy\right)
$$
$$
= \frac{\lambda}{x!} \int_0^\infty y^x e^{-(1+\lambda)y} \, dy
= \frac{\lambda}{x!(1+\lambda)^{x+1}} \int_0^\infty ((1+\lambda)y)^x e^{-(1+\lambda)y} \, \left( (1+\lambda)\,dy \right)
$$
$$
= \frac{\lambda}{x!(1+\lambda)} \int_0^\infty u^x e^{-u}\, du = \frac{\lambda}{(1+\lambda)^{x+1}}.
$$
So this is a geometric distribution supported on the set $\{0,1,2,3,\ldots\}$.
Here's the other one:
$$
G_{X+Y}(s) = E(s^{X+Y}) = E(E(s^{X+Y}\mid Y)) = E(s^Y E(s^X\mid Y)) = E(s^Y(e^{Y(s-1)}))
$$
$$
= E((se^{s-1})^Y) = G_Y(se^{s-1}) = \cdots
$$
