I got a problem of calculating $E[e^X]$, where X follows a normal distribution $N(\mu, \sigma^2)$ of mean $\mu$ and standard deviation $\sigma$.

I still got no clue how to solve it. Assume $Y=e^X$. Trying to calculate this value directly by substitution $f(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\, e^{\frac{-(x-\mu)^2}{2\sigma^2}}$ then find $g(y)$ of $Y$ is a nightmare (and I don't know how to calculate this integral to be honest).

Another way is to find the inverse function. Assume $Y=\phi(X)$, if $\phi$ is differentiable, monotonic, and have inverse function $X=\psi(Y)$ then $g(y)$ (PDF of random variable $Y$) is as follows: $g(y)=f[\psi(y)]|\psi'(y)|$.

I think we don't need to find PDF of $Y$ explicitly to find $E[Y]$. This seems to be a classic problem. Anyone can help?

  • $\begingroup$ After searching for a while I've found another solution to this problem, which is using characteristic function $\varphi_X(t) = \operatorname{E}[\,e^{itX}\,]=E[cos(tX)]+iE[sin(tX)]$. With X follows normal distribution, it's known that $\varphi_X(t) = \exp{i\mu t -\frac \sigma^2 t^2 2}$. In this case, just replace $t=-i$ to the characteristic function. However, calculating step by step as suggested below is 'better'. $\endgroup$ – Jim Raynor Jul 28 '12 at 16:10
  • $\begingroup$ That's not another solution. Finding the characteristic function is really the same as the question you've posted above. $\endgroup$ – Michael Hardy Jul 29 '12 at 1:25


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 distribution 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 \left( z^2 - 2\sigma z \right) = \frac 1 2 \left( z^2 - 2\sigma z + \sigma^2\right) - \frac 1 2 \sigma^2 = \frac 1 2 \left( z-\sigma \right)^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.


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.

  • $\begingroup$ Oh I must have forgot that if $Y=f(X)$ then $E[Y]=E[f(x)]=\int_{-\infty}^{\infty} f(x) p(x) \ dx$. Thank you. $\endgroup$ – Jim Raynor Jul 28 '12 at 15:57
  • 1
    $\begingroup$ +1. I seem to remember an MSE page explaining this. $\endgroup$ – Did Jul 28 '12 at 16:03

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.

  • $\begingroup$ Thanks. This answer together with sos404's one make the problem seems more "solvable" to me :P And $\int_{-\infty}^\infty e^{-t^2/2}\ dt$ should be Gaussian integral, equals to $\sqrt\pi$, right? $\endgroup$ – Jim Raynor Jul 28 '12 at 15:59
  • 1
    $\begingroup$ More or less. Actually it is $\sqrt{2\pi}$. I was using $e^{-t^2/2}$. But if you make a slightly different substitution, you will end up with the Gaussian integral. $\endgroup$ – André Nicolas Jul 28 '12 at 16:09

Since mgf of $X$ is $\;M_x(t)=e^{\large\mu t + \sigma^2 t^2/2}$

$$E[Y]=E[e^X]=M_x(1)=e^{\large\mu + \sigma^2/2}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.