Tutorials › Statistical Theory I - Probability and Distribution Theory › Rectangle Probabilities by Inclusion-Exclusion

Joint Distribution Representations · Tutorial 211 of 994

Rectangle Probabilities by Inclusion-Exclusion

Use four joint CDF values to calculate rectangle probabilities, then adjust the corner values when endpoint atoms make boundary inclusion matter.

Intermediate 10 min read

What You'll Learn

  • Apply the four-corner inclusion-exclusion formula to half-open rectangles.
  • Interpret the formula using differences of event indicators.
  • Handle infinite endpoints through marginal CDFs and limits.
  • Distinguish open and closed boundaries when endpoint atoms are present.
  • Choose the appropriate CDF values or one-sided limits for each rectangle.

Why Four CDF Values Determine a Rectangle Probability

A joint cumulative distribution function records probabilities for regions extending down and to the left from a point. A bounded rectangle is not itself such a region, but it can be assembled from four of them: take the large lower-left region, subtract two strips, then add back their overlap. This is the inclusion-exclusion principle in a form that is especially useful for joint distributions.

The exact boundary convention matters. The usual four-value formula applies directly to rectangles open at their lower edges and closed at their upper edges. If the random vector can put probability on a boundary, changing an open edge to a closed one can change the answer. The corner values must then be adjusted accordingly.

Definition: For a random vector \((X,Y)\), its joint CDF is
$$ F(x,y)=P(X\le x,\;Y\le y), \qquad x,y\in\mathbb R. $$
For \(a\le b\) and \(c\le d\), a half-open rectangle is \((a,b]\times(c,d]\): it contains points with \(a<X\le b\) and \(c<Y\le d\).

The Four-Corner Formula

Theorem: For any real-valued random vector \((X,Y)\) and finite \(a\le b,\ c\le d\),
$$ P(a<X\le b,\;c<Y\le d) =F(b,d)-F(a,d)-F(b,c)+F(a,c). $$
No continuity, density, or independence assumption is required.

The signs follow the same pattern in both coordinates: start with the upper-right corner, subtract the two lower edges, and add back the lower-left corner that was subtracted twice. In particular, if \(X\) and \(Y\) have atoms on the boundary, the formula still gives the probability for exactly the stated half-open rectangle.

1
Start with the largest lower-left region.
\(F(b,d)\) includes all outcomes with \(X\le b\) and \(Y\le d\).
2
Remove the regions below the lower edges.
Subtract \(F(a,d)\) to remove \(X\le a,\ Y\le d\), and subtract \(F(b,c)\) to remove \(X\le b,\ Y\le c\).
3
Restore the overlap.
The region \(X\le a,\ Y\le c\) was removed twice, so add \(F(a,c)\) once.

The formula can also be proved directly with indicator variables. For any outcome, the difference \(1_{\{X\le b\}}-1_{\{X\le a\}}\) equals 1 exactly when \(a<X\le b\), and equals 0 otherwise. The corresponding statement holds for \(Y\). Their product is therefore the indicator of the rectangle:

$$ 1_{\{a<X\le b,\;c<Y\le d\}} = \bigl(1_{\{X\le b\}}-1_{\{X\le a\}}\bigr) \bigl(1_{\{Y\le d\}}-1_{\{Y\le c\}}\bigr). $$

Taking expectations and expanding the product gives four probabilities. By the definition of \(F\), those probabilities are \(F(b,d)\), \(F(a,d)\), \(F(b,c)\), and \(F(a,c)\), with signs \(+,-,-,+\), respectively. This proves the result. \(\square\)

Worked Example: A Rectangle in a Discrete Joint Distribution

Suppose \((X,Y)\) takes the following values with the indicated probabilities:

\((X,Y)\)Probability
\((0,0)\)0.20
\((0,1)\)0.10
\((1,0)\)0.15
\((1,1)\)0.25
\((2,1)\)0.30

Find \(P(0<X\le2,\;0<Y\le1)\). The four required CDF values are:

\(F(2,1)=1\), since every listed point satisfies \(X\le2,\ Y\le1\). Also, \(F(0,1)=0.20+0.10=0.30\), \(F(2,0)=0.20+0.15=0.35\), and \(F(0,0)=0.20\). Thus

$$ P(0<X\le2,\;0<Y\le1) =1-0.30-0.35+0.20=0.55. $$

Checking against the support, the rectangle contains \((1,1)\) and \((2,1)\), with total probability \(0.25+0.30=0.55\). The point \((0,1)\) is excluded because its \(X\)-coordinate lies on the open lower edge.

Infinite Endpoints

Infinite endpoints are handled by limits of CDF values. A real-valued random variable is finite with probability one, so it is useful to extend the notation by setting

$$ F(\infty,y)=P(Y\le y),\qquad F(x,\infty)=P(X\le x),\qquad F(\infty,\infty)=1. $$

At a lower endpoint of \(-\infty\), the corresponding lower-left event has probability zero. For example, \(P(X\le-\infty,\ Y\le y)=0\). Consequently, if \(a=-\infty\), the four-corner formula reduces to

$$ P(X\le b,\;c<Y\le d)=F(b,d)-F(b,c). $$

If \(b=\infty\), the terms at that endpoint use the marginal CDF of \(Y\). For instance,

$$ P(X>a,\;c<Y\le d) =F(\infty,d)-F(a,d)-F(\infty,c)+F(a,c). $$

These conventions follow from probability continuity: probabilities of increasing events converge to the probability of their union, and probabilities of decreasing events converge to the probability of their intersection. Thus finite-threshold CDF values approaching an infinite endpoint converge to the stated marginal or total probability. The same formulas apply when more than one endpoint is infinite, with zero lower-tail terms omitted as appropriate.

