# How to evaluate R = max(X1,X2) - min(X1,X2)

How would you evaluate this if X1, X2 are independent exponentials?

I know what $min(X1,X2)$ is and what $max(X1,X2)$ is. However, while $min(X1,X2)$ is exponential with parameter (lambda1 + lambda2) -- the max is not.

Is the only way to proceed is to say:

1) Suppose $X_1 > X_2$. Then I find $Pr(R <= r) = Pr(X_1 - X_2 <= r)$ by doing a double integral. 2) Suppose $X_2 <X_1$. Then I find $Pr(R <= r) = Pr(X_2 - X_1 <= r)$ by doing a double integral. 3) Calculate the CDF as:

$Pr(X_1 - X_2 <= r) Pr(X_2 <= X_1) + Pr(X_2 - X_1 <= r)*Pr(X_1 <= X_2)$.

That should give me $Pr(R \leq r)$. I then would then differentiate with respect to r to get $F_R(r)$.

Is there perhaps a more clever way to do it?

Thanks!

• @StefanHansen: That doesn't help. I then get that $Pr(max(X_1,X_2) < x) = [1- exp(-\lambda_1 x)][1-exp(-\lambda_2 x)]$. Then what? I can't subtract CDF's as $F(R \leq r) = F(max(X_1,X_2) - min(X_1,X_2)) \neq F(max(X_1,X_2)) - F(min(X_1,X_2))$ – user1357015 Oct 4 '14 at 20:53
• One approach is to work out the distribution for $Y_i=X_i-X_{(1)}$, then try to find the distribution of $\max(Y_i)$, which it appears you know how to do. – Glen_b Oct 4 '14 at 21:20
• It also might be helpful to note that $\max(X_1,X_2)-\min(X_1,x_2)=((X_1+X_2)/2+|X_1+X_2|/2)-((X_1+X_2)/2-|X_1+X_2|/2)=|X_1-X_2|$. – Julius Vainora Oct 4 '14 at 23:54

For any $\alpha > 0$, $P\{X > \alpha\} = e^{-\lambda \alpha}, P\{Y > \alpha\} = e^{-\mu \alpha}$ and since $X$ and $Y$ are independent, these are also the values of the conditional probabilities that $X$ and $Y$ exceed $\alpha$ given the value of the other random variable. Consequently, \begin{align} P\{R > z\}&= P\{\max(X,Y) - \min(X,Y) > z\}\\ &= P\{X > Y+z\} + P\{Y > X+z\}\\ &= \int_0^\infty P\{X > y+z \mid Y = y\}f_Y(y)\,\mathrm dy + \int_0^\infty P\{Y > x+z \mid X = x\}f_X(x)\,\mathrm dx\\ &= \int_0^\infty e^{-\lambda(y+z)}\cdot\mu e^{-\mu y}\,\mathrm dy + \int_0^\infty e^{-\mu(x+z)}\cdot\lambda e^{-\lambda x}\,\mathrm dx\\ &= e^{-\lambda z}\int_0^\infty \mu\cdot e^{-(\lambda+\mu)y}\,\mathrm dy + e^{-\mu z}\int_0^\infty \lambda \cdot e^{-(\lambda + \mu)x}\,\mathrm dx\\ \end{align} Can you take it from here to get $P\{R > z\} = 1-F_R(z)$ and thus determine the density of $R$? You will get what is called a mixture of two exponential densities.