# Bapat–Beg theorem

In probability theory, the Bapat–Beg theorem gives the joint probability distribution of order statistics of independent but not necessarily identically distributed random variables in terms of the cumulative distribution functions of the random variables. Ravindra Bapat and M.I. Beg published the theorem in 1989, though they did not offer a proof. A simple proof was offered by Hande in 1994.
Often, all elements of the sample are obtained from the same population and thus have the same probability distribution. The Bapat–Beg theorem describes the order statistics when each element of the sample is obtained from a different statistical population and therefore has its own probability distribution.

## Statement

Let $X_{1},X_{2},\ldots ,X_{n}$ be independent real valued random variables with cumulative distribution functions respectively $F_{1}(x),F_{2}(x),\ldots ,F_{n}(x)$. Write $X_{(1)},X_{(2)},\ldots ,X_{(n)}$ for the order statistics. Then the joint probability distribution of the $n_{1},n_{2}\ldots ,n_{k}$ order statistics (with $n_{1}<n_{2}<\cdots <n_{k}$ and $x_{1}<x_{2}<\cdots <x_{k}$) is
    ${\begin{aligned}F_{X_{(n_{1})},\ldots ,X_{(n_{k})}}(x_{1},\ldots ,x_{k})&=\Pr(X_{(n_{1})}\leq x_{1}\land X_{(n_{2})}\leq x_{2}\land \cdots \land X_{(n_{k})}\leq x_{k})\\&=\sum _{i_{k}=n_{k}}^{n}\cdots \sum _{i_{2}=n_{2}}^{i_{3}}\sum _{i_{1}=n_{1}}^{i_{2}}{\frac {P_{i_{1},\ldots ,i_{k}}(x_{1},\ldots ,x_{k})}{i_{1}!(i_{2}-i_{1})!\cdots (n-i_{k})!}},\end{aligned}}$
where
    ${\begin{aligned}P_{i_{1},\ldots ,i_{k}}(x_{1},\ldots ,x_{k})=\operatorname {per} {\begin{bmatrix}F_{1}(x_{1})\cdots F_{1}(x_{1})&F_{1}(x_{2})-F_{1}(x_{1})\cdots F_{1}(x_{2})-F_{1}(x_{1})&\cdots &1-F_{1}(x_{k})\cdots 1-F_{1}(x_{k})\\F_{2}(x_{1})\cdots F_{2}(x_{1})&F_{2}(x_{2})-F_{2}(x_{1})\cdots F_{2}(x_{2})-F_{2}(x_{1})&\cdots &1-F_{2}(x_{k})\cdots 1-F_{1}(x_{k})\\\vdots &\vdots &&\vdots \\\underbrace {F_{n}(x_{1})\cdots F_{n}(x_{1})} _{i_{1}}&\underbrace {F_{n}(x_{2})-F_{n}(x_{1})\cdots F_{n}(x_{2})-F_{n}(x_{1})} _{i_{2}-i_{1}}&\cdots &\underbrace {1-F_{n}(x_{k})\cdots 1-F_{n}(x_{k})} _{n-i_{k}}\end{bmatrix}}\end{aligned}}$
is the permanent of the given block matrix. (The figures under the braces show the number of columns.)

### Independent identically distributed case

In the case when the variables $X_{1},X_{2},\ldots ,X_{n}$ are independent and identically distributed with cumulative probability distribution function $F_{i}=F$ for all i the theorem reduces to
    ${\begin{aligned}F_{X_{(n_{1})},\ldots ,X_{(n_{k})}}(x_{1},\ldots ,x_{k})=\sum _{i_{k}=n_{k}}^{n}\cdots \sum _{i_{2}=n_{2}}^{i_{3}}\sum _{i_{1}=n_{1}}^{i_{2}}n!{\frac {F(x_{1})^{i_{1}}}{i_{1}!}}{\frac {(1-F(x_{k}))^{n-i_{k}}}{(n-i_{k})!}}\prod \limits _{j=2}^{k}{\frac {\left[F(x_{j})-F(x_{j-1})\right]^{i_{j}-i_{j-1}}}{(i_{j}-i_{j-1})!}}.\end{aligned}}$

## Remarks

* No assumption of continuity of the cumulative distribution functions is needed.
* If the inequalities x$_1$ < x$_2$ < ... < x$_k$ are not imposed, some of the inequalities "may be redundant and the probability can be evaluated after making the necessary reduction."

## Complexity

Glueck and co-authors note that the Bapat‒Beg formula is computationally intractable, because it involves an exponential number of permanents of the size of the number of random variables. However, when the random variables have only two possible distributions, the complexity can be reduced to $O(m^{2k})$. Thus, in the case of two populations, the complexity is polynomial in $m$ for any fixed number of statistics $k$.