# Distribution of sample median.

We are given a random sample of size $n$ and let the corresponding order statistics are as follows: $$Y_1 \leq Y_2 \leq Y_3.......Y_{n-1}\leq Y_n$$

The distribution of the sample median for $n$ even is required, so if $n=2k$ the sample median is given as : $\dfrac{Y_k + Y_{k+1}}{2}$

Also, the joint distribution of $Y_k,Y_{k+1}$ is given as follows (only defined for $x<y)$: $$f_{Y_k , Y_{k+1}}(x,y)=\frac{(2k)!}{((k-1)!)^2}[F(x)(1-F(x))]^{k-1}f(x)f(y)$$

Let $U=\dfrac{Y_k + Y_{k+1}}{2}$, starting off as follows:

$P(U\leq u)=P(\dfrac{Y_k + Y_{k+1}}{2}\leq u)=P(Y_k + Y_{k+1}\leq 2u)$

Thus, we are required to integrate the function $f(x,y)$ over the given shaded region:

Thus, the integral looks like this:$\int_{- \infty}^{u} \int_{x}^{2u-x}f(x,y)dydx$.

Is that expression okay ?

Because if I proceed further I get the result as $0$, whereas if I don't consider the condition $x<y$ the result is non-zero, but from the definition of the joint distribution of order statistics that condition is necessary, isn't it ?

Kindly help !

mistake: I think the joint distribution of $(Y_{(k)},Y_{(k+1)})$ is $$f_{Y_{(k)},Y_{(k+1)}}(x,y)=\frac{(2k)!}{((k-1)!)^2}[F(x)(1-F(y))]^{k-1}f(x)f(y)\mathbb{I}_{x\le y}$$ With this correction, you should get the proper cdf of the median from the double integral $$\int_{- \infty}^{u} \int_{x}^{2u-x}f(x,y)\,\text{d}y\text{d}x$$ that indeed incorporates the constraint $x<y$ (or $x\le y$).