# What is the relation between density and average distance to nearest neighbour?

Let's say I have the density of an object: say, $$1 \space \mathrm{obj} \space m^{-2}$$. This could, for example, be the number of balls on a football field. If we assume the objects are uniformly distributed, what is the average distance between an object and its nearest neighbour?

Intuitively it sounds like there should be a way to calculate this, but I can't figure out how:

1. Clearly the higher the density, the smaller the distance between two neighbouring objects, so the average distance should be inversely proportional to the density.
2. To get the units to work, we would take the square root. So for this density, the average distance is $$\frac{1}{\sqrt{1 \space \mathrm{obj} \space m^{-2}}}$$ Superficially this seems to work, except we now have an extra unit $$\mathrm{obj}^{-1/2}$$.
3. More concerningly, I don't intuitively see why this should yield the correct result. Step 2 simply says "to get the units to work". Sure, taking the square root makes the units work, but why should this be the correct answer? It would also mean in 3D, we take the cube root, etc.

I get the feeling that this question must have been solved in the past, in which case I'd appreciate a reference.

• When you write the density as $1$ obj/m$^2$ aren’t you implying the distance between nearest neighbours is 1 m? Or am I missing something? Mar 3, 2020 at 7:08
• @FellowTraveller are you sure? To me, it only seems to be saying that there is on average 1 object per $m^2$. Mar 3, 2020 at 7:11
• Well the exact number does depend on how it is packed. Like say in a square lattice or a honeycomb and so on. But the order of magnitude will be the same. So assuming a square lattice, if you divide your entire area in units of squares of 1 m$^2$ then each square will have 1 object. Thus the distance to the nearest neighbour is 1 m. Mar 3, 2020 at 7:14

The answer is going to depend on whether the objects are attracted to each other (clumpy) or repulsed by each other. If the objects are on a regular lattice, then the problem is trivial - it's just the shortest spacing on the lattice (or some average, if not all points are identical).

If we assume the objects are completely uncorrelated, then the usual assumption is that the number of objects in any given area is given by the Poisson distribution: $$P(n) = \frac{(A\sigma)^n}{n!}e^{-A\sigma},$$ with $$A$$ the area of the patch, $$\sigma$$ the areal density, and $$n$$ the number of objects in the patch.

To define the statistics for the nearest neighbor, we need to find the probability that a circle of radius $$r$$ is empty except for exactly one object at its center and one on its edge (the probability of two or more on its edge is negligible). Because everything is uncorrelated, it factors into a nice product of the probability the center has 1 object times the circle being empty times the edge having 1 object: $$P(n_0,n_N) = \left(\mathrm{d}\mathbf{r}_0^2 \sigma e^{- \mathrm{d}\mathbf{r}_0^2\sigma}\right) \times \left(e^{-\pi r^2 \sigma}\right) \times \left( 2\pi r \mathrm{d}r \sigma e^{-2\pi r \mathrm{d}r\,\sigma}\right).$$ Dropping non-leading order differentials, the joint density becomes \begin{align} f\left(\vec{r_0},r\right) &\equiv \frac{\mathrm{d}P(n_0,n_N)}{\mathrm{d}\mathbf{r}_0^2 \mathrm{d}r}\\ &= \sigma^2 2\pi r e^{-\sigma \pi r^2} \end{align} that is, the probability density of objects to be at position $$\mathbf{r}_0$$ and have a nearest neighbor at a distance $$r$$. To get the mean distance to the nearest neighbor, multiply by $$r$$ and integrate to get: \begin{align} \langle r \rangle &= \frac{\int_0^\infty r f\left(\vec{r_0},r\right) \,\mathrm{d}r }{\int_0^\infty f\left(\vec{r_0},r\right) \,\mathrm{d}r} \\ & = \frac{1}{2\sqrt{\sigma}}. \end{align}

As you can see, your intuition was pretty solid - only off by a factor of $$1/2$$. For other probability distributions, the computation can get rather more involved.

• could you elaborate on what you mean by "Dropping non-leading order differentials". Also, It is not exactly clear to me how you construct $P(n_0, n_N)$.
– Our
Jun 26, 2023 at 6:41
• @Our It's standard in calculus to treat differentials higher than order 1 as zero. I've just cleaned up the notation to make it more clear that $dr_0^2$ was $(d r_0)^2$ not $d(r_0^2)$. I've also been more explicit about the transition from $P$ to $f$. The construction of $P(n_0, n_N)$ is a simple exercise in the probabilities of independent events (the events were already described in the sentence): en.wikipedia.org/wiki/Probability#Independent_events . Jun 26, 2023 at 7:05
• Thank you very much!
– Our
Jun 26, 2023 at 7:24

This answer assumes uniform distribution. Let us see what the formula for density tells us. Say we have a total volume $$V$$ and number of particles $$N$$. Then the density $$\rho$$ is given by: $$\rho=\frac{N}{V}$$ Now consider the volume of each particle (inter particle volume) to be $$v$$, then the total volume will be given by: $$V=Nv$$ Plugging this back in our density equation, we get: $$\rho=\frac{1}{v}$$ This tells us that the inter particle volume is given by: $$v=\frac{1}{\rho}$$

Now to get the inter particle distance $$d$$ from here, we need to know the exact geometry of the packing to get the $$d$$ dependence in $$v$$. But using the fact that n-dimensional volume goes as $$d^n$$, we get: $$d\sim\frac{1}{\rho^{1/n}}$$