# Generalization to N dimensions of distribution function evaluation over an hyper- rectangle

Let's consider a absolutely continuous random vector $V \equiv (X,Y)$ and its associated joint distribution function $F(x,y)=Pr(X<=x,Y<=y) = \int_{-\infty}^{x}\int_{-\infty}^{y} f(x,y)dxdy$.

If we take four points in the xy plane that are vertexes of a rectangle $R$, $A \equiv (x_1,y_1) \;, B \equiv (x_1,y_0) \;,C \equiv (x_0,y_0) \;,A \equiv (x_0,y_1)$, with $x_1 > x_0$ and $y_1>y_0$, it is well known that the probability that the values of the random vector $V$ are within the rectangle $R$ is given by the value of the distribution function $F(x,y)$ taken at those points according to the below formula:

$Pr(x_0<X<=x_1,y_0<Y<=y_1)=F(x_1,y_1)-F(x_1,y_0)+F(x_0,y_0)-F(x_0,y_1)$

Is there an explicit formula, generalizing the one above, that applies when we move from 2 to N dimensions ?

In other words, given the distribution function $F(x_1,...,x_N)=Pr(X1<=x1,..,X_N<=x_N)$, it is there a formula that allows to compute $Pr(a_1<X_1<=b_1,...,a_N<X_N<=b_N)$ by the values of the N-dimensional distribution function computed in the vertexes of the hyper-rectangle $[a1,b1]x..x[a_N,b_N]$ ?

What happens if values $a_i$ or $b_j$ are allowed to be $+\infty$ ?

In two dimensions we find the value of the 1-dimensional marginal distributions $F_i(x)$, what's found in the N-dimensional case ?

From computational point of view, is this formula applicable in practice for value of N equal to 10 ? I suppose it involves $2^{10}$ vertexes ...

-
Inclusion-exclusion –  Henry Mar 28 '12 at 9:20

Here is the formula you are looking for: $$\color{red}{\mathrm P(a_i\lt X_i\leqslant b_i\ \text{for all}\ i)=\sum_c(-1)^{n(c)}F(c_1,c_2,\ldots,c_n)}$$ The sum in the RHS runs over the $2^n$ vectors $c=(c_i)_{1\leqslant i\leqslant n}$ such that $c_i\in\{a_i,b_i\}$ for every $1\leqslant i\leqslant n$, and $n(c)$ denotes the number of indices $i$ such that $c_i=a_i$.
The simplest proof might be to note that the LHS if the expectation of the random variable $$\prod_{i=1}^n\left(\mathbf 1_{X_i\leqslant b_i}-\mathbf 1_{X_i\leqslant a_i}\right)=\sum_c(-1)^{n(c)}\prod_{i=1}^n\mathbf 1_{X_i\leqslant c_i},$$ and to take the expectation of the RHS, remembering that the expectation is a linear operator and that, for every $c$, $$\mathrm E\left(\prod_{i=1}^n\mathbf 1_{X_i\leqslant c_i}\right)=\mathrm P(X_i\leqslant c_i\ \text{for all}\ i)=F(c_1,c_2,\ldots,c_n).$$