I’m struggling with this question and I’d like it if you can show me how to solve questions like this one.
Given: $$f_{X}(x) = \begin{cases} 2x & 0<x<1 \\ 0 & \text{otherwise} \end{cases}$$ also note that for X, $Y \sim \textsf{U}_{[0,X]}$.
Find $E(X|Y=\tfrac14)$.
My attempt:
I first know that $$Y|X \sim \textsf{U}_{[0,X]} \implies f_{Y|X}(y|x) = \frac{1}{x} \quad (0<y<x<1)$$
from here I wanted to find $f_{X|Y}(x|y)$. To do that I needed $f_Y(y)$ and I could integrate $f_{X,Y}(x,y)$ to find it
$$f_{X|Y}(x|y) = \frac{f_{Y|X}(y|x) \cdot f_X(x)}{f_Y(y)} =\frac{ \frac1x \cdot 2x}{\int f_{Y|X}(y|x) \cdot f_{X}(x) dx} = \frac{2}{\int_{0}^1 2 dx } = 1 $$
So now hypothetically (for $y=\tfrac14$ I think the lower integration limit should be 0.25 since $Y \sim \textsf{U}_{[0,X]} $) $$E(X|Y=\tfrac14) = \int_{x \in \mathbb{R}} x \cdot 1 = \frac{x^2}{2} \Bigg|^1_{0.25} = \frac12 - \frac1{32} = \frac{15}{32} $$
The actual solution is $ \frac{5}{8}$ - I don’t see what’s wrong with my solution and I don’t know how to solve the problem correctly.
Actually you already figure out the support of $Y|X = x$ to be $(0, x)$.
And the support of $(X, Y)$ is also $0 < y < x < 1$, i.e.
$$ f_{X,Y}(x,y) = 2, 0 < y < x < 1$$
which means $(X, Y)$ is uniformly distributed over a triangle.
So when we integrate for the marginal pdf of $Y$, we have
$$ f_Y(y) = \int_{-\infty}^{+\infty} f_{X,Y}(x,y)dx = \int_y^1 2 dx = 2(1 - y), 0 < y < 1$$
This is the place where you put down the incorrect integration limit.
The conditional pdf also need to have the constraint:
$$ f_{X|Y}(x|y) = \frac {2} {2(1 - y)} = \frac {1} {1 - y}, x \in (y, 1)$$
Or equivalently, $X|Y = y \sim \text{Uniform}(y, 1)$ as expected.
As a result, $$E\left[X\Bigg|Y = \frac {1} {4}\right] = \frac {1} {2}\left(1 + \frac {1} {4}\right) = \frac {5} {8}$$
which agree with the listed answer.