Covariance of [$X_{(1)}$, $X_{(n)}$] from $\operatorname{Unif}(a,b)$ I would like to know how to calculate the Covariance between the minimum and maximum order statistics from an arbitrary uniform distribution.
I am trying to fill in a gap between the answers here: Question 1 and here: Question 2 by taking the approach of finding $E[XY]-E[X]E[Y]$ where $X=X_{(1)},Y=X_{(n)}$.
I have already determined $E[X]=\frac{na+b}{b-a}$ and $E[Y]=\frac{a+nb}{b-a}$.
I am using the following to calculate $E[XY]$:
$$E[XY]=\int_a^b\int_a^bxyf_{X,Y}(x,y)dxdy$$

Using the above formula with i=1 and j=n,
$$f_{X,Y}(x,y)=\frac{n!}{(n-2)!}f_X(x)f_X(y)[F_X(y)-F_X(x)]^{n-2}$$
Now $f_X(x)=\frac{1}{b-a}$ and $F_X(x)=\frac{x-a}{b-a},a<x<b$. This gives:
$$E[XY]=\int_a^b\int_a^bxy\frac{1}{(b-a)^2}[\frac{y-x}{b-a}]^{n-2}dxdy$$
$$=\int_a^b\int_a^bxy(b-a)^{-n}[y-x]^{n-2}dxdy$$
Calculating this double integral is where I am stuck. In the $\operatorname{Unif}(0,1)$ case I have seen Beta functions used to solve it, but I am not well-versed enough to do so outside of the standard uniform. Any advice is welcome, thank you!
 A: I would like to recommend that you perform a suitable location-scale transformation so that you can consider the various moments and covariance for the order statistics of a uniform distribution on $[0,1]$, rather than in the general case; then exploit linearity of expectation to recover the general case.
For instance, the joint density of the minimum and maximum order statistics becomes
$$f_{X,Y}(x,y) = n(n-1)(y-x)^{n-2}, \quad 0 \le x \le y \le 1.$$  Then
$$\begin{align}
\operatorname{E}[XY] 
&= \int_{x=0}^1 \int_{y=x}^1 n(n-1) xy(y-x)^{n-2} \, dy \, dx \\
&= n(n-1) \int_{x=0}^1 x \left(\left[ y \cdot \frac{(y-x)^{n-1}}{n-1} \right]_{y=x}^1 - \int_{y=x}^1 \frac{(y-x)^{n-1}}{n-1} \, dy \right) \, dx \\
&= n \int_{x=0}^1 x \left( (1-x)^{n-1} - \left[ \frac{(y-x)^n}{n}\right]_{y=x}^1 \right) \, dx \\
&= n \int_{x=0}^1 x(1-x)^{n-1} \, dx - \int_{x=0}^1 x(1-x)^n \, dx \\
&= \frac{1}{n+1} - \frac{1}{(n+1)(n+2)} \\
&= \frac{1}{n+2}.
\end{align}$$
Now we can transform the variables back, so that if $$X_{(1)} = a + (b-a)X, \quad X_{(n)} = a + (b-a)Y,$$ then
$$\begin{align}
\operatorname{E}[X_{(1)} X_{(n)}] 
&= \operatorname{E}[a^2 + a(b-a)(X+Y) + (b-a)^2 XY] \\
&= a^2 + a(b-a)(\operatorname{E}[X] + \operatorname{E}[Y]) + (b-a)^2 \operatorname{E}[XY].
\end{align}$$
It is straightforward to evaluate $\operatorname{E}[X]$ and $\operatorname{E}[Y]$, and I leave the rest of the computation as an exercise.
