# Expected value of max function

Could anybody help me with solving such problem:

You are given two independent random variables $X$ and $Y$ with continuous uniform distribution. You are to find expected value $E$ of random variable $Z = \max(X,Y)$.

-

As Shai Covo said find the distribution function for this. Notice that:

P($\max (X,Y )\leq x$)=P($X\leq x$)P($Y\leq x$) as they are equaly distributed then you already have the distribution of the max then derive for density , multiply by x and integrate and that's it

in general I got $\displaystyle E[\max (X,Y )]=xF(x)\big|_{-\infty}^{\infty}-\int_{-\infty}^{\infty} F^2(x)dx$, for X, Y independent r.v both with distribution equal to F(x) and density f(x) and $E[\min (X,Y )]=2E[X]-E[\max (X,Y )]$

-
Indeed, integration by parts, as your answer suggests, is useful here (assuming that $X$ and $Y$ are i.i.d. uniform$[a,b]$ rv's). Specifically, letting $F_Z$ denote the distribution function of $Z$, we have $${\rm E}(Z) = \int_a^b {xf_Z (x)\,dx} = xF_Z (x)\big|_a^b - \int_a^b {F_Z (x)\,dx} = b - (b-a)/3,$$ which is equal to $\frac{{2b^2 - ab - a^2 }}{{3(b - a)}}$ (that I found by calculating $\int_a^b {xf_Z (x)\,dx}$). –  Shai Covo Jun 5 '11 at 11:43

Hint: First find the distribution function of $Z$, then its density function, then its expectation.

-
To check yourself, in the case where $X$ and $Y$ are independent ${\rm uniform}[a,b]$ random variables, ${\rm E}[Z] = \frac{{2b^2 - ab - a^2 }}{{3(b - a)}}$. –  Shai Covo Jun 5 '11 at 8:42
You should maybe mention, that this simplifies to $E[Z]=1/3 a+2/3 b$ –  Listing Jun 5 '11 at 9:12
Which some of us might prefer to write as $a+\frac23(b-a)$. –  Did Jun 5 '11 at 9:25