In statistical mechanics, the radial distribution function, (or pair correlation function) g ( r ) {displaystyle g(r)} in a system of particles (atoms, molecules, colloids, etc.), describes how density varies as a function of distance from a reference particle. If a given particle is taken to be at the origin O, and if ρ = N / V {displaystyle ho =N/V} is the average number density of particles, then the local time-averaged density at a distance r {displaystyle r} from O is ρ g ( r ) {displaystyle ho g(r)} . This simplified definition holds for a homogeneous and isotropic system. A more general case will be considered below. In simplest terms it is a measure of the probability of finding a particle at a distance of r {displaystyle r} away from a given reference particle, relative to that for an ideal gas. The general algorithm involves determining how many particles are within a distance of r {displaystyle r} and r + d r {displaystyle r+dr} away from a particle. This general theme is depicted to the right, where the red particle is our reference particle, and blue particles are those whose centers are within the circular shell, dotted in orange. The radial distribution function is usually determined by calculating the distance between all particle pairs and binning them into a histogram. The histogram is then normalized with respect to an ideal gas, where particle histograms are completely uncorrelated. For three dimensions, this normalization is the number density of the system ( ρ ) {displaystyle ( ho )} multiplied by the volume of the spherical shell, which symbolically can be expressed as ρ 4 π r 2 d r {displaystyle ho ,4pi r^{2}dr} . Given a potential energy function, the radial distribution function can be computed either via computer simulation methods like the Monte Carlo method, or via the Ornstein-Zernike equation, using approximative closure relations like the Percus-Yevick approximation or the Hypernetted Chain Theory. It can also be determined experimentally, by radiation scattering techniques or by direct visualization for large enough (micrometer-sized) particles via traditional or confocal microscopy. The radial distribution function is of fundamental importance since it can be used, using the Kirkwood–Buff solution theory, to link the microscopic details to macroscopic properties. Moreover, by the reversion of the Kirkwood-Buff theory, it is possible to attain the microscopic details of the radial distribution function from the macroscopic properties. Consider a system of N {displaystyle N} particles in a volume V {displaystyle V} (for an average number density ρ = N / V {displaystyle ho =N/V} ) and at a temperature T {displaystyle T} (let us also define β = 1 k T {displaystyle extstyle eta ={frac {1}{kT}}} ). The particle coordinates are r i {displaystyle mathbf {r} _{i}} , with i = 1 , … , N {displaystyle extstyle i=1,,ldots ,,N} . The potential energy due to the interaction between particles is U N ( r 1 … , r N ) {displaystyle extstyle U_{N}(mathbf {r} _{1},ldots ,,mathbf {r} _{N})} and we do not consider the case of an externally applied field. The appropriate averages are taken in the canonical ensemble ( N , V , T ) {displaystyle (N,V,T)} , with Z N = ∫ ⋯ ∫ e − β U N d r 1 ⋯ d r N {displaystyle extstyle Z_{N}=int cdots int mathrm {e} ^{-eta U_{N}}mathrm {d} mathbf {r} _{1}cdots mathrm {d} mathbf {r} _{N}} the configurational integral, taken over all possible combinations of particle positions. The probability of an elementary configuration, namely finding particle 1 in d r 1 {displaystyle extstyle mathrm {d} mathbf {r} _{1}} , particle 2 in d r 2 {displaystyle extstyle mathrm {d} mathbf {r} _{2}} , etc. is given by