Probability of any random n points on a line being within a minimum distance

CoNiss

New member
Joined
Apr 18, 2023
Messages
2
Hi,

I am a software engineer trying to solve the following problem analytically for a physics problem :)

given a line segment in cm and n random points on it
what is the probability that the distance between any 2 consecutive points on the line is less than the given minimum distance?

For Example:
n = 10 points
lineSegment = 1000 cm
minimumDistance = 2 cm

Running a Montecarlo simulation I took the following steps:
1. generate n random points
2. sort the points by order of smaller first
3. calculate the distances between consecutive points
4. count how many distances are smaller or equal to the minimumDistance.

Link to Python Montecarlo simulation on replit:

I am looking for an analytical solution to deal with any n number of points.

Thanks...
 
Let's assume that the length of the line segment is L cm, and let d be the given minimum distance between any two consecutive points on the line.

To find the probability that the distance between any two consecutive points on the line is less than d, we can use the uniform distribution. Since there are n points on the line, the distance between any two consecutive points will be uniformly distributed between 0 and L/(n-1).

So, the probability that the distance between any two consecutive points on the line is less than d is equal to the proportion of the uniform distribution that lies between 0 and d. This can be calculated using the cumulative distribution function (CDF) of the uniform distribution:

[math]P(\text{distance} < d) = \dfrac{d - 0}{\dfrac{L}{n-1} - 0} = \dfrac{d(n-1)}{L}[/math]
 
Since there are n points on the line, the distance between any two consecutive points will be uniformly distributed between 0 and L/(n-1).
I disagree. I've run a quick-and-dirty Python script which showed different curves, at which point I realized that the distance between two consecutive points is not limited to the [imath]\left[0, \frac {L}{n-1}\right][/imath] interval. E.g., one can get (albeit with very low probability) the first point to be near 0 and the rest of the points to be clustered very near L, in which case the distance between the first two consecutive points will be near [imath]L[/imath].

My script also shows that the minimum distance is not distributed uniformly either, but it is, of course, limited in value to [imath]\frac{L}{n-1}[/imath]
 
what is the probability that the distance between any 2 consecutive points on the line is less than the given minimum distance?

For Example:
n = 10 points
lineSegment = 1000 cm
minimumDistance = 2 cm
I find it somewhat ambiguous, possibly because English is not my first language. To me the above sentence could mean one of the two sentences below, although my guess would be #1 with "every", in which case you example would not make sense:
  1. Distance for every pair of two consecutive points is less than "d".
  2. Distance for some pair of two consecutive points is less than "d".
Please advise.
 
This seems to be a very difficult problem to me. But before giving up I analyzed a special case of [imath]n=2[/imath]. It looks to me that the PDF of [imath]|x_1-x_2|[/imath]is [imath]f(t) = 2-2t[/imath] for [imath]0\leq t \leq 1[/imath]. It means, for example that the probability of [imath]|x_1-x_2| \leq 1/2[/imath] is 3 times larger than the probability of [imath]|x_1-x_2| \geq 1/2[/imath].
 
You can find some discussion in the following math stackexchange posts.

 
Top