$X$ is $\text{Exp}(\lambda)$, $Y$ is $\text{Uniform}(0,X)$. How can I find $\Bbb E[Y]$ and $\text{Var}(Y)$? $X$ is $\text{Exp}(\lambda)$, $Y$ is $\text{Uniform}(0,X)$. How can I find $\Bbb E[Y]$ and $\text{Var}(Y)$?
I did tried to plug it like double integral of $\Bbb E[Y]$ from 0 to X which $f(t)$ is $\text{Exp}(\lambda)$.
But I could not solve it. Could anyone point or hint me? 
Thank you
 A: Lets use conditional expectation. Compute $$\mathbb{E}[Y] = \mathbb{E}[\mathbb{E}[Y|X]]$$
Now $\mathbb{E}[Y|X]$ is the mean of a uniform [0,X] which is $X/2$.
Thus $$\mathbb{E}[Y] = \mathbb{E}[X/2]= \frac{1}{2\lambda}$$
Similarly you can get the variance by working with 
$$\mathbb{E}[Y^2] = \mathbb{E}[\mathbb{E}[Y^2|X]]$$
A: First we see that for $x\geq 0$ we have
$$
E[Y\mid X=x]=\frac{x}{2}
$$
and so
$$
E[Y\mid X]=\frac{X}{2}.
$$
Now use that 
$$
E[Y]=E[E[Y\mid X]].
$$
For the variance you can use a similar argument using this.
A: For finding the variance of $Y$, you can use the total variance formula which gives
$$\begin{align*}
\text{var}(Y) &= E[\text{var}(Y\mid X)] + \text{var}(E[Y\mid X])\\
&= E\left[\frac{X^2}{12}\right] + \text{var}\left(\frac{X}{2}\right)
\end{align*}$$
Edit Note to OP: I just noticed that Stefan Hansen's answer already pointed out 
the total variance formula to you, but the second line above adds a
little detail to get you further along the way.
A: Here's a hint:
http://en.wikipedia.org/wiki/Law_of_total_expectation
Use the conditional distribution of $Y$ if $X$ is known.
