# How to compute $Pr(a \leq Y \leq b | a \leq X \leq b)$?

In general, how to compute $$Pr(a \leq Y \leq b | a \leq X \leq b)$$ if given $$F_{Y|X}(y|x)$$ and $$f_x(x)$$? Notice that $$a$$ and $$b$$ for the intervals of the two random variables are the same.

I know how to do it using the conditional density and the marginal density for $$X$$, but would like to know if it is possible to do it 'directly' using the conditional CDF.

• Welcome to CV, econ86 Can you clarify/confirm that the $a$ and $b$ in $a\le Y \le b$ are the same $a$ and $b$ in $a \le X \le b$? Also: can you check out the self-study tag, and consider editing your question to use it if appropriate? (It helps with the kind of responses your question will get.) Oct 8, 2019 at 17:55
• Yes, they are. Thanks for the 'self-study' tip too! Oct 8, 2019 at 18:39

The solution is:

$$P(Y\in [a,b]|X\in[a,b])=\frac{\int_{[a,b]}(F_{Y|X}(b|x)-F_{Y|X}(a|x))f_X(x)dx}{\int_{[a,b]}f_X(x)dx}$$

This can be seen, as:

$$P(Y\in[a,b]\cap X\in[a,b])= P(Y\leq b\cap X\in[a,b])-P(Y\leq a\cap X\in[a,b])= \int_{a}^b \left( \int_{-\infty}^bf_{Y|X}(y|x)dy \right)dx-\int_{a}^a \left( \int_{-\infty}^af_{Y|X}(y|x)dy \right)dx= \int_a^bF_{Y|X}(b|x)dx-\int_a^bF_{Y|X}(a|x)dx=\int_{[a,b]}(F_{Y|X}(b|x)-F_{Y|X}(a|x))f_X(x)dx$$

Furthermore:

$$P(Y\in [a,b]|X\in[a,b])= \frac{P(Y\in[a,b]\cap X\in[a,b])}{P(X\in[a,b])}= \frac{\int_{[a,b]}(F_{Y|X}(b|x)-F_{Y|X}(a|x))f_X(x)dx}{\int_{[a,b]}f_X(x)dx}$$