# How can I calculate the probability that one random variable is bigger than a second one?

I have five random variables which are independent and each one of them has a continuous uniform distribution on the interval $$[0,2]:$$
$$X_i = \operatorname{Uniform}[0,2].$$

I want to calculate the probability $$\Pr(\min(X_1, X_2, X_3)\gt \max(X_4, X_5)).$$

I’m aware there is combinatorial solution, but I’m trying to solve this problem using coordinates with $$X$$ as the minimum and $$Y$$ as the maximum, but I don’t know how to sketch the function and calculate the function space in order to know the probability.

To be brutally mindless about it, we may begin with the full five-dimensional integral and then proceed to evaluate it. Because this is carried out over a region in $$\mathbb{R}^5,$$ I will not attempt to sketch it :-).

As a simplification of the notation (and to reveal the ideas), let the joint density of $$(X_1,X_2,X_3)$$ be $$f_{123}$$ and the joint density of $$(X_4,X_5)$$ be $$f_{45}.$$ Then, with $$P = \Pr(\min(X_1,X_2,X_3) \gt \max(X_4,X_5)),$$

$$P = \iint f_{45}(x_4,x_5) \iiint_{\max(x_4,x_5)} f_{123}(x_1,x_2,x_3)\,\mathrm{d}x_1\mathrm{d}x_2\mathrm{d}x_3\ \mathrm{d}x_4\mathrm{d}x_5.$$

The first (double) integral extends over all $$\mathbb{R}^2$$ while the second (triple) integral extends only over those points $$(x_1,x_2,x_3)$$ in $$\mathbb{R}^3$$ where all three coordinates exceed both $$x_4$$ and $$x_5.$$

It is usually easiest to deal with a maximum in an integral’s endpoint by breaking the integral into parts: almost surely either $$X_4$$ or $$X_5$$ will be the larger of those two and these two events (namely, $$\mathcal{E}_4:X_4=\max(X_4,X_5)$$ and $$\mathcal{E}_4:X_5=\max(X_4,X_5)$$) are mutually exclusive. Therefore we may compute the probabilities of these two events and add them.

Because $$X_4$$ and $$X_5$$ are iid, they are exchangeable, implying $$\mathcal{E}_4$$ and $$\mathcal{E}_5$$ have the same probability. Consequently, taking the case $$X_4\gt X_5$$ (event $$\mathcal{E}_4$$), we obtain

$$P = 2\int\int_{x_5} f_{45}(x_4,x_5) \iiint_{x_4} f_{123}(x_1,x_2,x_3)\,\mathrm{d}x_1\mathrm{d}x_2\mathrm{d}x_3\ \mathrm{d}x_4\mathrm{d}x_5.$$

Specializing now to iid uniform$$[0,1]$$ variables we may compute this integral using the most elementary techniques as

\begin{aligned} P &= 2\int_0^1\int_{x_5}^1\int_{x_4}^1\int_{x_4}^1\int_{x_4}^1\,\mathrm{d}x_1\mathrm{d}x_2\mathrm{d}x_3\mathrm{d}x_4\mathrm{d}x_5 \\ &= 2\int_0^1\int_{x_5}^1 \left(\int_{x_4}^1\mathrm{d}x_1\right)\left(\int_{x_4}^1\mathrm{d}x_2\right)\left(\int_{x_4}^1\mathrm{d}x_3\right)\,\mathrm{d}x_4\mathrm{d}x_5 \\ &= 2\int_0^1\int_{x_5}^1(1-x_4)^3\mathrm{d}x_4\mathrm{d}x_5 \\ &= 2\int_0^1 \frac{1}{4}(1-x_5)^4\,\mathrm{d}x_5 \\ &= 2\left(\frac{1}{4}\right)\left(\frac{1}{5}\right) = \frac{1}{10}. \end{aligned}

This gives the answer for any continuous iid variables with common density $$f$$ because the Probability Integral Transform

$$u(x) = \int^x f(t)\,\mathrm{d}t,$$

converts the variables $$(X_1,\ldots, X_5)$$ into variables $$U_i = u(X_i)$$ that are iid with a Uniform$$[0,1]$$ distribution without changing the order statistics, thereby leading to the calculation of $$P$$ that was just performed.