# Joint PDF about Order Statistics

Random variable $x$ is described by a PDF which is a constant between $x_0=0$ and $x_0=1$ and which is zero otherwise. $K$ independent successive experimental values of this random variable are labeled $d_1,d_2,…,d_K$.

Define the random variables

$$r = \text{second largest of} \: d_1, d_2, \dots , d_K \\ s = \text{second smallest of} \: d_1, d_2, \dots , d_K$$

and determine the joint probability density function $f_{r,s}(r_0,s_0)$ for all values of $r_0$ and $s_0$.

Someone mentioned that try to use order statistics to solve it and give the formula link, but I still have no idea how to apply it.

Could anyone give me the details? thanks.

p.s. the exercise is under the random variables chapter of probability chapter 2(the introduction undergraduate textbook), and I deeply wonder the exercise is suitable for this level?

You have a uniform distribution, $f_D(d) ~=~ \mathbf 1_{d\in[0;1]}$ and $F_X(d) ~=~ d\mathbf 1_{d\in [0;1)}+\mathbf 1_{d\in[1;\infty)}$
The order statistics you want are the second largest, $r=d_{(k-1)}$ and second smallest, $s=d_{(2)}$.
Then applying the formula is simply a matter of substitution: $i=2, j=k-1, u=s_0, v=r_0, n=k$
\begin{align}f_{r,s}(r_0, s_0) ~=~& f_{d_{(2)}, d_{(k-1)}}(s_0, r_0)\\[1ex] =~& \dfrac{k! ~F_D(s_0)^1~f_D(s_0)~(F_D(r_0)-F_D(s_0))^{k-4}~f_D(r_0)~(1-F_D(r_0))^1}{1!~(k-4)!~1!}\\[1ex] =~& \dfrac{k! ~s_0~(r_0-s_0)^{k-4}~(1-r_0)}{(k-4)!}\end{align}