# How to compute the characteristic function of two random variables with different distributions?

What are the steps to obtain the following result:

Given that X have $\Gamma(1,s)$ distribution; and that X=x, and Y have the Poisson distribution with parameter x. Then the characteristic function of Y is: $\phi_Y(t) = E[E[e^{itY}|X]] = E[exp(X(e^{it} -1))]=(2-e^{it})^{-s}$?

I can't see how to use the definition of the characteristic function of each distribution to obtain the final result.

If $X\sim \textrm{Gamma}(s,1)\newcommand{\E}{\mathbb{E}}$, then its moment generating function is $$M_X(t)=\E\left[e^{tX}\right]=(1-t)^{-s} \, ,$$ for $t\in\mathbb{R}$.

If $Y\mid X=x\sim \mathrm{Poisson}(x)$, then $$\E\left[ e^{itY} \mid X=x \right]=\exp\left(x(e^{it}-1)\right) \, .$$

Hence, the random variable $\E\left[ e^{itY} \mid X \right]=\exp\left(X(e^{it}-1)\right)$ (a.s.).

Define $u=e^{it}-1$, and use the tower property to get

$$\phi_Y(t)=\E\left[e^{itY}\right]=\E\left[\E\left[e^{itY}\mid X\right]\right]=\E\left[\exp\left(X(e^{it}-1)\right)\right]$$

$$=\E\left[e^{uX}\right]=M_X(u) = (1-u)^{-s} = (2-e^{it})^{-s} \, ,$$ which is actually cheating, because $u$ is not a real number, but you can find a formal justification for the last steps of this computation.

P.S. If you're confused about the meaning of $\E\left[e^{itY}\mid X\right]$, take a look at this.