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?