I am referring to the solution to Exercise 7.39(c) in the book Probability and Random Processes for Electrical and Computer Engineers, and find one step of derivation hard to understand. The problem is here:
Use the law of total probability to solve the following problems:
(c) Evaluate $\text{E}[Xe^Y]$ if $X \sim \text{uniform}[3, 7]$, and given $X = x$, $Y \sim N(0, x^2)$.
The solution is here:
Begin in the usual way by writing $$\begin{align} \text{E}[Xe^Y] &=\int_{-\infty}^{\infty}\text{E}[Xe^Y \mid X = x]f_{X}(x)\text{ d}x = \int_{-\infty}^{\infty}\text{E}[xe^Y \mid X = x]f_{X}(x)\text{ d}x \\ &= \int_{-\infty}^{\infty}x\text{E}[e^Y \mid X = x]f_{X}(x)\text{ d}x \end{align}$$ Now observe that $$\text{E}[e^Y \mid X = x] = \left.\text{E}[e^{sY} \mid X = x]\right|_{s=1}= \left.e^{s^2x^2/2}\right|_{s=1} = e^{x^2/2}\text{.}$$
Can someone tell me how the step $E[e^{sY}|X=x]|_{s=1} = e^{s^2x^2/2}|_{s=1}$ in part(c) is derived? Thanks a lot in advance!
Recall that the moment-generating function (MGF) of a random variable $Y$ is $\mathbb{E}[e^{tY}]$.
In this case, observe that the MGF of $Y \mid X = x$ is thus $\mathbb{E}[e^{tY} \mid X = x]$.
Recall also that if $Z \sim N(\mu, \sigma^2)$ that its MGF is given by $$M_{Z}(s) = \exp\left(\mu s+ \dfrac{\sigma^2}{2}s^2 \right)\text{.}$$ Thus, since $Y \mid (X = x) \sim N(0, x^2)$, $$\mathbb{E}[e^{sY} \mid X = x] = \exp\left(0s + \dfrac{x^2}{2}s^2 \right) = e^{s^2x^2/2}\text{.}$$