How to think about Continuous Total Probability Theorem applied to a conditional?

I'm trying to understand the following relationship intuitively.

We have the generic TPT which states:

$$P(A)=\int_{R_X}P(A|X=t)f_X(t)dt$$

Where $$A$$ is some event, and $$X$$ is a continuous random variable with possible values in $$R_X$$.

When we apply this to a conditional case, we now restrict the sample space to $$B$$ (for some event $$B$$), and we get:

$$P(A|B)=\int_{X\in B}P(A|B|X=t)f_{X|B}(t)dt$$

But apparently this is the same as:

$$P(A|B)=\int_{X\in B}P(A|B,X=t)f_{X|B}(t)dt$$

How do we get there? I was trying to think in terms of Venn diagrams but the fact that $$X=t$$ is a zero probability event is throwing me off.

All of it hidden in Conditional Expectation. In modern probability, conditional probability define as a special case of Conditional Expectation.

$$p(A)= E(I_A)=E (E(I_A|X))$$

by definition of conditional expectation $$E(I_A|X)$$ is a function of $$X$$ (measurable to $$\sigma(X)$$ that satisfy projection property ) $$= \int E(I_A|X=x) f_X(x)dx=\int p(A|X=x) f_X(x)dx$$

from now $$E(I_A)=\int p(A|X=x) f_X(x)dx$$ and so $$E(I_{AB})=\int p(AB|X=x) f_X(x)dx$$ $$\hspace{.5cm}$$ (1)

note in modern probability we have (this defination is same for continues and discrete variable, it does not depend to type of $$Y$$) :

$$E(Y|B)=\frac{E(YI_B)}{E(I_B)} =\frac{E(YI_B)}{E(I_B)}$$ $$\hspace{.5cm}$$ (2)

so

$$p(A|B)=E(I_A|B)\overset{ (2)}{=}\frac{E(I_AI_B)}{E(I_B)}=\frac{E(I_{AB})}{E(I_B)}=\frac{p(AB)}{p(B)}\overset{ (1)}{=}\frac{\int p(AB|X=x) f_X(x)dx}{\int p(B|X=x) f_X(x)dx}$$

it is over since you can calculate $$p(AB)=E(I_{AB})=\int p(AB|X=x) f_X(x)dx$$ and $$p(B)$$ .

but for more

$$\frac{\int p(AB|X=x) f_X(x)dx}{\int p(B|X=x) f_X(x)dx}=\frac{\int p(AB|X=x) f_X(x)dx}{p(B)}= \int\frac{ p(AB|X=x)}{p(B)} f_X(x)dx= \int\frac{ p(AB|X=x)}{p(B)p(B|X=x)} p(B|X=x)f_X(x)dx= \int\frac{ p(AB|X=x)}{p(B|X=x)} \frac{p(B|X=x)f_X(x)}{p(B)}dx=\int p(A|B,X=x) \frac{p(B|X=x)f_X(x)}{p(B)}dx= \int p(A|B,X=x) f_X(x|B)dx$$

It might help to look at what happens in the discrete case. Let $$X$$ be a discrete random variables taking values in a set $$\mathcal X$$. I will use $$P(E,F,G)$$ to denote $$P(E\cap F\cap G)$$. Then \begin{align} P(A|B) &=\frac{P(A,B)}{P(B)} \\&=\sum_{t\in \mathcal X}\frac{P(A, B, X=t)}{P(B)} \\&=\sum_{t\in \mathcal X}\frac{P(A, B, X=t)}{P(B, X=t)}\cdot \frac{P(B, X=t)}{P(B)} \\&=\sum_{t\in \mathcal X}P(A|B,X=t)P(X=t|B) \end{align} This is the discrete analogue of your integral formula.

• Can you explain the second line? If that's an application of TPT (in the discrete case), I don't see it. Sorry if it's a trivial question. Here's the version of TPT I have in mind for discrete events: $P(B) = \sum_{k=1}^{n} P(A_k)P(B | A_k)$ for $\{A_k\}_1^n$ a partition of the sample space. – alwaysiamcaesar Mar 15 at 5:37
• Whenever events E and F are mutually exclusive, $P(E\cup F)=P(E)+P(F)$. In that line, the event $A⋂ B$ is the union of the mutually exclusive events $A⋂ B ⋂ X=t$, so the probability of the former is the sum of the probabilities of the latter. – Mike Earnest Mar 15 at 14:46
• In a way, it is TPT. You can rewrite TPT as $P(C)=\sum_{k=1}^n P(C,D_k)$, by applying the definition of $P(C|D_k)$. Then, let $C=A\cap B$, and let $D_k=\{X=t_k\}$, where $\mathcal X=\{t_1,t_2,\dots,t_k\}$. @alwaysiamcaesar – Mike Earnest Mar 15 at 16:13