In an exercise, I have to compute $\mathbb P(g(X,Y)\leq a)$ where $g:\mathbb R^2\to \mathbb R$ and $(X,Y)$ has joint distribution $\mu_{X,Y}$. I know that $$\mathbb P\{X\in A,Y\in B\}=\int_{A}\mathbb P(Y\in B\mid X=x)\mu_X(dx).$$ But I was wondering : does $$\mathbb P(g(X,Y)\leq a)=\int_{\mathbb R}\mathbb P(g(x,Y)\leq a\mid X=x)\mu_X(dx)\ \ ?$$
I wouldn't be surprise, but I'm not so sure. What I tried is : if $(X,Y)$ has density $f_{X,Y}$, then $$\mathbb P(g(X,Y)\leq a)=\iint_{\{g(x,y)\leq a\}}f_{X,Y}(x,y)dxdy=\int_{\mathbb R}dx\int_{\{y\mid g(x,y)\leq a\}}f_{X,Y}(x,y)dxdy=\int_{\mathbb R}f_{X}(x)dx\int_{\{y\mid g(x,y)\leq a\}}\underbrace{\frac{f_{X,Y}(x,y)}{f_X(x)}}_{=f_{Y|X=x}(y)}dy=\int_{\mathbb R}\mathbb P(g(x,Y)\leq a\mid X=x)f_X(x)dx.$$
So, I strongly suspect that the result is true in the more general case, but how can I prove it ?