In

^{3''N''} (where ''h'' is usually taken to be Planck's constant).

_{s}'', it is said that the energy levels of the system are degenerate. In the case of degenerate energy levels, we can write the partition function in terms of the contribution from energy levels (indexed by ''j'') as follows:
$$Z\; =\; \backslash sum\_j\; g\_j\; \backslash cdot\; e^,$$
where ''g_{j}'' is the degeneracy factor, or number of quantum states ''s'' that have the same energy level defined by ''E_{j}'' = ''E_{s}''.
The above treatment applies to ''quantum'' statistical mechanics, where a physical system inside a finite-sized box will typically have a discrete set of energy eigenstates, which we can use as the states ''s'' above. In quantum mechanics, the partition function can be more formally written as a trace over the state space (which is independent of the choice of basis):
$$Z\; =\; \backslash operatorname\; (\; e^\; ),$$
where is the quantum Hamiltonian operator. The exponential of an operator can be defined using the exponential power series.
The classical form of ''Z'' is recovered when the trace is expressed in terms of coherent states
and when quantum-mechanical uncertainties in the position and momentum of a particle
are regarded as negligible. Formally, using bra–ket notation, one inserts under the trace for each degree of freedom the identity:
$$\backslash boldsymbol\; =\; \backslash int\; ,\; x,\; p\backslash rangle\; \backslash langle\; x,p,\; \backslash frac,$$
where is a normalised Gaussian wavepacket centered at
position ''x'' and momentum ''p''. Thus
$$Z\; =\; \backslash int\; \backslash operatorname\; \backslash left(\; e^\; ,\; x,\; p\backslash rangle\; \backslash langle\; x,\; p,\; \backslash right)\; \backslash frac\; =\; \backslash int\; \backslash langle\; x,p,\; e^\; ,\; x,\; p\backslash rangle\; \backslash frac.$$
A coherent state is an approximate eigenstate of both operators $\backslash hat$ and $\backslash hat$, hence also of the Hamiltonian , with errors of the size of the uncertainties. If and can be regarded as zero, the action of reduces to multiplication by the classical Hamiltonian, and reduces to the classical configuration integral.

_{i}'' denote the probability that the system ''S'' is in a particular microstate, ''i'', with energy ''E_{i}''. According to the fundamental postulate of statistical mechanics (which states that all attainable microstates of a system are equally probable), the probability ''p_{i}'' will be inversely proportional to the number of microstates of the total closed system (''S'', ''B'') in which ''S'' is in microstate ''i'' with energy ''E_{i}''. Equivalently, ''p_{i}'' will be proportional to the number of microstates of the heat bath ''B'' with energy ''E'' − ''E_{i}'':
$$p\_i\; =\; \backslash frac.$$
Assuming that the heat bath's internal energy is much larger than the energy of ''S'' (''E'' ≫ ''E_{i}''), we can Taylor-expand $\backslash Omega\_B$ to first order in ''E_{i}'' and use the thermodynamic relation $\backslash partial\; S\_B/\backslash partial\; E\; =\; 1/T$, where here $S\_B$, $T$ are the entropy and temperature of the bath respectively:
$$\backslash begin\; k\; \backslash ln\; p\_i\; \&=\; k\; \backslash ln\; \backslash Omega\_B(E\; -\; E\_i)\; -\; k\; \backslash ln\; \backslash Omega\_(E)\; \backslash \backslash ;\; href="/html/ALL/s/pt.html"\; ;"title="pt">pt$$
Thus
$$p\_i\; \backslash propto\; e^\; =\; e^.$$
Since the total probability to find the system in ''some'' microstate (the sum of all ''p_{i}'') must be equal to 1, we know that the constant of proportionality must be the normalization constant, and so, we can define the partition function to be this constant:
$$Z\; =\; \backslash sum\_i\; e^\; =\; \backslash frac.$$

_{1}, ''ζ''_{2}, ..., ''ζ''_{N}, then the partition function of the entire system is the ''product'' of the individual partition functions:
$$Z\; =\backslash prod\_^\; \backslash zeta\_j.$$
If the sub-systems have the same physical properties, then their partition functions are equal, ζ_{1} = ζ_{2} = ... = ζ, in which case $$Z\; =\; \backslash zeta^N.$$
However, there is a well-known exception to this rule. If the sub-systems are actually identical particles, in the quantum mechanical sense that they are impossible to distinguish even in principle, the total partition function must be divided by a ''N''! (''N''

_{1}, ''E''_{2}, ''E''_{3}, etc. The microstate energies are determined by other thermodynamic variables, such as the number of particles and the volume, as well as microscopic quantities like the mass of the constituent particles. This dependence on microscopic variables is the central point of statistical mechanics. With a model of the microscopic constituents of a system, one can calculate the microstate energies, and thus the partition function, which will then allow us to calculate all the other thermodynamic properties of the system.
The partition function can be related to thermodynamic properties because it has a very important statistical meaning. The probability ''P_{s}'' that the system occupies microstate ''s'' is
$$P\_s\; =\; \backslash frac\; e^.$$
Thus, as shown above, the partition function plays the role of a normalizing constant (note that it does ''not'' depend on ''s''), ensuring that the probabilities sum up to one:
$$\backslash sum\_s\; P\_s\; =\; \backslash frac\; \backslash sum\_s\; e^\; =\; \backslash frac\; Z\; =\; 1.$$
This is the reason for calling ''Z'' the "partition function": it encodes how the probabilities are partitioned among the different microstates, based on their individual energies. The letter ''Z'' stands for the German word ''Zustandssumme'', "sum over states". The usefulness of the partition function stems from the fact that it can be used to relate macroscopic thermodynamic quantities to the microscopic details of a system through the derivatives of its partition function. Finding the partition function is also equivalent to performing a Laplace transform of the density of states function from the energy domain to the β domain, and the inverse Laplace transform of the partition function reclaims the state density function of energies.

physics
Physics is the natural science that studies matter, its Elementary particle, fundamental constituents, its motion and behavior through Spacetime, space and time, and the related entities of energy and force. "Physical science is that depar ...

, a partition function describes the statistical properties of a system in thermodynamic equilibrium. Partition functions are functions of the thermodynamic state variables, such as the temperature
Temperature is a physical quantity that expresses quantitatively the perceptions of hotness and coldness. Temperature is measurement, measured with a thermometer.
Thermometers are calibrated in various Conversion of units of temperature, temp ...

and volume. Most of the aggregate thermodynamic variables of the system, such as the total energy, free energy, entropy, and pressure, can be expressed in terms of the partition function or its derivatives. The partition function is dimensionless.
Each partition function is constructed to represent a particular statistical ensemble (which, in turn, corresponds to a particular free energy). The most common statistical ensembles have named partition functions. The canonical partition function applies to a canonical ensemble, in which the system is allowed to exchange heat
In thermodynamics, heat is defined as the form of energy crossing the boundary of a thermodynamic system by virtue of a temperature difference across the boundary. A thermodynamic system does not ''contain'' heat. Nevertheless, the term is al ...

with the environment at fixed temperature, volume, and number of particles. The grand canonical partition function applies to a grand canonical ensemble, in which the system can exchange both heat and particles with the environment, at fixed temperature, volume, and chemical potential. Other types of partition functions can be defined for different circumstances; see partition function (mathematics) for generalizations. The partition function has many physical meanings, as discussed in Meaning and significance.
Canonical partition function

Definition

Initially, let us assume that a thermodynamically large system is in thermal contact with the environment, with a temperature ''T'', and both the volume of the system and the number of constituent particles are fixed. A collection of this kind of system comprises an ensemble called a canonical ensemble. The appropriate mathematical expression for the canonical partition function depends on the degrees of freedom of the system, whether the context is classical mechanics or quantum mechanics, and whether the spectrum of states is discrete or continuous.Classical discrete system

For a canonical ensemble that is classical and discrete, the canonical partition function is defined as $$Z\; =\; \backslash sum\_i\; e^,$$ where * $i$ is the index for the microstates of the system; * $e$ is Euler's number; * $\backslash beta$ is the thermodynamic beta, defined as $\backslash tfrac$ where $k\_\backslash text$ is Boltzmann's constant; * $E\_i$ is the total energy of the system in the respective microstate. The exponential factor $e^$ is otherwise known as the Boltzmann factor.Classical continuous system

In classical mechanics, the position and momentum variables of a particle can vary continuously, so the set of microstates is actually uncountable. In ''classical'' statistical mechanics, it is rather inaccurate to express the partition function as a sum of discrete terms. In this case we must describe the partition function using an integral rather than a sum. For a canonical ensemble that is classical and continuous, the canonical partition function is defined as $$Z\; =\; \backslash frac\; \backslash int\; e^\; \backslash ,\; \backslash mathrm^3\; q\; \backslash ,\; \backslash mathrm^3\; p,$$ where * $h$ is the Planck constant; * $\backslash beta$ is the thermodynamic beta, defined as $\backslash tfrac$; * $H(q,\; p)$ is the Hamiltonian of the system; * $q$ is the canonical position; * $p$ is the canonical momentum. To make it into a dimensionless quantity, we must divide it by ''h'', which is some quantity with units of action (usually taken to be Planck's constant).Classical continuous system (multiple identical particles)

For a gas of $N$ identical classical particles in three dimensions, the partition function is $$Z=\backslash frac\; \backslash int\; \backslash ,\; \backslash exp\; \backslash left(-\backslash beta\; \backslash sum\_^N\; H(\backslash textbf\; q\_i,\; \backslash textbf\; p\_i)\; \backslash right)\; \backslash ;\; \backslash mathrm^3\; q\_1\; \backslash cdots\; \backslash mathrm^3\; q\_N\; \backslash ,\; \backslash mathrm^3\; p\_1\; \backslash cdots\; \backslash mathrm^3\; p\_N$$ where * $h$ is the Planck constant; * $\backslash beta$ is the thermodynamic beta, defined as $\backslash tfrac$; * $i$ is the index for the particles of the system; * $H$ is the Hamiltonian of a respective particle; * $q\_i$ is the canonical position of the respective particle; * $p\_i$ is the canonical momentum of the respective particle; * $\backslash mathrm^3$ is shorthand notation to indicate that $q\_i$ and $p\_i$ are vectors in three-dimensional space. The reason for thefactorial
In mathematics, the factorial of a non-negative denoted is the Product (mathematics), product of all positive integers less than or equal The factorial also equals the product of n with the next smaller factorial:
\begin
n! &= n \times ...

factor ''N''! is discussed below. The extra constant factor introduced in the denominator was introduced because, unlike the discrete form, the continuous form shown above is not dimensionless. As stated in the previous section, to make it into a dimensionless quantity, we must divide it by ''h''Quantum mechanical discrete system

For a canonical ensemble that is quantum mechanical and discrete, the canonical partition function is defined as the trace of the Boltzmann factor: $$Z\; =\; \backslash operatorname\; (\; e^\; ),$$ where: * $\backslash operatorname\; (\; \backslash circ\; )$ is the trace of a matrix; * $\backslash beta$ is the thermodynamic beta, defined as $\backslash tfrac$; * $\backslash hat$ is the Hamiltonian operator. The dimension of $e^$ is the number of energy eigenstates of the system.Quantum mechanical continuous system

For a canonical ensemble that is quantum mechanical and continuous, the canonical partition function is defined as $$Z\; =\; \backslash frac\; \backslash int\; \backslash langle\; q,\; p\; ,\; e^\; ,\; q,\; p\; \backslash rangle\; \backslash ,\; \backslash mathrm\; q\; \backslash ,\; \backslash mathrm\; p,$$ where: * $h$ is the Planck constant; * $\backslash beta$ is the thermodynamic beta, defined as $\backslash tfrac$; * $\backslash hat$ is the Hamiltonian operator; * $q$ is the canonical position; * $p$ is the canonical momentum. In systems with multiple quantum states ''s'' sharing the same energy ''EConnection to probability theory

For simplicity, we will use the discrete form of the partition function in this section. Our results will apply equally well to the continuous form. Consider a system ''S'' embedded into a heat bath ''B''. Let the totalenergy
In physics, energy (from Ancient Greek: wikt:ἐνέργεια#Ancient_Greek, ἐνέργεια, ''enérgeia'', “activity”) is the physical quantity, quantitative physical property, property that is #Energy transfer, transferred to a phy ...

of both systems be ''E''. Let ''pCalculating the thermodynamic total energy

In order to demonstrate the usefulness of the partition function, let us calculate the thermodynamic value of the total energy. This is simply the expected value, or ensemble average for the energy, which is the sum of the microstate energies weighted by their probabilities: $$\backslash langle\; E\; \backslash rangle\; =\; \backslash sum\_s\; E\_s\; P\_s\; =\; \backslash frac\; \backslash sum\_s\; E\_s\; e^\; =\; -\; \backslash frac\; \backslash frac\; Z(\backslash beta,\; E\_1,\; E\_2,\; \backslash cdots)\; =\; -\; \backslash frac$$ or, equivalently, $$\backslash langle\; E\backslash rangle\; =\; k\_\backslash text\; T^2\; \backslash frac.$$ Incidentally, one should note that if the microstate energies depend on a parameter λ in the manner $$E\_s\; =\; E\_s^\; +\; \backslash lambda\; A\_s\; \backslash qquad\; \backslash text\backslash ;\; s$$ then the expected value of ''A'' is $$\backslash langle\; A\backslash rangle\; =\; \backslash sum\_s\; A\_s\; P\_s\; =\; -\backslash frac\; \backslash frac\; \backslash ln\; Z(\backslash beta,\backslash lambda).$$ This provides us with a method for calculating the expected values of many microscopic quantities. We add the quantity artificially to the microstate energies (or, in the language of quantum mechanics, to the Hamiltonian), calculate the new partition function and expected value, and then set ''λ'' to zero in the final expression. This is analogous to the source field method used in the path integral formulation of quantum field theory.Relation to thermodynamic variables

In this section, we will state the relationships between the partition function and the various thermodynamic parameters of the system. These results can be derived using the method of the previous section and the various thermodynamic relations. As we have already seen, the thermodynamic energy is $$\backslash langle\; E\; \backslash rangle\; =\; -\; \backslash frac.$$ The variance in the energy (or "energy fluctuation") is $$\backslash langle\; (\backslash Delta\; E)^2\; \backslash rangle\; \backslash equiv\; \backslash langle\; (E\; -\; \backslash langle\; E\backslash rangle)^2\; \backslash rangle\; =\; \backslash frac.$$ The heat capacity is $$C\_v\; =\; \backslash frac\; =\; \backslash frac\; \backslash langle\; (\backslash Delta\; E)^2\; \backslash rangle.$$ In general, consider the extensive variable X and intensive variable Y where X and Y form a pair of conjugate variables. In ensembles where Y is fixed (and X is allowed to fluctuate), then the average value of X will be: $$\backslash langle\; X\; \backslash rangle\; =\; \backslash pm\; \backslash frac.$$ The sign will depend on the specific definitions of the variables X and Y. An example would be X = volume and Y = pressure. Additionally, the variance in X will be $$\backslash langle\; (\backslash Delta\; X)^2\; \backslash rangle\; \backslash equiv\; \backslash langle\; (X\; -\; \backslash langle\; X\backslash rangle)^2\; \backslash rangle\; =\; \backslash frac\; =\; \backslash frac.$$ In the special case of entropy, entropy is given by $$S\; \backslash equiv\; -k\_\backslash text\backslash sum\_s\; P\_s\; \backslash ln\; P\_s\; =\; k\_\backslash text\; (\backslash ln\; Z\; +\; \backslash beta\; \backslash langle\; E\backslash rangle)\; =\; \backslash frac\; (k\_\backslash text\; T\; \backslash ln\; Z)\; =\; -\backslash frac$$ where ''A'' is the Helmholtz free energy defined as , where is the total energy and ''S'' is the entropy, so that $$A\; =\; \backslash langle\; E\backslash rangle\; -TS=\; -\; k\_\backslash text\; T\; \backslash ln\; Z.$$ Furthermore, the heat capacity can be expressed as $$C\_v\; =\; T\; \backslash frac\; =\; -T\; \backslash frac.$$Partition functions of subsystems

Suppose a system is subdivided into ''N'' sub-systems with negligible interaction energy, that is, we can assume the particles are essentially non-interacting. If the partition functions of the sub-systems are ''ζ''factorial
In mathematics, the factorial of a non-negative denoted is the Product (mathematics), product of all positive integers less than or equal The factorial also equals the product of n with the next smaller factorial:
\begin
n! &= n \times ...

):
$$Z\; =\; \backslash frac.$$
This is to ensure that we do not "over-count" the number of microstates. While this may seem like a strange requirement, it is actually necessary to preserve the existence of a thermodynamic limit for such systems. This is known as the Gibbs paradox.
Meaning and significance

It may not be obvious why the partition function, as we have defined it above, is an important quantity. First, consider what goes into it. The partition function is a function of the temperature ''T'' and the microstate energies ''E''Grand canonical partition function

We can define a grand canonical partition function for a grand canonical ensemble, which describes the statistics of a constant-volume system that can exchange both heat and particles with a reservoir. The reservoir has a constant temperature ''T'', and a chemical potential ''μ''. The grand canonical partition function, denoted by $\backslash mathcal$, is the following sum over microstates :$\backslash mathcal(\backslash mu,\; V,\; T)\; =\; \backslash sum\_\; \backslash exp\backslash left(\backslash frac\; \backslash right).$ Here, each microstate is labelled by $i$, and has total particle number $N\_i$ and total energy $E\_i$. This partition function is closely related to the grand potential, $\backslash Phi\_$, by the relation :$-k\_B\; T\; \backslash ln\; \backslash mathcal\; =\; \backslash Phi\_\; =\; \backslash langle\; E\; \backslash rangle\; -\; TS\; -\; \backslash mu\; \backslash langle\; N\backslash rangle.$ This can be contrasted to the canonical partition function above, which is related instead to the Helmholtz free energy. It is important to note that the number of microstates in the grand canonical ensemble may be much larger than in the canonical ensemble, since here we consider not only variations in energy but also in particle number. Again, the utility of the grand canonical partition function is that it is related to the probability that the system is in state $i$: :$p\_i\; =\; \backslash frac\; \backslash exp\backslash left(\backslash frac\backslash right).$ An important application of the grand canonical ensemble is in deriving exactly the statistics of a non-interacting many-body quantum gas ( Fermi–Dirac statistics for fermions, Bose–Einstein statistics for bosons), however it is much more generally applicable than that. The grand canonical ensemble may also be used to describe classical systems, or even interacting quantum gases. The grand partition function is sometimes written (equivalently) in terms of alternate variables as :$\backslash mathcal(z,\; V,\; T)\; =\; \backslash sum\_\; z^\; Z(N\_i,\; V,\; T),$ where $z\; \backslash equiv\; \backslash exp(\backslash mu/k\_B\; T)$ is known as the absolute activity (or fugacity) and $Z(N\_i,\; V,\; T)$ is the canonical partition function.See also

* Partition function (mathematics) * Partition function (quantum field theory) * Virial theorem * Widom insertion methodReferences

* * * * * {{Statistical mechanics topics Equations of physics