# Expectation of a function of a random variable

If X is a random variable distributed according to the f(x) as its probability density function then what is the expectation of g(x)?

We know that

$E[X] = \int_{-\infty}^{\infty} f(x) dx$

it is easy to show that

$E[g(X)] = \int_{-\infty}^{\infty} g(x).f(x) dx$

For example the expected value of Y= sin(X) if X~U(0,1) would be

$E[sin(X)] = \int_{0}^{1} sin(x) dx = -cos(1)+cos(0)$

Now the question is what is the

$E(e^X) if X \sim N(0,1)$

This is in fact the expected value for the log normal distribution and if you do the integration you will arrive at

$E(e^X) = e^{ \mu + \frac{1}{2}\sigma^2 }$