# Calculating inequality between $N$ uniform random variables

Let's say I have $$N$$ independent uniformly distributed random variables $$U(a_i, b_i)$$.

I'm wondering how I'd calculate: $$P(U_1 < U_2 \text{ & } U_1 < U_3 \cdots \text{ & } U_1 < U_N)$$

I'm assuming it is the same as $$1 - P(U_1 > U_2 \text{ or } U_1 > U_3 \cdots \text{ or }U_1 > U_N)$$ but I have no idea how to calculate that too.

When I do the simulations I can easily write these expressions and see that they are correct but I can't figure out the algorithm to calculate the numbers explicitly.

I can easily calculate $$P(U_1 < U_i)$$ but the joint probability is out of reach.

I've been thinking of just doing all possible permutations of $$U_1$$ being smaller than every other sequence of variables but it would be too slow.

• As your another question, it is pretty hopeless for general $a_i,b_i$. The best you can get is $\int_{a_1}^{\min_{i\ge 2} b_i} \prod_{i=2}^n (b_i-x) dx /\left(\prod_{i=1}^n (b_i-a_i)\right).$ Apr 11, 2020 at 12:11
• @zhoraster I've been trying to do it by hand for 3, 4 variables but can't seem to figure out the efficient way ($N = 400$). $P(U_1 < U_2)P(U_2 < U_3) + P(U_1 < U_3)P(U_3 < U_2)$ would be for three, but as the number of variable grows there's just too much (exponential) calculation needed. Apr 11, 2020 at 12:25
• @zhoraster What also occured to me is that maybe the full range $min(a_i), max(b_i)$ can be partitioned into equal ranges and then calculate the overlapping parts of individual variables as all having equal uniform distribution, that maybe has a closed form efficient solution. Apr 11, 2020 at 12:46
• Are the involved random variables independent? Apr 14, 2020 at 22:29
• @DavideGiraudo Yep. Apr 15, 2020 at 8:32

We use the fact that if $$(U_1,\dots,U_n)$$ is a vector of independent random variables, then for all measurable bounded function $$f\colon\mathbb R^n$$, $$\mathbb E\left[f(U_1,\dots,U_n)\right]=\int_{\mathbb R}f(u,U_2,\dots,U_n)d\mathbb P_{U_1}(u)$$ (this is a consequence of the fact that the law of $$(U_1,\dots,U_n)$$ is the product of the law of $$U_1$$ with that of $$(U_2,\dots,U_n)$$ and Fubini's theorem.
Applying this fact to $$f\colon (u_1,\dots,u_n)\mapsto \prod_{k=2}^n\mathbf 1\{u_1\lt u_k\}$$, we get that the wanted probability $$p$$ is $$p=\frac 1{b_1-a_1}\int_{a_1}^{b_1}\mathbb E\left[\prod_{k=2}^n\mathbf 1\{u_1\lt U_k\}\right]du_1$$ and using independence of the $$U_i$$, we derive that $$p=\frac 1{b_1-a_1}\int_{a_1}^{b_1} \prod_{k=2}^n\mathbb P\{u_1\lt U_k\} du_1,$$ which can be further simplified by computing $$\mathbb P\{u_1\lt U_k\}$$.
• What would you get calculating this with $U_1(1, 5)$, $U_2(1.2, 8)$, $U_3(0, 22)$, $U_4(0, 7)$? I assumed $\mathbb P\{u_1\lt U_k\}$ is 1 or 0 depending on the interval. I've tried splitting the integral into simple sections but can't get the ~0.398. Also, do we need to integrate the product or can it be applied separately? Apr 15, 2020 at 13:12
• " I assumed $\mathbb P\{u_1\lt U_k\}$ is 1 or 0 depending on the interval: actually no, it could be any value between 0 and 1 a priori. The point is that we have to look how the intervals $(a_1,b_1)$ and $(a_k,b_k)$ overlap. Apr 15, 2020 at 13:48