Let X be a uniformly distributed over $[0,2]$, and $Y$ to take values from $[0,\infty]$, how do we compute $E\left[X\,\middle|\,X \leq \dfrac{Y}{2}\right]$.
My attempt: $$ E\left[X\,\middle|\, X \leq \dfrac{Y}{2}\right]= \int_0^2 X\,f\left(x\,\middle|\,x \leq \dfrac{y}{2}\right) $$ I am stuck on how to proceed on from here: $$ \text{Is }\ \int_0^2 X\,f\left(x\,\middle|\,x \leq \dfrac{y}{2}\right)= \int_0^{y/2} Xf(x)dx\,? $$
Since $Y=y$ is not random there are two cases:
1) $y/2 \geq 2$. Then $y$ does not affect calculations so $$E[X|X\leq y/2]=\int_{0}^2 x f_{X|X\leq y/2}(x)dx=\int_{0}^2 x f(x)dx=1$$
2) $0<y/2 < 2$. Then $Pr(X < x|X\leq y/2)=\frac{Pr(X < x \cap X\leq y/2)}{Pr(X\leq y/2)}=\min \{2x/y,1\}$ so $$f_{X|X\leq y/2}(x)=\left\{\begin{array}{cl}2/y & x \in [0,y/2] \\ 0 & x \in [y/2,2] \end{array}\right.$$ Hence, $$ E[X|X\leq y/2]=\int_{0}^2 x f_{X|X\leq y/2}(x)dx= \int_{0}^{y/2} x/y dx = \frac{y}{4} $$