Expected value of the function of a uniformly distributed random variable Let X by a uniformly distributed random variable on the interval [0,1]. Find $E[e^Y]$
I am trying to make use of the formula $$E[g(X)] = \int_{-\infty}^{\infty}g(x)xdx$$
so then $$E[e^X] = \int e^xxdx$$
What I am unsure of are the bounds of integration. Would they be from 0 to 1, which is the interval of Y, or would they be from $e^0$ to $e^1$? 
Additionally, we are also given that Y is a uniformly distributed variable on the interval [0,1] as well. Find $E[e^{Y-X}]$. Since they are independent, would it be the correct approach to first find $E[e^Y]$, then $E[e^{-X}]$, and multiply the two together?   Furthermore, apparently there is a much easier way to solve this problem without needing to do any integration, but I am having difficulty conceptualizing this method. Thoughts? 
 A: Your formula above is not quite correct. Suppose that $Z$ is any continuous random variable with density $f_Z(z)$. Then for a "nice enough" function $g$, we have 
$$
E[g(Z)] = \int_{-\infty}^{\infty} g(z) f_Z(z) dz.
$$
In the uniform case, the density of $X$ is
$$
f_X(x) = \begin{cases}
1 & 0 \leq x \leq 1 \\
0 & \text{ otherwise}
\end{cases}
$$
Letting $g(x) = e^x$, you get
$$
E[g(x)] = \int_{-\infty}^{\infty} g(x)f_X(x)dy = \int_{0}^1 e^x \cdot 1\, dx + \int_{-\infty}^{0} e^x \cdot 0\, dx + \int_1^{\infty} e^x \cdot 0\, dx\\ = \int_{0}^1 e^x \,dx.
$$
For your second question, $E[e^Ye^{-X}] = E[e^Y]E[e^{-X}]$ if $X$ and $Y$ are independent. Otherwise you will need to know their joint density.
A: First of all, the correct formula for $E[g(x)]=\int g(x) f(x) dx$, where $f(x)$ denotes the pdf of the distribution (so you expression is currently incorrect). The pdf for a uniform distribution is $f(x)=\frac{1}{b-a}$ for $a \leq x \leq b$.
Therefore, the intergral would then become:
$\int_{0}^{1} e^y \frac{1}{b-a} dy=\frac{1}{1-0} \int_{0}^{1}e^ydy=e^y]^{1}_{0}=e-1$
As for your second question, yes, that is correct.
