Probability function for distance to the nearest neighbour given $n$ points distributed randomly on a line?

171 Views Asked by At

Note: I'm not familiar with a lot of mathematical terminology, so please excuse any misuses. I'd also make a request to use simpler language (if possible) in an answer

What I'm seeking is similar to this question, but instead of expected distance I'm looking for a probability function.

I'm potentially also looking for an equivalent within 2D space (line replaced with a circle of the line's diameter)

2

There are 2 best solutions below

4
On BEST ANSWER

I understand the problem as this: I draw a point at random uniformly inside the segment $[0,1]$. I draw another $n-1$ points (also uniform and independent). Let $D$ be the distance from our point to the nearest neighbour. Find the probability density of $D$.

$$P(D\ge d|X=x) = ( \max(x - d,0) + \max(1-x-d,0) )^{n-1}=\\ \left(\frac12 -d +\frac{|x-d|+|1-x-d|}{2}\right)^{n-1} \tag 1$$

Hence $$P(D\ge d) = \int_{0}^1 P(D\ge d|X=x) dx \tag 2$$

This is messy to evaluate. For large $n$, you can assume

$$P(D\ge d|X=x) \approx (1 -2d)^{n-1} = P(D\ge d) \tag 3$$

for $0<d<1/2$ Hence the probability density of the nearest distance is given by $$f_D(d) \approx 2(n-1) (1-2d)^{n-2} \tag 4$$

enter image description here

This gives an expected value of $E[D]=\frac{1}{ 2 n}$ (in agreement with this answer)

0
On

If $x$ and $y$ are drawn independently from a UniformDistribution[0,1], the distribution of absolute distance $z = |x-y|$ is $p(z) = 2- 2z$:

enter image description here

The expected distance is $\int\limits_{z=0}^1 z (2 - 2 z)\ dz = 1/3$.