Question: Let X and Y be positive independent random variables, and
$$W=\max(X,Y)$$
Define the CDFs of X and Y as $F(x)$ and $G(y)$, respectively.
$$\Pr(W\le w)=\Pr(X\le w)\Pr(Y\le w)=F(w)G(w)$$

$$E[W]=\int\_0^{\infty}wF(w)g(w)dw+\int\_0^{\infty}wf(w)G(w)dw$$

In an [earlier post](https://math.stackexchange.com/questions/1087107/how-to-express-e-maxx-y-as-an-integral) the second answer says that "if X and Y are independent with uniform distribution on $(0,1)$, then $E[W]=2/3$." I am having trouble seeing how this is so. Please spell it out for me.

In particular, I am having trouble seeing how an integral like $$\int\_0^{\infty}wF(w)g(w)dw$$ can be evaluated since $F(w)$ is itself an integral. If $F(w)$ is the normal CDF, for example, it is already intractable. So it seems to me that integrating something with $F(w)$ in it must be super duper intractable.

Answer: 
> 
> "if X and Y are independent with uniform distribution on $(0,1)$ , then $\mathsf E[W]=2/3$ ." I am having trouble seeing how this is so. Please spell it out for me.
> 
> 
> 

For two independent and uniform distributions, we have:

$$\begin{align}
F(w) & = w \;\mathbf 1\_{(0;1)}(w)
\\ & = G(w) 
\\[1ex]
 f(w) & = \mathbf 1\_{(0;1)}(w) 
\\ & = g(w)
\\[2ex] 
\mathsf E(W) 
 & = \int\_0^\infty w \;F(w)\; g(w)\operatorname d w + \int\_0^\infty w \;f(w)\; G(w)\operatorname d w
\\[1ex] & = 2 \int\_0^\infty w \;F(w)\; f(w)\operatorname d w
\\[1ex] & = 2 \int\_0^\infty w\cdot w\;\mathbf 1\_{(0;1)}(w)\cdot \mathbf 1\_{(0;1)}(w) \operatorname d w
\\[1ex] & = 2 \int\_0^1 w^2\; \operatorname d w
\\[1ex] & = 2 \Big[\tfrac 1 3 w^3\Big]\_{w=0}^{w=1}
\\[1ex] & = \tfrac 2 3
\end{align}$$

---

Alternatively we can obtain this by:
$$\begin{align}
\mathsf E(\max(X,Y)) 
& = \int\_{-\infty}^\infty \int\_{-\infty}^\infty \max(x,y)\; f\_{X,Y}(x,y)\operatorname d y
\\[1ex] 
& = \int\_{-\infty}^\infty \int\_{\infty}^x x\; f\_X(x)\;f\_Y(y)\operatorname d y+\int\_x^\infty y\; f\_X(x)\,f\_Y(y)\operatorname d y \operatorname d x
\\[1ex] 
& = \int\_0^1 x \int\_0^x 1\operatorname d y+\int\_x^1 y \operatorname d y \operatorname d x
\\[1ex] 
& = \int\_0^1 x^2 + \tfrac 1 2 (1-x^2)\operatorname d x
\\[1ex] 
& = \tfrac 1 2 \int\_0^1 x^2 + 1\operatorname d x
\\[1ex] 
& = \tfrac 1 2 \Big[\tfrac 1 3 x^3 + x\Big]\_{x=0}^{x=1}
\\[1ex] 
& = \tfrac 2 3
\end{align}$$
For $X$ and $Y$ uniform (and independent) on $[0,1]$ we can find the cdf of $W=\max\{X,Y\}$ fairly easily:

$P(W\le w)=P(X\le w \wedge Y\le w)=w^2$ ($0\le w \le 1)$.

So the pdf of $W$ is $2w$ for $0\le w \le 1$ from there you can find the expected value of $W$.