Proof of replacement rule in conditional probability The answer to this question gives a replacement rule for conditional probability. But how do you prove this? I tried integrating both sides w.r.t. $P_X$ and fiddling around but it didn't get me anywhere.


  Rule: Let $X$ and $Y$ be as above random variables, and let $\xi:\mathbb{R}^2\to\mathbb{R}$ be $(\mathcal{B}(\mathbb{R}^2),\mathcal{B}(\mathbb{R}))$-measurable. Then
  $$
P(\xi(X,Y)\in D\mid X=x)=P(\xi(x,Y)\in D\mid X=x),\quad D\in\mathcal{B}(\mathbb{R}),
$$
  holds for $P_X$-a.a. $x$. This is saying that "conditional on $X=x$ we may replace $X$ by $x$".


[EDIT]

Managed to prove this without $Y$, for measurable $g$ we have: $\int_C \mathbf{P} (g (X) \in B \mid X = x) P_X \left( \text{d} x \right)
=\mathbf{P} (g (X) \in B, X \in C) = \int_C {\bf 1}_{g (x) \in B} P_X
\left( \text{d} x \right)$. Also $\int_C \mathbf{P} (g (x) \in B \mid X = x)
P_X \left( \text{d} x \right) = \int_C {\bf 1}_{g (x) \in B} P_X \left(
\text{d} x \right)$.

But this no longer works with $Y$ as $g(X,Y)$ is no longer a function of $X$.

[EDIT2] Many thanks to Stefan Hansen who posted an answer here to the same question.
Probability of an event is the expectation of an indicator function that the event occurs, and
$\mathsf E(g(X,Y)\mid X=x) = \mathsf E(g(x,Y)\mid X=x)$


Thus:
$$\begin{align}
\mathsf P(\xi(X,Y)\in D\mid X=x)
 &amp; =\mathsf E(\mathbf 1_{\xi(X,Y)\in D}\mid X=x) 
\\ &amp; = \mathsf E(\mathbf 1_{\xi(x,Y)\in D}\mid X=x) 
\\ &amp; = \mathsf P(\xi(x, Y)\in D\mid X=x)
\end{align}$$
Probability of an event is the expectation of an indicator function that the event occurs, and
$\mathsf E(g(X,Y)\mid X=x) = \mathsf E(g(x,Y)\mid X=x)$


Thus:
$$\begin{align}
\mathsf P(\xi(X,Y)\in D\mid X=x)
 &amp; =\mathsf E(\mathbf 1_{\xi(X,Y)\in D}\mid X=x) 
\\ &amp; = \mathsf E(\mathbf 1_{\xi(x,Y)\in D}\mid X=x) 
\\ &amp; = \mathsf P(\xi(x, Y)\in D\mid X=x)
\end{align}$$