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.
 A: 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.$
