All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
The middle number (Posted on 2019-10-08) Difficulty: 3 of 5
Given 5 numbers, each randomly chosen between zero and one, what is the probability that the number in the "middle" (the third one when sorted) is between 0.4 and 0.6?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 3 of 4 |
There are six cases:

Case 1. One of the numbers is the only one in the target range, with two others in the lower range and two in the higher, making the singular number the middle number.

p1 = (1/5)*(2/5)^2*(2/5)^2 * 5*C(4,2)

The factor of 5*C(4,2) being the ways of choosing which of the random numbers is in the target range and which two are below the target range, with the remainder being above that range.

Case 2. Two numbers are in the target range and one below the target range. (the rest of course above)

p2 = (1/5)^2*(2/5)*(2/5)^2 * 5*C(4,2)

The "ways" factor being the same as the ways of choosing the one that's within the target range and the two that are below the target range.

Case 3. Two numbers are in the target range and one above.

p3 = p2 by symmetry.

Case 4. Exactly three numbers are in the target range.

p4 = (1/5)^3*(4/5)^2 * C(5,3)

The largest of the three that are in the target range qualifies as a "hit".

Case 5. Exactly four numbers are in the target range.

p5 = (1/5)^4*(4/5) * C(5,4)

Case 6. All five numbers are in the target range.

p6 = (1/5)^5


Add these partial, mutually exclusive probabilities:

 96/625 
 48/625 
 48/625 
 32/625 
 4/625 
 1/3125 
---------
 1141/3125 = 0.36512 
 
calculated by
 
    1   open "midnumbr.txt" for output as #2
    2  
    3   P1=(1//5)*(2//5)^2*(2//5)^2*5*combi(4,2)
    4   P2=(1//5)^2*(2//5)*(2//5)^2*5*combi(4,2)
    5   P3=P2
    6   P4=(1//5)^3*(4//5)^2*combi(5,3)
    7   P5=(1//5)^4*(4//5)*combi(5,4)
    8   P6=(1//5)^5
    9   print #2,P1:print #2,P2:print #2,P3:print #2,P4:print #2,P5
   16   print #2,P6:print #2,:print #2,P1+P2+P3+P4+P5+P6
   27   print #2,(P1+P2+P3+P4+P5+P6)/1
   38   close #2

A simulation produced, in 10 runs:

hits tries prob. 
3571 10000 .3571
3651 10000 .3651 
3564 10000 .3564
3593 10000 .3593 
3722 10000 .3722
3598 10000 .3598 
3700 10000 .37
3666 10000 .3666
3641 10000 .3641 
3629 10000 .3629 

totalling

36335/100000 = .36335

  trct = 0: hitct = 0
  For trial = 1 To 10000
    For i = 1 To 5
       n(i) = Rnd(1)
    Next
    Do
      done = 1
      For i = 1 To 4
        If n(i) > n(i + 1) Then
         hld = n(i): n(i) = n(i + 1): n(i + 1) = hld
         done = 0
        End If
      Next
    Loop Until done
    If n(3) >= 0.4 And n(3) <= 0.6 Then hitct = hitct + 1
    trct = trct + 1
  Next trial
   
  Text1.Text = Text1.Text & hitct & Str(trct) & Str(hitct / trct) & " done"

Edited on October 8, 2019, 2:46 pm
  Posted by Charlie on 2019-10-08 14:38:50

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2019 by Animus Pactum Consulting. All rights reserved. Privacy Information