# $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

-
Do you mean E[Y] and Var[Y] – Gautam Shenoy Feb 15 '13 at 11:05
Yes, I'm sorry. – Zeal Chaiwut Feb 15 '13 at 11:15

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]]$$

-
I do not know about this $E[Y] = E[E[Y|X]]$ before. Thank you for your answer. I will try to solve the variance by myself. – Zeal Chaiwut Feb 15 '13 at 11:41
It's called the law of iterated expectation. Was this not covered? Any other way would be laborious. – Gautam Shenoy Feb 15 '13 at 11:41

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.

-

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.

-
I did it by finding $E[E[X^2]]$ based on Gautam Shenoy hints. Then find $$Var(Y) = E[Y^2] - E[Y]^2$$ By the way, thank you for your solution. – Zeal Chaiwut Feb 17 '13 at 22:02

Here's a hint: http://en.wikipedia.org/wiki/Law_of_total_expectation

Use the conditional distribution of $Y$ if $X$ is known.

-
That is a good hint but unfortunately I already saw other post. Thank you. – Zeal Chaiwut Feb 15 '13 at 11:42