# Law of total probability for random variables with Y < X

Could someone explain to me why the following equation holds? It is related to the law of total probability , but I don't get it. I'm confused because it's two random variables on the right side and therefore it should also be a joint distribution, right ?

\begin{align} \int \limits_0^\infty f_X(x) \ \mathbb{P}(Y

I understand that \begin{align} \mathbb{P}(X \in A, Y \in B) = \int_B f_Y(y) \int_A f_X(x|Y = y) \ dx \ dy . \end{align}

But how do I put this together?

Consider the continuous random variables $$W$$ and $$V$$ and their joint distribution $$p(w,v)$$. By the law of total probability, note that $$p(w) = \int p(w,v) \ \text{d}v$$ and by Bayes' rule \begin{align} p(w) &= \int p(w,v) \ \text{d}v \\ &= \int p(w \mid v) \cdot p(v) \ \text{d}v \end{align} Going back to your random variables, note that $$p(Y < X) = \int p(Y < X \mid x) \cdot p(x) \ \text{d}x$$ Since $$X$$ is given in $$p(Y < X \mid x)$$, then we can let $$p(Y < X \mid x) = p(Y < x)$$ such that $$p(Y < X) = \int p(Y < x) \cdot p(x) \ \text{d}x$$ Another way to see this is to let $$Z = \begin{cases} 1 \quad \text{if} \quad Y < X \\ 0 \quad \text{otherwise} \end{cases}$$ We are therefore interested in $$p(Z = 1)$$. By the law of total probability and Bayes' rule, $$p(Z = 1) = \int p(Z = 1 \mid x) \cdot p(x) \ \text{d}x$$
• Yes we are integrating $v$ out. Not sure what you are asking about... Nov 28, 2021 at 19:11