Who can help me to interpret the following expression? I don't understand the second line of the following expression. Why does he use conditional expectation? and can you explain the following calculation process to me? Thanks.

 A: Do you agree with the following(?):
\begin{align}
\text{Pr}\left( 
(X_{1}^{\star} - X_{2}^{\star})
(Y_{1}^{\star} - Y_{3}^{\star})>0
\right)
&=
\sum_{X_{1}^{\star}, Y_{1}^{\star}}
\text{Pr}\left( 
(X_{1}^{\star} - X_{2}^{\star})
(Y_{1}^{\star} - Y_{3}^{\star})>0\;
\vert\; X_{1}^{\star}, Y_{1}^{\star}
\right)
\cdot 
\text{Pr}\left( 
 X_{1}^{\star}, Y_{1}^{\star}
\right)\\
&=
\text{E}_{X_{1}^{\star}, Y_{1}^{\star}}
\left[\text{Pr}\left( 
(X_{1}^{\star} - X_{2}^{\star})
(Y_{1}^{\star} - Y_{3}^{\star})>0\;
\vert\; X_{1}^{\star}, Y_{1}^{\star}
\right)\right]
\end{align}
To verify that, you may want to check the "Law of total probability".
For the next step, you have to think the following:
When does it hold that $(X_{1}^{\star} - X_{2}^{\star})
(Y_{1}^{\star} - Y_{3}^{\star})>0$?
There are two cases: 


*

*Either $Y_{3}^{\star} \le Y_{1}^{\star}$ and $X_{2}^{\star} \le X_{1}^{\star}$ simultaneously, or

*Either $Y_{3}^{\star} > Y_{1}^{\star}$ and $X_{2}^{\star} > X_{1}^{\star}$ simultaneously. 


Recall that $X_{1}^{\star}$ and $Y_{1}^{\star}$ are now constants (given). 
We also know that $X_{i}^{\star}$ and $Y_{i}^{\star}$ have marginals that are uniform between $0$ and $1$.
Now, I suspect that $X_{i}^{\star}$ and $X_{j}^{\star}, Y_{k}^{\star}$ for $i \neq k, i\neq j$ are independent (because they have a different subscript - am I wrong?)
If I am correct, then taking into account the fact that $X_{i}^{\star}$ is uniformly distributed on $(0,1)$, we have
$$
\text{Pr}(X_{2}^{\star} > X_{1}^{\star}) = (1 - X_{1}^{\star}),
\quad \text{and} \quad
\text{Pr}(X_{2}^{\star} \le X_{1}^{\star}) = X_{1}^{\star}.
$$ 
Similarly, for $Y_{3}^{\star}$.
Then, the third step follows from the linearity of expectation and the next by the definition of covariance. Note that the expected value of both $X_{i}^{\star}$ and $Y_{i}^{\star}$ is equal to $1/2$.
