# Probability of being between two random variables

What is the probability of a constant being between two random variables (i.e. P(X < a < Y)) in terms of the joint probability distribution function of X and Y. X and Y are not independent, otherwise it would be really simple.

• It is also really simple: Hint: $$\{x<a<y\}=\{x<a\}\cap\{a<y\}$$ – Xi'an Nov 20 '17 at 19:19
• Oh, yeah, its $\int_{a}^{0} \int_{0}^{a} f(x,y)dxdy$ right? – Sam Baker Nov 20 '17 at 19:25
• The bounds depend on the support of $(X,Y)$ but $\int_a^0$ is certainly incorrect. – Xi'an Nov 20 '17 at 19:31
• Made a mistake again. I meant $\int_{a}^{inf} \int_{-inf}^{a} f(x,y)dxdy$ – Sam Baker Nov 20 '17 at 19:32
• Drawing a picture of this event in the $(X,Y)$ plane will make the answer evident. – whuber Nov 20 '17 at 19:34

The figure (below) answers the question.

It reveals a complication: when the distribution is not continuous at $$X=a,$$ we have to take care not to include the chance of the event $$X=a\lt Y$$ in our calculation. This is done by "sneaking up" to the answer as a limit. Therein lies the interest in this question.

By definition, the joint probability function is

$$F_{XY}(x,y) = \Pr(X \le x\text{ and } Y \le y).$$

It determines the marginal probability functions $$F_X$$ and $$F_Y$$ as

$$\lim_{y\to\infty} F_{XY}(x,y) = \Pr(X \le x) = F_X(x)$$

and

$$\lim_{x\to\infty} F_{XY}(x,y) = \Pr(Y \le y) = F_Y(y).$$

We can almost get to the solution in the form

$$\Pr(X \le a \lt Y) = \Pr(X\le a) - \Pr(X\le a, Y \le a) = F_{X}(a) - F_{XY}(a,a)$$

because the event $$X\le a$$ is the disjoint union of the events $$X\le a \lt Y$$ and the intersection of $$X\le a$$ with $$Y \le a.$$ See the figure.

In this figure, we seek the probability of the upper left quadrant--which does not include its boundary rays. This quadrant is the left open half-plane (that is, without its vertical boundary) with the lower left quadrant (including its upper boundary) removed.

This solution works when $$F_X$$ is continuous at $$a,$$ because the chance that $$X=a$$ is nil. However, the only way to account for that chance in full generality is to notice that the event $$X\lt a$$ is the union of the events $$X \lt a-\epsilon$$ for all $$\epsilon \gt 0,$$ whence

$$\Pr(X \lt a \lt Y) = \lim_{\epsilon\to 0^+} \left(F_{X}(a-\epsilon) - F_{XY}(a-\epsilon,a)\right).$$

Notice this implicitly involves double limits because $$F_X$$ is determined from $$F_{XY}$$ via a limiting process.

BTW, all the limits in this question always exist, because they are all limits of non-decreasing bounded functions: every one of them is a limit of probabilities computed over a sequence of larger and larger sets (each a superset of all the preceding ones) and, of course, probabilities are bounded by $$1.$$