Random number generation: probability of 2nd smallest >0.002

  • #1
psie
261
32
Homework Statement
One hundred numbers, uniformly distributed in the interval ##(0,1)## are generated by a computer. What is the probability that the largest number is at most ##0.9##? What is the probability that the second smallest number is at least ##0.002##?
Relevant Equations
The extreme order variables ##X_{(1)}=\min\{X_1,\ldots,X_{100}\}## and ##X_{(100)}=\max\{X_1,\ldots,X_{100}\}## have cdf ##F_{X_{(1)}}(x)=1-(1-F(x))^{100}## and ##F_{X_{(100)}}(x)=(F(x))^{100}## respectively, where ##F## is the cdf of the iid ##X_1,\ldots,X_{100}##.
The first question is fairly straightforward. The density of ##X## (i.e. one of the iid r.v.s. ##X_1,\ldots,X_{100}##) is just ##f(x)=1## for ##0<x<1## and ##0## otherwise. The cdf ##F## is therefore ##F(x)=x## for ##0<x<1##, ##F(x)=0## for ##x<0## and ##F(x)=1## for ##x>1##. In the first question, we are interested in \begin{align*} P(X_{(100)}<0.9)&=F_{X_{(100)}}(0.9) \\ &=(0.9)^{100}.\end{align*}For the 2nd question, I don't know how to approach this and I'm stuck. The cdf of arbitrary order variables has not been derived yet. I know we are looking for ##P(X_{(2)}>0.002)=1-P(X_{(2)}<0.002)##. But maybe there's a workaround. I only know the formulas in the relevant equations above. Grateful for any help.
 
Physics news on Phys.org
  • #2
Hi,

so the condition in the second question is met in two cases:
a) if all 100 numbers are > 0.002 -- which has a probability ...
b) if one number is < 0.002 AND all others are > 0.002

one number is < 0.002 has probability ...​
99 others > 0.002 probability ...​

##\ ##
 
Last edited:
  • Like
Likes Orodruin and psie
  • #3
BvU said:
Hi,

so the condition in the second question is met in two cases:
a) if all 100 numbers are > 0.002 -- which has a probability ...
b) if one number is < 0.002 AND all others are > 0.002

one number is < 0.002 has probability ...​
99 others > 0.002 probability ...​

##\ ##
Ok. So (a) occurs with probability \begin{align*}P(X_1>0.002,X_2>0.002,\ldots,X_n>0.002)&=\prod_{i=1}^{100} (1-P(X_i<0.002))\\ &=(1-F(0.002))^{100} \\ &=(0.998)^{100}\approx 0.819.\end{align*} But for (b), I am not sure how to proceed. We've got ##100## possibilities for one of the sample points to be less than ##<0.002## and all others ##>0.002##, right? Do we just multiply ##100## with $$P(X_1>0.002,X_2>0.002,\ldots,X_k<0.002,\ldots, X_n>0.002)?$$ If one has obtained the probability for (b), I am not sure how one obtains the (total) probability for the second question.
 
  • #4
Ok, I think I know now how to calculate the probability in (b). We are essentially making 100 trials and looking for success (i.e. that a number is greater 0.002) in 99 of the trials. The success probability is $$P(X>0.002)=1-P(X<0.002)=1-F(0.002)=0.998.$$ Now, the probability that the count ##Y=99## follows a binomial distribution, so $$P(Y=99)=\binom{100}{99} (0.998)^{99}(0.002)^{100-99}\approx 0.164.$$As (a) and (b) are disjoint events, we have that the probability for the 2nd question is $$0.164+0.819=0.983.$$That seems like a very high probability.
 
  • #5
I agree it's rather high.
I painted myself in a corner trying to get the result coming from the other side: there are ##\binom{100}{2}=4950## possible pairs. Require both ##\ <0.002## gives ##0.0198## --- which is not ## 1-0.9826 = 0.0174##.
Oh boy .... :nb)

##\ ##
 
  • #6
BvU said:
trying to get the result coming from the other side: there are ##\binom{100}{2}=4950## possible pairs. Require both ##\ <0.002## gives ##0.0198##
So that is the probability that exactly 2 numbers are less than 0.002. What happens if exactly 3 numbers are less than 0.002?
 
  • Like
Likes BvU
  • #7
I think the answer I got is correct. :smile:

We can check it via Wikipedia and WolframAlpha. The density of the 2nd order variable ##U_{(2)}## (see Wikipedia) is $$f_{U_{(2)}}(x) = \frac{100!}{98!} x (1-x)^{98}.$$Integrating from ##0.002## to ##1## gives (see WolframAlpha) approximately ##0.983##.
 
  • Like
Likes BvU
  • #8
pbuk said:
So that is the probability that exactly 2 numbers are less than 0.002. What happens if exactly 3 numbers are less than 0.002?
Yep, the check I tried was too hasty : forgot the (1-0.002)^98 and overlooked the 3, 4, 5, etc. o:)
Good catch !

##\ ##
 
  • #9
psie said:
I think the answer I got is correct. :smile:
So do I, although perhaps a little over-complicated getting there: you seem to have focussed on PDFs and CDFs but both parts of the problem can be more simply answered from binomial fundamentals.

psie said:
What is the probability that the largest number is at most ##0.9##?
This is the probability that all 100 numbers are less than 0.9: ## 0.9^{100} ##.

psie said:
What is the probability that the second smallest number is at least ##0.002##?
This is the probability that either:
- all 100 numbers are greater than 0.002: ## 0.998^{100} \approx 0.8186##; or
- exactly 1 number is less than 0.002: ## \binom{100}{1} 0.002^1 0.998^{99} \approx 0.1640 ##.
Adding the two (they are as you say mutually exclusive) gives the answer
$$ 0.998^{100} + \binom{100}{1} 0.002^1 0.998^{99} \approx 0.9826 $$

Note that you can often boost your confidence in an answer with a quick numerical simulation.
 
  • Like
Likes psie and BvU

Similar threads

Replies
3
Views
639
Replies
3
Views
713
Replies
6
Views
1K
Replies
1
Views
1K
Replies
1
Views
551
Replies
7
Views
2K
Back
Top