Joint distribution of range $(R=X_n-X_1)$ and mid-range $(V=\frac{1}{2}(X_1+X_n)$order statistics
Solution from Casella and Berger:
Joint density of $X_{(1)},X_{(n)}$:
$\Large f_{X_{(1)}, X_{(n)}}(x_1,x_n) = \frac{n(n-1)}{a^2}(\frac{x_n}{a}-\frac{x_1}{a})^{n-2}$
We know that $X_{(1)} = V - R/2$ and $X_{(n)} = V + R/2$. The Jacobian is $|-1| = 1$.
The transformation maps {$(x_1,x_n): 0 < x_1< x_n <a$ } onto the set {$(r,v): 0 < r< a, r/2<v<a-r/2$ } .
Therefore, the joint pdf of (R,V) is:
$\Large f_{R,V}(r,v) = \frac{n(n-1)r^{n-2}}{a^n}$
The marginal pdf of R is:
$\Large f_R(r)= \int_{r/2}^{a-r/2}\frac{n(n-1)r^{n-2}}{a^n}dv$
= $\Large \frac{n(n-1)r^{n-2}(a-r)}{a^n}$, $0<r<a$.
If a = 1, then r has a beta(n-1,2) distribution.
The marginal pdf of V is:
$\Large f_V(v) = \int_0^{2v}\frac{n(n-1)r^{n-2}}{a^n}dr$
= $\Large \frac{n(2v)^{n-1}}{a^n}$, $0<v \leq a/2$,
and
$\Large f_V(v) = \int_0^{2(a-v)}\frac{n(n-1)r^{n-2}}{a^n}dr$
= $\Large \frac{n[2(a-v)]^{n-1}}{a^n}$, $a/2<v \leq a$.