• 0

Random number probability

Question

Posted · Report post

Get two random numbers between 0 and 1. Subtract the smaller from the bigger. What is the probability that the result is <0.3? Is it bigger than the probability it is > or equal to 0.3?
For what number the probability for both cases is the same?
0

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

Posted · Report post

The probability that the difference is <0.3 is 72%. Equal probability is achieved for the difference of (3-sqrt(5))/4 or approx. 0.191

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

How'd you come to that answer?

If you pick one number N, then the area from N - 0.3 to N + 0.3 will be 0.6, so the probability that a second point M would fall within that range (to make the difference between N and M be <0.3) can be no higher than 60%.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Probability is very close to 51%.
Mean length is 1/3.
Median length is .2925.

Here are 2000 random distances plotted in ascending order.

post-1048-0-62276700-1394944685_thumb.gi

0

Share this post


Link to post
Share on other sites
  • 0

Posted (edited) · Report post

Consider placing one point N in the range from 0 to 1, and then placing a second point M in the range from 0 to 1.

If N is in the range from 0.3 to 0.7, then there will be a total area of 0.6 around N in which M could be placed to be within 0.3 units of N.

Probability (N is within 0.3 to 0.7) and (M is within 0.3 units of N, given that N is within 0.3 to 0.7)

= 4/10 x 6/10 = 24/100

If N is in the range from 0 to 0.3, or 0.7 to 1.0, then some of the area within 0.3 units of N will be outside of the 0-1 range and inaccessible to M. At either extreme (at 0 or at 1.0), there would be 0.3 units in which M could fall that are within 0.3 units of N. That accessible area within 0.3 units of N increases linearly from 0.3 to 0.6 as N moves from 0 to 0.3 (or as N moves from 1.0 to 0.7). If N is within 0 to 0.3 or 0.7 to 1.0, then on average, M would have 0.45 units of area that would put it within 0.3 units of N.

Probability (N is within either 0 to 0.3 or 0.7 to 1) and (M is within 0.3 units of N)

= 6/10 x 4.5/10 = 27/100

The sum of those two is 51/100. So slightly higher than 50/50 odds that M is within 0.3 units of N.

Now to find the distance D for which the odds are 50/50. Those equations would become:

Probability (N is not within D of 0 or 1) and (M is within D of N)

= (1 - 2D) x 2D

= 2D - 4D2

Probability (N is within D of 0 or 1) and (M is within D of N)

= 2D x 1.5D

= 3D2

The sum of those two is

2D - D2

Confirming this works with the previous answer, 2 x 0.3 - 0.32 = 0.51

Solving for a 50/50 chance:

2D - D2 = 0.5

D2 - 2D + 0.5 = 0

Using the quadratic formula

D = [2 +/- sqrt(4 - 4x1x0.5)] / 2

= [2 +/- sqrt(2)] / 2

The + solution would produce a number greater than one which would not be meaningful for this problem, so the - solution is the only one that makes sense

D = [2 - sqrt(2)] / 2 = 1 - sqrt(2)/2

roughly 0.29289

Edited by plasmid
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.