I am reading S. Shreve's introduction to Stochastic Calculus. Exercise 1.6. (p. 43) should be a simple exercise, but I don't know how to continue.
Let $u$ be a fixed number in $\mathbb{R}$ and $X$ a normal random variable with density
$$f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}.$$
I would like to show that $\mathbb{E}e^{uX}=e^{u\mu + 0.5u^2\sigma^2}$.
Since the density function is given, I can calculate
$$\mathbb{E}e^{uX}=\int_{-\infty}^\infty e^{ux}f(x)dx=\frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^\infty e^{-\frac{(x-\mu)^2-2\sigma^2ux}{2\sigma^2}}dx.$$
But I don't see how to solve this integral.
What I have tried so far:
- find the antiderivative
- find a change of variables to change this integral back to a normal distribution.
- do I have to use Fubini's theorem and solve this slice by slice? Didn't manage to do this.
Could you please give me a hint on how to continue?
Edit: the main step is to complete the square inside the integral:
$\exp(-\frac{x^2-2x\mu -2\sigma^2 ux-\mu^2}{2\sigma^2})$
$=\exp (-\frac{(x-(\mu -\sigma^2u))^2}{2\sigma^2}) \cdot\exp(\frac{\mu^2-(\mu-\sigma^2u)^2}{2\sigma^2})$
The integral of the first exponent is 1 and the second exp gives the solution.
Hint: Complete the square in the exponent and do a change of variables.