text: For a system of diameter  and volume , at constant temperature , the classical canonical partition function  
  with  a scaled coordinate, the free energy is given by:
  Combining the above equation with the definition of chemical potential,
  we get the chemical potential of a sufficiently large system from (and the fact that the smallest allowed change in the particle number is )
  wherein the chemical potential of an ideal gas can be evaluated analytically. 
  Now let's focus on  since the potential energy of an  system can be separated into the potential energy of an  system and the potential of the excess particle interacting with the  system, that is,
  and
  Thus far we converted the excess chemical potential into an ensemble average, and the integral in the above equation can be sampled by the brute force Monte Carlo method.
  The calculating of excess chemical potential is not limited to homogeneous systems, but has also been extended to inhomogeneous systems by the Widom insertion method, or other ensembles such as NPT and NVE.