# Calculating the covariance of a given random vector in the unit square

Lets say there exists a random vector $$(X,Y)$$ evenly distributed in the unit square $$[0,1]^2$$. Now lets introduce the following two new random variables $$U=min(X,Y)$$ and $$V=max(X,Y)$$, what is the value of $$Cov(U,V)$$.

I have an idea of what I should, use directly the definition of the covariance,

$$Cov(U,V)=EUV-EUEV = EXY-EUEV=EXEY-EUEV=\frac{1}{4}-EUEV$$

But the real problem is I have no idea how to get the density functions of $$X$$ and $$Y$$. If anybody has a hint or an idea it would be great.

• What is the probability that both $X$ and $Y$ are less then a given value $c, 0 \le c \le 1$: $P(X < c, Y < c) =$?. If you can answer this, use the result to find $P(V < c)$. – Ingix Oct 16 '18 at 16:41
• I know how to calculate $V$ and $U$ if I have $X,Y$, the problem I have is how to actually find the density function of $X and Y$ separately (should be the easiest part for some reason can't actually get it). – danielt17 Oct 16 '18 at 16:48
• evenly distributed in the unit square gives you the density function... – karakfa Oct 16 '18 at 17:31

By definition, $$U = \min(X,Y) = \begin{cases} X & ,~ \text{in the upper triangle of the unit square} \\ Y & ,~ \text{in lower triangle} \end{cases}$$ With the upper triangle region being the first integral (and the lower region being the 2nd integral), \begin{align} E[U] &= \int_{y = 0}^1 \left[ \int_{x = 0}^y 1\cdot x\, \mathrm{d}x \right]\, \mathrm{d}y + \int_{x = 0}^1 \left[ \int_{y = 0}^x 1\cdot y\, \mathrm{d}y \right]\, \mathrm{d}x \\ &= \int_{y = 0}^1 \frac{y^2}2\, \mathrm{d}y + \int_{x = 0}^1 \frac{x^2}2\, \mathrm{d}x \\ & = \frac13 \end{align} Similarly, for $$V = \max(X,Y)$$, we have \begin{align} E[V] &= \int_{y = 0}^1 \left[ \int_{x = 0}^y 1\cdot \color{magenta}{y}\, \mathrm{d}x \right]\, \mathrm{d}y + \int_{x = 0}^1 \left[ \int_{y = 0}^x 1\cdot \color{magenta}{x}\, \mathrm{d}y \right]\, \mathrm{d}x \\ &= \int_{y = 0}^1 y^2\, \mathrm{d}y + \int_{x = 0}^1 x^2\, \mathrm{d}x \\ & = \frac23 \end{align} Let me know if you need anything clarified.