# CDF of $\max(x_1,x_2)+\max(x_3,x_4)$ where all $x_i$s are iid from $U[a,b]$

I am looking for the cumulative density function of the sum of two variables, which are themselves the result of a rank order process.

Thus, if $x_1, x_2, x_3$ and $x_4$ are all independent draws from a uniform distribution with support $[a,b]$, what is the CDF for $\max(x_1,x_2)+\max(x_3,x_4)$?

Thanks.

-

Let $X=\max\{x_1,x_2\}$. We find the density function of $X$. We have that $F_X(x)=\mathbb{P}\{X\leq x\}=\mathbb{P}\{\max\{x_1,x_2\}\leq x\}=\mathbb{P}\{x_1\leq x \cap x_2\leq x\}=\mathbb{P}\{x_1\leq x\}\mathbb{P}\{x_2\leq x\}$. Because they are uniformly distributed, it follows that the above is just the product of the cdfs of your original uniform distribution. Therefore $F_X(x)=(\frac{x-a}{b-a})^2$ whenever $x\in[a.b)$. From this it follows that $f_X(x)=\frac{2(x-a)}{(b-a)^2}$. Similarly, if $Y=\max\{x_3,x_4\}$, you have that $f_Y(y)=\frac{2(y-a)}{(b-a)^2}$. Now let $Z=X+Y$. You have that $Z\leq 2b$ with probability one and $Z\leq 2a$ with probability 0. For $z\in[2a,2b)$ you have $F_Z(z)=\mathbb{P}\{Z\leq z\}=\mathbb{P}\{X+Y\leq z\}=\int_A f_{X,Y}(x,y) dA$ Because of independence of $x_1,x_2,x_3$ and $x_4$ you have that $X$ and $Y$ are independent. This means that $f_{X,Y}(x,y)=f_X(x)f_Y(y)$. Therefore, $F_Z(z)=\int_A f_X(x)f_Y(y) dA=\int_{-\infty}^\infty\int_{-\infty}^{z-x}f_X(x)f_Y(y)dydx=\int_{-\infty}^\infty f_X(x)\int_{-\infty}^{z-x}f_Y(y)dydx=\int_a^b f_X(x)\int_a^{z-x}f_Y(y)dydx=\int_a^b f_X(x) (\frac{a+x-z}{b-a})^2dx=\frac{1}{(b-a)^4}\int_a^b 2(x-a)(a+x-z)^2 dx=\frac{1}{12(a-b)^2}(11a^2+10ab-16az +3b^2-8bz+6z^2)$. I hope this is correct.

-
Thanks. Been working on this and got to the point where I have the PDFs and CDFs of x and y correct as as yours. I follow most of the rest of your derivations, but your result produces a strictly convex to the origin CDFs and therefore negative probabilities over some range. I have tried to take it from the double integrals in Mathematica. I get something close but slightly different but still with implausible results. –  user58641 Jan 17 '13 at 21:02
I could've made a typo, but notice also that you have $z\in[2a,2b)$. So the cdf is zero for all $z<2a$, whatever that integral turns out to be for $z\in[2a,2b)$ and 1 for $z\geq 2b$. –  mathemagician Jan 17 '13 at 21:15
Got that. I am only plotting from 2a to 2b but there appears to be something not quite right in the development of the integrals since trying to go back up and replicating your steps I get similar results. –  user58641 Jan 17 '13 at 21:19
if somebody could point at the mistake that would be highly appreciated –  mathemagician Jan 17 '13 at 22:01
Suppose $u,v$ are i.i.d. $U(0,1)$. Then for any $w\in[0,1]$, $\operatorname{Pr}(\max(u,v)\le w)=w^2$. Hence the density of $W=\max(u,v)$ is given by $f(w)=2w$. Therefore, if $X=(\max(x_1,x_2)-a)/(b-a)$ and $Y=(\max(x_3,x_4)-a)/(b-a)$, the densities of $X$ and $Y$ on $[0,1]$ are $2x$ and $2y$ respectively.
Now let $Z=X+Y=\left[\max(x_1,x_2)+\max(x_1,x_2)-2a\right]/(b-a)$. Then for any $m\in[0,\,2]$, we have $$\phantom{=}\operatorname{Pr}\left(Z\le m\right) =\begin{cases} \int_0^m \int_0^{m-y} 4xy\, dx dy=\frac{m^4}{6} &\text{ if } m\le1,\\ 1-\int_{m-1}^1 \int_{m-y}^1 4xy\, dx dy = 1-\frac16m(m-2)^2(m+4) &\text{ otherwise}. \end{cases}$$
@D. The density may exceed $1$. Why not? The standard normal density evaluated at $x=0$, for instance, approaches infinity when the standard deviation $\sigma$ approaches zero. By the way, I've verified the formula using computer simulation. With a million simulation trials, the above formula agrees with the simulation value to three decimal places for $m=0.1,0.2,\ldots,1.9$. –  user1551 Jan 17 '13 at 23:54
@D. I don't have any reference. For $m\le1$, I just integrated the joint density function over the triangular domain bounded by the $x$-axis, the $y$-axis and the line $x+y=m$. For $m\ge1$, I integrated the density over the triangular domain bounded by $x=1$, $y=1$ and $x+y=m$, and then subtract the result from $1$. –  user1551 Jan 18 '13 at 1:08