# Expected value of $e^{X}$

I am trying to find the expected value of $Y=e^{X}$ where the density of $X$ is $f(x) = 2x$ for $0<x<1$ (zero elsewhere). According to my textbook, the answer should be $2$.

I get the correct answer but I am a bit uncertain whether I am doing it the right way? So

$$E(Y) = \int_{0}^{1}g(x)f(x)dx = \int_{0}^{1}e^{x}\cdot2x\ dx = 2\int_{0}^{1} xe^{x}dx$$

and then I continue with selecting

$$u = x \quad \text{and} \quad dv = e^{x}$$

which results in $$du = dx \quad \text{and} \quad v = e^{x}.$$

Hence, one gets $$2\Big(\Big(xe^{x}\Big)_{0}^{1} - \int_{0}^{1}e^{x}dx\Big) = 2\Big(e - (e-1)\Big) = 2.$$

Is this the easiest solution? Am I doing it correctly?

• This should be the easiest way to do it analytically. Alternatively, if you know that $E(X) = 1$ for $X \sim \exp(1)$, then you may link this integration with $E(X)$. Commented Dec 8, 2015 at 16:16
• @Solitary Huh? How is knowledge that the expectation of a standard exponential random variable has value $1$ related to the calculation that the OP needs to do (and has done correctly)? Commented Dec 8, 2015 at 16:22
• Oh, sorry, I overlooked, it's $e^x$, not $e^{-x}$... Anyway, I confirmed he is right. Commented Dec 8, 2015 at 16:24

• @Glen_b, There really is nothing to be answered here except to say that what's been shown is right. Leaving the question unanswered means it will be thrown up repeatedly by Community as an unanswered question that deserves another look. So I answered it and marked my answer as community wiki so that I don't get reputation points for the answer. I notice that Moderator @Scortchi has expressed an opposite viewpoint in his answer to your question on meta and I am pinging him so that he can delete the answer above and convert it into a comment if he so wishes. Commented Dec 9, 2015 at 4:05