conditional expected value given the random variable is less than another random variable Assume two independent random variables $X$ and $Y$ with p.d.f. $f(x)$ and $g(y)$. For simplicity, both $X$ and $Y$ are positive. How to find $E[X|X<Y]$?
We know  $P(X<Y)=\int_0^\infty\int_0^yf(x)dxg(y)dy$.
Is it true that $E[X|X<Y]=\int_0^\infty\int_0^yxf(x)dxg(y)dy$?
 A: In order to calculate $E[X\mid X<Y\ ]$ it is enough if we know the corresponding conditional density. That density can be calculated if the conditional cumulative distribution is known: $$F_{X\mid X<Y\ }(x)=P(X<x\mid X<Y\ )=\frac{P(X<x\ \cap X <Y)}{P( X <Y)}.$$Now, 
$$P(X<x\cap X<Y\ )=\int_{-\infty}^{\infty}P(X<x\cap X<Y\mid Y=y\  )g(y)\ dy=$$
$$=\int_{-\infty}^{\infty}P(X<x\cap X<y)g(y)\ dy$$because of independence. Then consider that 
$$P(X<x\cap X<y)=\begin{cases}F(x)&\text{ if }&x\leq y\\
F(y)&\text{ if }&y< x.\end{cases}$$
We have then
$$P(X<x\cap X<Y\ )=\int_{-\infty}^xF(y)g(y)\ dy+F(x)\int_x^{\infty}g(y)\ dy=$$
$$=\int_{-\infty}^xF(y)g(y)\ dy+F(x)(1-G(x)).$$
The same way,
$$P(X<Y)=\int_{-\infty}^{\infty}P(X<Y\mid Y=y)g(y)\ dy=$$
$$=\int_{-\infty}^{\infty}P(X<y)g(y)\ dy=\int_{-\infty}^{\infty}F(y)g(y)\ dy.$$
That is,
$$F_{X\mid X<Y\ }(x)=\frac{\int_{-\infty}^xF(y)g(y)\ dy+F(x)(1-G(x))}{\int_{-\infty}^{\infty}F(y)g(y)\ dy}.$$
The corresponding conditional density is
$$f_{X\mid X<Y}(x)=\frac{F(x)g(x)+f(x)(1-G(x))-F(x)g(x)}{\int_{-\infty}^{\infty}F(y)g(y)\ dy}.$$
And finally the conditional expectation can be computed.
Example
Let $X$ and $Y$ be independent and both uniformly distributed over $[0,1]$. We have
$$P(X<Y)=\int_0^1y\ dy=\frac12,$$
$$f_{X\mid X<Y}(x)=\frac{x\times1+1\times(1-x)-x\times1}{\frac12}=2(1-x)$$
and
$$E[X\mid X<Y]=2\int_0^1 x-x^2 \ dx=\frac13.$$
