# Expected value of normally distributed variable at $e^{\theta x}$

I need help in working out some equations regarding the expected value.

The question is:

Let $X$ be a normally distributed random variable with mean $\mu$ and variance $\sigma^2$. Show that:

$E[e^{\theta X } ]= e^{\theta \mu + \sigma^2 \theta^2 /2}$

So far, I've tried to solve this by working with the definition of the expected value (the integral), and I've tried to work backwards from the solution. At the end, I end up with the following equation i am simply not able to show:

$$\int_{-\infty}^\infty e^{\theta x} \frac 1 { \sqrt{2\sigma^2 \pi}} e^{-0,5(x-\mu)^2/\sigma^2} \, dx = \int_{-\infty}^\infty \frac 1 {\sqrt{2\sigma^2 \pi}}e^{-0,5(x-\mu-\theta \sigma^2)^2/\sigma^2 }{e^{\mu \theta +0.5 \theta^2 \sigma^2}} \, dx$$

• Do you know how to find $\chi(\theta) = \operatorname{E}(e^{\theta Z})$ where $Z\sim N(0,1)\text{?}$ If so, then my answer below shows you how to do the rest without mentioning integrals explicitly. $\qquad$ – Michael Hardy Dec 8 '16 at 20:32
• Slightly frightening how users so far avoided to deal with your exact question. So, you are asking why $$\theta x-0,5(x-\mu)^2/\sigma^2=-0,5(x-\mu-\theta \sigma^2)^2/\sigma^2 +\mu \theta +0.5 \theta^2 \sigma^2,$$ right? This is equivalent to $$2\sigma^2\theta x-(x-\mu)^2=-(x-\mu-\theta \sigma^2)^2 +2\sigma^2\mu \theta + \theta^2 \sigma^4,$$ right? But $$-(x-\mu-\theta \sigma^2)^2 =-(x-\mu)^2+2\theta \sigma^2(x-\mu)-\theta^2 \sigma^4,$$ right? So... – Did Dec 8 '16 at 20:41

If $X\sim N(\mu,\sigma^2)$ then $Z= \dfrac{X-\mu}\sigma\sim N(0,1)$ and $X=\mu+\sigma Z$, so we can say $$\operatorname{E}(e^{\theta X}) = \operatorname{E}(e^{\theta(\mu+\sigma Z)}) = \operatorname{E}(e^{\theta\mu} e^{\theta\sigma Z}).$$ In the last expression, the factor $e^{\theta\mu}$ is not random; therefore it can be pulled out, getting $$e^{\theta\mu} \operatorname{E} (e^{\theta\sigma Z}).$$ Let $\chi(\theta) = \operatorname{E}(e^{\theta Z}).$ Then we have $$e^{\theta\mu} \operatorname{E}(e^{\theta\sigma Z}) = e^{\theta\mu} \chi(\theta\sigma).$$ So if you can find $\chi(\theta) = \operatorname{E}(e^{\theta Z}),$ then you can just put $\theta\sigma$ where $\theta$ was, getting $\chi(\theta\sigma),$ and then multiply it by $e^{\theta\mu}.$
Now let's find $\chi(\theta) = \operatorname{E}(e^{\theta Z}).$ Let $\varphi(z) = \dfrac 1 {\sqrt{2\pi}} e^{-z^2/2}.$
\begin{align} \chi(\theta) = \operatorname{E}(e^{\theta Z}) & = \int_{-\infty}^\infty e^{\theta z} \varphi(z)\,dz = \int_{-\infty}^\infty e^{\theta z} \frac 1 {\sqrt{2\pi}} e^{-z^2/2} \, dz \\[10pt] & = \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty \exp \left( -\frac{z^2} 2 + \theta z \right) \, dz \\[10pt] & = \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty \exp \left( -\frac 1 2 \left( z^2 + 2\theta z \right) \right) \, dz \\[4pt] & \qquad \text{This begs for completing the square:} \\[10pt] & = \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty \exp \left( -\frac 1 2 \left( z^2 + 2\theta z + \theta^2 \right) \right) \cdot \exp\left( +\frac 1 2 \theta^2 \right) \, dz \\[6pt] & \qquad \text{The factor } \exp\left(+\frac 1 2 \theta^2\right) \text{ does not depend on } z, \\ & \qquad \text{so it can be pulled out of the integral}: \\[10pt] & = \exp \left( \frac 1 2 \theta^2\right) \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty \exp\left( -\frac 1 2 (z+\theta)^2 \right) \,dz \\[10pt] & = \exp\left( \frac 1 2 \theta^2\right) \cdot 1. \end{align} We get $1$ because, via the substitution that says $u = z+\theta$ and $du = dz$, we see that we have $$\frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty e^{-u^2/2} \,du = 1.$$