Let us suppose that we have a sample of 2 random distinct numbers $I=\{z_1,z_2\}$ that are generated from a uniform distribution with support in $[0,1]$. Let's call $d = \max{I}$ the maximum of the randomly generated sample.
I want to compute the probability that $z_1\leq r$ for some $0\leq r\leq1$ ($r$ is not a random variable) given that $z_1 \neq d$, i.e.
$$ p(z_1 \leq r | z_1 \neq d) $$
To easily compute this probability, we can notice that if $z_1\neq d$, then $z_1$ is the minimum, and therefore
$$ p(z_1 \leq r | z_1 \neq d) = p(\min I\leq r) = 1-p(z\geq r)^2 = 1 - (1-r)^2 $$
I have confirmed this result numerically on Mathematica
that you can check with the following code
checkDistribution[r_] :=
Module[{win = 0, loss = 0, list, max, i, n = 2},
For[i = 1, i <= 10000, i++,
list = RandomSample[Range[100 n], n]/(100 n) // N;
max = Max[list];
If[list[[1]] != max,
If[list[[1]]^(n - 1) <= r, win = win + 1, loss = loss + 1];];
];
Return[{r, win/(win + loss)} // N]]
points = Table[checkDistribution[r][[{1, 2}]], {r, 0, 1, 0.01}];
Show[points // ListPlot, Plot[2 r - r^2, {r, 0, 1}, PlotStyle -> Red]]
that returns
I want however to compute this probability without using the fact that $z_1$ is the minimum, but only using our knowledge that $d$ is the maximum. We should then consider the distribution of the maximum of two random variables. Since $d$ is the maximum, we have
$$ p(d\leq r) = r^2\\ p(d>r) = 1-r^2 $$
Now, we have two cases
- $d>r$, in which case $p(z_1 \leq r | z_1 \neq d) = p(d>r) p(z_1<r) = (1-r)\times r$
- $d\leq r$, in which case $p(z_1 \leq r | z_1 \neq d) = p(d<r) p(z_1<d) = r^2 \times 1$
but the sum of these two terms does not give the answer. Where is the mistake?
I want to solve this problem in the other way, because I want to generalize it to a set of 3 numbers $I=\{z_1,z_2,z_3\}$ and compute
$$ p(z_1 \leq r | z_1 \neq d)\,. $$ In this generalization, I don't know if $z_1$ is the minimum of the distribution.