Random number generation: probability of 2nd smallest >0.002

Click For Summary
SUMMARY

The discussion focuses on calculating the probability that the second smallest number in a sample of 100 independent and identically distributed random variables is greater than 0.002. The probability is derived using cumulative distribution functions (CDFs) and binomial distribution principles. The final result is approximately 0.9826, calculated by considering two mutually exclusive cases: all numbers being greater than 0.002 and exactly one number being less than 0.002. The use of binomial coefficients and integration of probability density functions (PDFs) is also highlighted for verification.

PREREQUISITES
  • Understanding of cumulative distribution functions (CDFs)
  • Familiarity with binomial distribution and binomial coefficients
  • Knowledge of probability density functions (PDFs)
  • Basic concepts of independent and identically distributed (iid) random variables
NEXT STEPS
  • Study the properties of cumulative distribution functions (CDFs) in detail
  • Learn about binomial distribution applications in probability theory
  • Explore the integration of probability density functions (PDFs) for continuous random variables
  • Investigate numerical simulation techniques for validating probability calculations
USEFUL FOR

Statisticians, data scientists, and anyone involved in probability theory and statistical analysis will benefit from this discussion, particularly those working with random variables and probability distributions.

psie
Messages
315
Reaction score
40
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
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   Reactions: Orodruin and psie
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.
 
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.
 
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)

##\ ##
 
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   Reactions: BvU
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   Reactions: BvU
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 !

##\ ##
 
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   Reactions: psie and BvU

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 21 ·
Replies
21
Views
1K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
1K