# Is this proof of the Law of Total Probability correct?

$$\operatorname{P}(X_1 \le x_1) = \operatorname{E} \bigl( \operatorname{P}(X_1 \le x_1 \vert X_2) \bigr)$$

And I express the expectation as:

\begin{align} \operatorname{E} \bigl( \operatorname{P}(X_1 \le x_1 \vert X_2) \bigr) = & \int_{-\infty}^{\infty} \operatorname{P}(X_1 \le x_1 \vert X_2 = x_2)\;f_2(x_2)\;dx_2 \\ & = \int_{-\infty}^{\infty} \Biggl(\int_{t \le x_1} \frac{f_{X_1,X_2}(t,x_2)}{f_{X_2}(x_2)} \; dt \Biggr)\;f_{X_2}(x_2)\;dx_2 \\ & = \int_{-\infty}^{\infty} \Biggl(\int_{-\infty}^{x_1} \frac{f_{X_1,X_2}(t,x_2)}{f_{X_2}(x_2)} \; dt\Biggr)\;f_{X_2}(x_2)\;dx_2 \\ & = \int_{-\infty}^{\infty} \int_{-\infty}^{x_1} \frac{f_{X_1,X_2}(t,x_2)}{f_{X_2}(x_2)}\;f_{X_2}(x_2) \; dt \; dx_2 \\ & = \int_{-\infty}^{\infty} \int_{-\infty}^{x_1} f_{X_1,X_2}(t,x_2) \; dt \; dx_2 \\ & = \int_{-\infty}^{x_1} \int_{-\infty}^{\infty} f_{X_1,X_2}(t,x_2) \; dx_2 \; dt \\ & = \int_{-\infty}^{x_1} f_{1}(t) \; dt \\ & = \operatorname{F}_{X_1}(x_1) = \text{P}(X_1 \le x_1) \end{align}

I am especially not sure about changing the integrals around, as in a previous course I was told that the integral with the variable in the bounds had to be integrated first.

• The step of switching the integrals is fine. This is an application of Fubini's Theorem (or maybe Tonelli's Theorem, to be more precise) which says you can switch the order of integration when your integrand is positive, as any self-respecting density function must be. Apr 16 '18 at 16:53
• Also $x_1$ is not a variable of integration so does not present any problem for the swap. Apr 16 '18 at 17:09
• The quantity $\operatorname{P}(X_1\le x_1\mid X_2=x_2)$ is merely a number, not a random variable. The expression $\operatorname{P}(X_1\le x_1 \mid X_2),$ on the other hand, is a random variable whose value is determined by the value of $X_2.$ The expected value of that random variable is $\operatorname{P}(X_1\le x_1).$ That is the law of total probability. So your statement of the proposition is wrong. Apr 16 '18 at 17:12
• @MichaelHardy so it is a notation mistake, right? I will edit my question then. Apr 16 '18 at 17:24
• @AlexLostado : You fixed the notation inside the expectation operator, but then inside the integral you should have $$\int_{-\infty}^\infty \operatorname{P}(X_1 \le x_1 \mid X_2 = x_2)\;f_2(x_2)\;dx_2.$$ Just as one has $$\operatorname{E}(X) = \int_{\mathbb R} x f(x)\,dx \text{ and not } \require{cancel} \xcancel{ \int_{\mathbb R} Xf(x)\, dx}.$$ Apr 16 '18 at 17:31

Well, firstly $\textsf{P}(X_1 \le x_1 \mid X_2 = x_2)$ is a constant, not a random variable, but that is an easy fix.   $\textsf{P}(X_1 \le x_1 \mid X_2)$ is a random variable with the requisite properties.
Secondly, $x_1$ is not a variable of integration, so presents no problem for the change of order; and the integration order can be changed via Fubini/Tonelli's Theroem.   I suggest avoid invoking $x_2$ and rather using both $s,t$ as the variables of integration to be clear about the distinction.
\begin{align} \mathsf{E} \bigl( \mathsf{P}(X_1 \le x_1 \mid X_2) \bigr) = & \int_{-\infty}^{\infty} \mathsf{P}(X_1 \le x_1 \mid X_2 = s)\;f_{\small X_2}(s)\;ds \\ & = \int_{-\infty}^{\infty} \Biggl(\int_{t \le x_1} \frac{f_{\small X_1,X_2}(t,s)}{f_{\small X_2}(s)} \; dt \Biggr)\;f_{\small X_2}(s)\;ds \\ & = \int_{-\infty}^{\infty} \Biggl(\int_{-\infty}^{x_1} \frac{f_{\small X_1,X_2}(t,s)}{f_{\small X_2}(s)} \; dt\Biggr)\;f_{\small X_2}(s)\;ds \\ & = \int_{-\infty}^{\infty} \int_{-\infty}^{x_1} \frac{f_{\small X_1,X_2}(t,s)}{f_{\small X_2}(s)}\;f_{\small X_2}(s) \; dt \; ds \\ & = \int_{-\infty}^{\infty} \int_{-\infty}^{x_1} f_{\small X_1,X_2}(t,s) \; dt \; ds \\ & = \int_{-\infty}^{x_1} \int_{-\infty}^{\infty} f_{\small X_1,X_2}(t,s) \; ds \; dt \\ & = \int_{-\infty}^{x_1} f_{\small X_1}(t) \; dt \\ & = F_{\small X_1}(x_1) \\ &= \mathsf{P}(X_1 \le x_1) \end{align}