# Covariance of minimum and maximum of uniformly distributed random variables

Let $(X_1,X_2,\ldots,X_n)$ be iid, such that each $X_i$ has the uniform distribution on the interval $(a,b)$. Calculate $Cov(\min(X_1,\ldots,X_n),\max(X_1,\ldots,X_n))$.

The task seems very hard to me. So far I calculated $E(\min(X_1,\ldots,X_n))=\frac{an+b}{n+1}$, $E(\max(X_1,\ldots,X_n))=\frac{bn+a}{n+1}$. I also found the joint density of $(\min(X_1,\ldots,X_n),\max(X_1,\ldots,X_n))$ - it is as follows: $$f(x,y)=\left\{ \begin{array}{ll} \frac{n!}{\left( n-2\right) !}\frac{\left(y-x\right)^{n-2}}{\left(b-a\right)^{n}} & \text{ if }a\leq x\leq y\leq b \\ 0 & \text{in other cases.}% \end{array}% \right.$$ So now the task is to calculate $E(\min(X_1,\ldots,X_n)\cdot\max(X_1,\ldots,X_n))$. How to do this effectively?

-
hint : calculate probability that min is in [x, x+dx] and max is in [y, y+dy] and then use double integrals –  Thomas Feb 15 '14 at 15:00
Thomas, I have obtained the density $f$ using this method. I am able to write the double integral $E(\min(X_1,\ldots,X_n)\cdot\max(X_1,\ldots,X_n))$, however I just can't calculate it effectively. I have written the integral as iterated integral and just can't calculte it. Can you help? –  Almost sure Feb 15 '14 at 15:56
Your joint density is wrong in two respects: first, the power on the $(b-a)$ term ... and second, why is the domain of support constrained to $0<x<y<1$, when you have defined the domain of support of the parent on $(a,b)$? –  wolfies Feb 15 '14 at 16:52
@Almostsure The integral is not that complicated. As a variable of y it is a polynomial. The integrand is a polynomial in x too. (and you keep the factorized form) –  Thomas Feb 15 '14 at 17:43

If you have to solve an integral like this $\int y(y-x)^{n}dy$ the more easy way is an integration by parts

$\int y(y-x)^{n}dy=\int y d\frac{(y-x)^{n+1}}{n+1}=y\frac{(y-x)^{n+1}}{n+1}-\int \frac{(y-x)^{n+1}}{n+1}dy=$

$=y\frac{(y-x)^{n+1}}{n+1}-\frac{(y-x)^{n+2}}{n+2}$

-
Kmitov! (1) Thanks for your remark. (2) The last fraction in your comment should be as follows: $\frac{\left( y-x\right) ^{n+2}}{\left( n+2\right) \left( n+1\right) }$. –  Almost sure Feb 15 '14 at 21:23
(2) above is of course wrong, sorry. –  Almost sure Feb 15 '14 at 21:36

Given: random variable $X \sim Uniform(a,b)$ with pdf $f(x)$:

where I am assuming, without loss of generality, that $0<a<b$.

Then, the joint pdf of the sample minimum $X_1$ and the sample maximum $X_n$, say $g(x_1,x_n)$, is:

where I am using the OrderStat function in the mathStatica add-on to Mathematica to automate the nitty-gritties for me.

Then, $Cov(X_1, X_n)$ is simply:

All done.

Notes

1. The joint density $g(x_1,x_n)$ is different to that you have obtained manually ... note the power on the $(b-a)$ term.
2. As disclosure, I should perhaps add that I am one of the authors of the software used above.
-
Wolfies, thanks for pointing my mistake. I've edited the density. –  Almost sure Feb 15 '14 at 17:55
The complete solution, with the nitty-gritties ;-) is here: math.stackexchange.com/questions/677504/… –  Almost sure Feb 16 '14 at 11:51