# Doubt regarding Conditional Expectation

conditional probabilityexpected valueprobabilityprobability theory

Let $$X,Y$$ be IID random variable that are uniformly distributed on $$[0,1]$$. Does the following equation hold?
$$\text{E}[X\vert X\geq Y] = \int_{-\infty}^{\infty} \text{E}[X\vert X\geq y]f_Y(y)\,\text{d}y$$
This would then imply that
$$\text{E}[X\vert X\geq Y] = \int_0^1 \text{E}[X\vert X\geq y]\,\text{d}y$$
where
$$f_{X\vert X\geq y}(x) = \begin{cases}\frac{1}{1-y}&y\leq x\leq 1\\0&\text{otherwise} \end{cases}$$
such that
$$\text{E}[X\vert X\geq y] = \int_y^1 x\,\frac{1}{1-y}\,\text{d}x = \frac{1+y}{2}$$
Finally, we obtain
$$\text{E}[X\vert X\geq Y] = \int_0^1 \frac{1+y}{2}\,\text{d}y = \frac{3}{4}$$
which is not correct. Hence, there must be an error somewhere. I appreciate your help!

For completeness, the (presumably) correct solution is given below.
$$\text{E}[X\vert X\geq Y] = \int_{-\infty}^{\infty} x f_{X\vert X\geq Y}(x)\,\text{d}x$$
Using Bayes' rule, we obtain
\begin{align} f_{X\vert X\geq Y}(x) &= \frac{\text{Pr}[X\geq Y\vert X = x] f_X(x)}{\text{Pr}[X\geq Y]}\\ &= \frac{\text{Pr}[Y\leq x] f_X(x)}{1/2}\\ &= \begin{cases} 2x& x\in[0,1]\\ 0&\text{otherwise} \end{cases} \end{align}
such that
$$\text{E}[X\vert X\geq Y] = \int_{-\infty}^{\infty} x \cdot 2x\,\text{d}x = \frac{2}{3}$$

All credit goes to @Thomas who found the mistake in my initial approach. Thank you @Thomas and thanks to those who added helpful answers or comments.

The main issue lies in my very first equation, namely
$$\text{E}[X\vert X\geq Y] = \int_{-\infty}^{\infty} \text{E}[X\vert X\geq y]f_Y(y)\,\text{d}y$$
As @Thomas suggested, the density $$f_Y(y)$$ should also be conditioned on $$X\geq Y$$, that is, $$f_{Y\vert X\geq Y}(y)$$. The corrected equation is given as
$$\text{E}[X\vert X\geq Y] = \int_{-\infty}^{\infty} \text{E}[X\vert X\geq y]f_{Y\vert X\geq Y}(y)\,\text{d}y$$
with
\begin{align} f_{Y\vert X\geq Y}(y) &= \frac{P(X\geq Y\vert Y = y)f_Y(y)}{P(X\geq Y)}\\ &= \frac{P(X\geq y)f_Y(y)}{P(X\geq Y)}\\ &= \begin{cases} \frac{1-y}{1/2} &0\leq y \leq 1\\ 0 &\text{otherwise} \end{cases}\\ &= \begin{cases} 2(1-y) &0\leq y \leq 1\\ 0 &\text{otherwise} \end{cases} \end{align}
This results in the following solution.
\begin{align} \text{E}[X\vert X\geq Y] &= \int_{-\infty}^{\infty} \text{E}[X\vert X\geq y]f_{Y\vert X\geq Y}(y)\,\text{d}y\\ &= \int_0^1 \text{E}[X\vert X\geq y]\,2(1-y)\,\text{d}y\\ &= \int_0^1 \frac{1+y}{2}\,2(1-y)\,\text{d}y\\ &= \int_0^1 (1-y^2)\,\text{d}y\\ &= \left[y – \frac{1}{3}\,y^3\right]_0^1\\ &= \frac{2}{3} \end{align}
where $$\text{E}[X\vert X\geq y] = \frac{1+y}{2}$$ follows from the computations above (initial approach).

First of all we can recall the tower property. If we have a partition of the probability space $$A_i$$, with $$P(A_i)>0$$, than:

$$E[X]=\sum_i E[X|A_i]P(A_i)$$

If we have an event $$B$$ this reads:

$$E[X|B]=\sum_i E[X|A_i,B]P(A_i|B)$$ [1]

Now consider $$B=\{X>Y\}$$ and $$A_y=\{Y=y\}$$. We would be tempted to guess from [1]:

$$E[X|X>Y]=\int dy E[X|Y=y,X>Y]P(Y=y|X>Y)$$ [2]

This is similar to your formula in spirit, but note that we have a conditional density on P.

But the problem here is that also this formula is undefined because we are conditioning on null events, something that is undefined. Nevertheless, if we consider a $$y_1=0,...,y_n=1$$ equidistant with distant $$\Delta$$ and consider the events $$A_i=\{Y \in [y_i,y_{i+i}]\}$$ we have a well defined expression, similar to 2, but with summations instead of integrals. We can than let $$\Delta \rightarrow 0$$.

If you do that, you see that you need to substitute :

• $$E[X|Y=y,X>Y] \rightarrow \frac{1+y}{2}$$ (your result) ;
• $$P(Y=y|X>Y)\rightarrow 2(1-y)$$ (here is where your calculation is wrong I think);

, which leads to the correct result (2/3). Something that one could have also 'guessed'.

Of course there is a more direct way to solve the exercise but here I wanted to show how to change your first approach so that you get the correct result.