Thermodynamic integration is a method used to compare the difference in free energy between two given states (e.g., A and B) whose potential energies U A {displaystyle U_{A}} and U B {displaystyle U_{B}} have different dependences on the spatial coordinates. Because the free energy of a system is not simply a function of the phase space coordinates of the system, but is instead a function of the Boltzmann-weighted integral over phase space (i.e. partition function), the free energy difference between two states cannot be calculated directly. In thermodynamic integration, the free energy difference is calculated by defining a thermodynamic path between the states and integrating over ensemble-averaged enthalpy changes along the path. Such paths can either be real chemical processes or alchemical processes. An example alchemical process is the Kirkwood's coupling parameter method. Thermodynamic integration is a method used to compare the difference in free energy between two given states (e.g., A and B) whose potential energies U A {displaystyle U_{A}} and U B {displaystyle U_{B}} have different dependences on the spatial coordinates. Because the free energy of a system is not simply a function of the phase space coordinates of the system, but is instead a function of the Boltzmann-weighted integral over phase space (i.e. partition function), the free energy difference between two states cannot be calculated directly. In thermodynamic integration, the free energy difference is calculated by defining a thermodynamic path between the states and integrating over ensemble-averaged enthalpy changes along the path. Such paths can either be real chemical processes or alchemical processes. An example alchemical process is the Kirkwood's coupling parameter method. Consider two systems, A and B, with potential energies U A {displaystyle U_{A}} and U B {displaystyle U_{B}} . The potential energy in either system can be calculated as an ensemble average over configurations sampled from a molecular dynamics or Monte Carlo simulation with proper Boltzmann weighting. Now consider a new potential energy function defined as: Here, λ {displaystyle lambda } is defined as a coupling parameter with a value between 0 and 1, and thus the potential energy as a function of λ {displaystyle lambda } varies from the energy of system A for λ = 0 {displaystyle lambda =0} and system B for λ = 1 {displaystyle lambda =1} . In the canonical ensemble, the partition function of the system can be written as: In this notation, U s ( λ ) {displaystyle U_{s}(lambda )} is the potential energy of state s {displaystyle s} in the ensemble with potential energy function U ( λ ) {displaystyle U(lambda )} as defined above. The free energy of this system is defined as: