# How to compute $\mathbb{E}\left[Y_1Y_2 \mid |U_1-U_2| <a\right]$ for $Y_i\sim N\left(\beta U_i, \sigma^2\right)$ and $U_i \sim Unif(0,1)$?

Suppose we have that $U_1, U_2$ are iid $Unif(0,1)$ random variables and that

$$Y_1\sim N\left(\beta U_1, \sigma^2\right)$$

is a Normal random variable independent of another Normal random variable:

$$Y_2\sim N\left(\beta U_2, \sigma^2\right)$$

for a fixed $\sigma^2$.

I am wondering how to compute the conditional expectation:

$$\mathbb{E}\left[Y_1Y_2 \mid |U_1-U_2| <a\right]$$

given that $Y_1, Y_2, U_1, U_2$ are all independent and that $a < \frac{1}{2}$?

Suppose you know that $U_1$, $U_2$, obtain the values $u_1$, $u_2$, respectively. Then, because of the independence of the variables,

$$E[Y_1 Y_2 | U_1 = u_1, U_2 = u_2] = \beta^2 u_1 u_2.$$

Therefore, we need to calculate

$$\int_{u_1 = 0}^1 \int_{u_2 = u_1}^{u_1 + a} \beta^2 u_1 u_2 \text{d} u_2 \text{d} u_1 + \int_{u_2 = 0}^1 \int_{u_1 = u_2}^{u_2 + a} \beta^2 u_1 u_2 \text{d} u_1 \text{d} u_2$$

This can be simplified to

$$2 \beta^2 \int_{u_1 = 0}^1 u_1 \int_{u_2 = u_1}^{u_1 + a} u_2 \text{d} u_2 \text{d} u_1,$$

which is very easy to calculate.

• Is the relation you have above explicitly conditional expectations? In other words, is the above equivalent to: $$\mathbb{E}\left[\mathbb{E}\left[Y_1 Y_2 | U_1 = u_1, U_2 = u_2\right]\mid |U_1-U_2| <a\right] = \mathbb{E}\left[Y_1Y_2 \mid |U_1-U_2| < a\right]$$? Since you added in the observed $u_1, u_2$ values, is this conditional expectation form correct? Or would $u_1, u_2$ appear in the inequality as well? – user321627 Jul 11 '17 at 6:14
• @user321627 The relationship above could be viewed as what you wrote, but it is more natural (IMHO) to think of it as simple unconditional expectation over the region where the inequality holds. – Ami Tavory Jul 11 '17 at 14:07
• Is there a formal way to understand what is going on? It seems like the expectation over the region where the inequality is appeared out of thin air. Is there a theory behind this? Like treating the $\mathbb{E}\left[Y_1Y_2 \mid |U_1-U_2| < a\right]$ the same as $\mathbb{E}\left[Y_1Y_2 \mid \mathbb{1}\{|U_1-U_2| < a\}\right]$ where $\mathbb{1}\{|U_1-U_2| < a\}$ is the indicator? – user321627 Jul 11 '17 at 17:28
• @user321627 I'll update the answer to show it more formally (tomorrow, though). – Ami Tavory Jul 11 '17 at 18:47