Worked Example: An Unbounded Rectangle for Independent Uniform Variables

Let \(X\) and \(Y\) be independent Uniform\((0,1)\) random variables. Find \(P(X>1/4,\ Y\le3/5)\). On the unit square, their joint CDF is \(F(x,y)=xy\) for \(0\le x,y\le1\). Since the \(X\)-interval extends to infinity, use \(F(\infty,y)=P(Y\le y)=y\). Therefore

$$ \begin{aligned} P(X>1/4,\ Y\le3/5) &=F(\infty,3/5)-F(1/4,3/5)\\ &=\frac35-\left(\frac14\cdot\frac35\right)\\ &=\frac35-\frac3{20} =\frac9{20}. \end{aligned} $$

Independence gives a check: \(P(X>1/4)P(Y\le3/5)=(3/4)(3/5)=9/20\). The CDF calculation itself did not require independence; independence was used only for this verification.

Open and Closed Edges When Atoms Are Present

The ordinary joint CDF uses the comparison \(\le\) in both coordinates. It therefore gives the four-corner formula directly for \((a,b]\times(c,d]\), but not automatically for every choice of open and closed edges. To include a lower edge, the probability on that edge must be retained rather than removed. To exclude an upper edge, the probability on that edge must be omitted.

One precise way to keep track of the distinction is to allow strict-threshold probabilities as well. Write \(F_{<,\le}(x,y)=P(X<x,\ Y\le y)\), \(F_{\le,<}(x,y)=P(X\le x,\ Y<y)\), and \(F_{<,<}(x,y)=P(X<x,\ Y<y)\). These are determined by one-sided limits of the ordinary joint CDF:

$$ F_{<,\le}(x,y)=F(x-,y),\quad F_{\le,<}(x,y)=F(x,y-),\quad F_{<,<}(x,y)=F(x-,y-). $$

Here \(F(x-,y)=P(X<x,\ Y\le y)\), and the other left limits have the analogous meaning. For example, \(F(x-,y)=\lim_{u\uparrow x}F(u,y)\). These limits are important when there is an atom at a threshold: in general \(F(x-,y)\ne F(x,y)\).

Endpoint rule: For an interval in one coordinate, represent its upper edge by the event \(X\le b\) if included and \(X<b\) if excluded. Subtract the event \(X\le a\) if the lower edge is excluded, or \(X<a\) if the lower edge is included. Apply the same rule to \(Y\), then expand the product of the two event differences. The resulting four corner terms use the corresponding strict or non-strict CDF values.

For example, a rectangle closed at both lower edges and both upper edges, \([a,b]\times[c,d]\), has probability

$$ P(a\le X\le b,\ c\le Y\le d) =F(b,d)-F(a-,d)-F(b,c-)+F(a-,c-). $$

The left limits occur at the lower edges because the points \(X=a\) and \(Y=c\) must remain in the rectangle. When there are no atoms on the relevant edges, these limits agree with the corresponding CDF values, and changing the boundary convention does not change the probability. When there are atoms, the distinction can be essential.

Worked Example: Changing the Boundary Convention Changes the Answer

Use the discrete distribution from the first example. Find the probabilities of four rectangles with the same numerical endpoints but different boundary conventions.

For \((0,1]\times(0,1]\), the four-corner calculation already gives \(0.25\). Directly, only the point \((1,1)\) is included.

For \([0,1]\times(0,1]\), include \(X=0\) but still exclude \(Y=0\). The included points are \((0,1)\) and \((1,1)\), so the probability is \(0.10+0.25=0.35\). Equivalently, the appropriate formula is

$$ F(1,1)-F(0-,1)-F(1,0)+F(0-,0) =0.70-0-0.35+0=0.35. $$

For \((0,1]\times[0,1]\), the included points are \((1,0)\) and \((1,1)\), giving \(0.15+0.25=0.40\). For \([0,1]\times[0,1]\), all four points with coordinates in \(\{0,1\}\) are included, giving \(0.20+0.10+0.15+0.25=0.70\). Thus these boundary choices yield \(0.25,\ 0.35,\ 0.40,\) and \(0.70\), respectively. The differences come entirely from probability on the edges.

Common Mistake and Why the Formula Matters

A common mistake is to use \(F(b,d)-F(a,d)-F(b,c)+F(a,c)\) for a closed rectangle \([a,b]\times[c,d]\) without checking for atoms. That calculation gives the probability of \((a,b]\times(c,d]\), not necessarily of the closed rectangle. In the discrete example, it gives \(0.25\), while the closed rectangle has probability \(0.70\). The correction is to use strict-threshold limits at included lower edges, or to add the relevant boundary probabilities explicitly.

The four-corner identity is useful because a joint CDF can encode discrete, continuous, singular, and mixed distributions. Once its four corner values—or the needed one-sided limits—are available, the probability of an axis-aligned rectangle follows without separately summing atoms or integrating a density. Always state the interval convention before substituting values, and check whether endpoint masses can affect the result.

Check Your Understanding

Answer each question by identifying the boundary convention as well as the calculation.

  1. Write the four-corner formula for \(P(a<X\le b,\ c<Y\le d)\), and explain why the lower-left term has a plus sign.
  2. How does the formula change when the \(X\)-interval is \([a,b]\) rather than \((a,b]\)?
  3. For an infinite upper endpoint in \(X\), what probability does \(F(\infty,y)\) represent?
  4. Why can the probability of \([a,b]\times[c,d]\) differ from that of \((a,b]\times(c,d]\)?
  5. For independent Uniform\((0,1)\) variables, calculate \(P(X>1/2,\ Y\le1/4)\) using the joint CDF and an infinite endpoint.