Calculate the expected value of $Y=e^X$ where $X \sim N(\mu, \sigma^2)$
Solution 1:
$\newcommand{\E}{\operatorname{E}}$
Look at this: Law of the unconscious statistician.
If $f$ is the density function of the distribution of a random variable $X$, then $$ \E(g(X)) = \int_{-\infty}^\infty g(x)f(x)\,dx, $$ and there's no need to find the probability distribution, including the density, of the random variable $g(X)$.
Now let $X=\mu+\sigma Z$ where $Z$ is a standard normal, i.e. $\E(Z)=0$ and $\operatorname{var}(Z)=1$.
Then you get $$ \begin{align} \E(e^X) & =\E(e^{\mu+\sigma Z}) = \int_{-\infty}^\infty e^{\mu+\sigma z} \varphi(z)\,dz \\[10pt] & = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty e^{\mu+\sigma z} e^{-z^2/2}\,dz = \frac{1}{\sqrt{2\pi}} e^\mu \int_{-\infty}^\infty e^{\sigma z} e^{-z^2/2}\,dz. \end{align} $$
We have $\sigma z-\dfrac{z^2}{2}$ so of course we complete the square: $$ \frac 1 2 (z^2 - 2\sigma z) = \frac 1 2 ( z^2 - 2\sigma z + \sigma^2) - \frac 1 2 \sigma^2 = \frac 1 2 (z-\sigma)^2 - \frac 1 2 \sigma^2. $$ Then the integral is $$ \frac{1}{\sqrt{2\pi}} e^{\mu+ \sigma^2/2} \int_{-\infty}^\infty e^{-(z-\sigma)^2/2}\,dz $$ This whole thing is $$ e^{\mu + \sigma^2/2}. $$ In other words, the integral with $z-\sigma$ is the same as that with just $z$ in that place, because the function is merely moved over by a distance $\sigma$. If you like, you can say $w=z+\sigma$ and $dw=dz$, and as $z$ goes from $-\infty$ to $+\infty$, so does $w$, so you get the same integral after this substitution.
Solution 2:
Let $X$ be an $\mathbb{R}$-valued random variable with the probability density function $p(x)$, and $f(x)$ be a nice function. Then $$\mathbb{E}f(X) = \int_{-\infty}^{\infty} f(x) p(x) \; dx.$$ In this case, we have $$ p(x) = \frac{1}{\sqrt{2\pi}\sigma}e^{-\frac{(x-\mu)^2}{2\sigma^2}},$$ hence $$ \mathbb{E}e^X = \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} e^x e^{-\frac{(x-\mu)^2}{2\sigma^2}} \; dx. $$ Now the rest is clear.
Solution 3:
A start: We want $$\int_{-\infty}^\infty e^x f(x)\,dx,$$ where $f$ is the density function of your normal. But $$\exp(x)\exp\left(--\frac{(x-\mu)^2}{2\sigma}\right)=\exp\left({-\frac{(x-\mu)^2}{2\sigma^2}+x}\right).$$ Look at the quadratic expression $-\frac{(x-\mu)^2}{2\sigma^2}+x$ and complete the square. Then the rest of the integration will be straightforward, since you know $\int_{-\infty}^\infty e^{-t^2/2}\,dt$.
Remark: After you have done the integration, you might want to look up the moment generating function of your normal. You want the value of the mgf at $t=1$. This will give you a check on whether your computation was correct.