30

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?

Jim Raynor
  • 403
  • 1
  • 4
  • 6
  • 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'. – Jim Raynor Jul 28 '12 at 16:10
  • That's not another solution. Finding the characteristic function is really the same as the question you've posted above. – Michael Hardy Jul 29 '12 at 01:25

4 Answers4

32

$\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.

Michael Hardy
  • 1
  • 30
  • 276
  • 565
6

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.

Sangchul Lee
  • 141,630
  • 16
  • 242
  • 385
  • 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. – Jim Raynor Jul 28 '12 at 15:57
  • 1
    +1. I seem to remember an [MSE page](http://math.stackexchange.com/questions/30938/given-the-pdf-of-independent-rvs-i-and-r-how-to-find-cdf-of-w-i2r/30966#30966) explaining this. – Did Jul 28 '12 at 16:03
  • @JimRaynor : You should write $E[f(X)]=\int_{-\infty}^{\infty} f(x) p(x) \ dx$ rather than $E[f(x)]=\int_{-\infty}^{\infty} f(x) p(x) \ dx. \qquad$ – Michael Hardy Sep 04 '20 at 23:35
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.

André Nicolas
  • 491,093
  • 43
  • 517
  • 948
  • 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? – Jim Raynor Jul 28 '12 at 15:59
  • 1
    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. – André Nicolas Jul 28 '12 at 16:09
3

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}$$

amWhy
  • 204,278
  • 154
  • 264
  • 488
Hamed MSN
  • 31
  • 1