# Find the joint distribution of the original variables with the largest two order statistics

$$k$$ independent variables $$X_1, X_2,...,X_k$$, each has a distribtion with CDF $$F_1(x), F_2(x),...,F_k(x)$$. Each time we randomly take a sample of each variable (denoted as $$x_1, x_2,...,x_k$$) and calculate the respective CDF value (denoted as $$u_1, u_2,...,u_k$$ since each is uniformly distributed over the interval $$(0,1)$$). If we take out the two varibles with the largest CDF values (namely, $$u_{(K)}$$ and $$u_{(k-1)}$$ in order statistics).

Now we want to find the joint distribution of the original two varibles with the largest distribution.

Here is a result I got, but it is not agree with the simulation result. \begin{equation} \begin{aligned} &F_{Y,Z}(y,z)\\ &=\mathbb{P}[Y\leq y,Z\leq z]\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}\mathbb{P}[Y_i\leq y,Z_j\leq z, \text{assuming i-th user has the largest CDF value,}\\ &\ \text{j-th user has the 2nd largest CDF value}]\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}\mathbb{P}[Y_i\leq y,Z_j\leq z, U_i > U_j> U_l, \forall l\neq i, j]\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}\mathbb{P}[Y_i\leq y,Z_j\leq z, F_{i}(\bar{y}) > F_{j}(\bar{z})> U_l, \forall l\neq i, j]\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}\int_{0}^{z}\int_{F_{i}^{-1}(F_{j}(\bar{z}))}^{y}[F_{j}(\bar{z})]^{k-2}dF_{i}(\bar{y})dF_{j}(\bar{z})\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}\int_{0}^{z}\int_{F_{j}(\bar{z})}^{F_{i}(y)}dtF_{j}(\bar{z})^{k-2}dF_{j}(\bar{z})\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}\int_{0}^{z}(F_{i}(y)-F_{j}(\bar{z}))F_{j}(\bar{z})^{k-2}dF_{j}(\bar{z})\\ &=\sum_{i=1}^{k}\sum_{j=1,j\neq i}^{k}(\frac{1}{k-1}F_{i}(y)[F_{j}(z)]^{k-1}-\frac{1}{k}[F_{j}(z)]^{k})\\ \end{aligned} \end{equation}