Suppose $Y$ is uniformly distributed on $(0,1)$ and that thet conditional distribution of $X$ given that $Y=y$ is uniform on $(0,y)$ Find $E(X)$ and $Var(X)$
My attempt : We have $Y \sim$ Unif$(0,1) $ and $f_{X|Y}(x,y) = \frac{1}{y}$
Thus $$E(X)=E(E(X|Y))$$ $$= E(\int_{0}^{\infty}xf_{X|Y}(x,y) dx) $$ $$= E(\int_{0}^{\infty}\frac{x}{y}dx)$$
I am sure I am making mistake here. Can you help ?
You have written your conditional density incorrectly. It should be $f_{X\mid Y}(x,y) = \frac1y \mathbb 1_{[0,y]}$, i.e. it is $\frac1y$ on $[0,y]$ and $0$ outside. Then,
$$\begin{align} E[X] &= E[E[X\mid Y]]\\ &=E\left[\int_0^\infty xf_{X\mid Y}(x,y) dx\right]\\ &=\int_0^1\left[\int_0^y \frac{x}{y} dx\right]dy\\ &=\int_0^1\frac y2dy\\ &=\frac14 \end{align} $$
You can find the variance similarly.