# Ensemble average

In statistical mechanics, the ensemble average is defined as the mean of a quantity that is a function of the microstate of a system (the ensemble of possible states), according to the distribution of the system on its micro-states in this ensemble.

Since the ensemble average is dependent on the ensemble chosen, its mathematical expression varies from ensemble to ensemble. However, the mean obtained for a given physical quantity doesn't depend on the ensemble chosen at the thermodynamic limit. Grand canonical ensemble is an example of open system.

## Canonical ensemble average

### Classical statistical mechanics

For a classical system in thermal equilibrium with its environment, the ensemble average takes the form of an integral over the phase space of the system:

$\bar{A}=\frac{\int{Ae^{-\beta H(q_1, q_2, ... q_M, p_1, p_2, ... p_N)}d\tau}}{\int{e^{-\beta H(q_1, q_2, ... q_M, p_1, p_2, ... p_N)}d\tau}}$
where:
$\bar{A}$ is the ensemble average of the system property A,
$\beta$ is $\frac {1}{kT}$, known as thermodynamic beta,
H is the Hamiltonian of the classical system in terms of the set of coordinates $q_i$ and their conjugate generalized momenta $p_i$, and
$d\tau$ is the volume element of the classical phase space of interest.

The denominator in this expression is known as the partition function, and is denoted by the letter Z.

### Quantum statistical mechanics

For a quantum system in thermal equilibrium with its environment, the weighted average takes the form of a sum over quantum energy states, rather than a continuous integral:

$\bar{A}=\frac{\sum_i{A_ie^{-\beta E_i}}}{\sum_i{e^{-\beta E_i}}}$

## Ensemble average in other ensembles

The generalized version of the partition function provides the complete framework for working with ensemble averages in thermodynamics, information theory, statistical mechanics and quantum mechanics.

### Microcanonical ensemble

It represents an isolated system in which energy (E), volume (V) and the number of particles (N) are all constant.

### Canonical ensemble

It represents a closed system which can exchange energy (E) with its surroundings (usually a heat bath), but the volume (V) and the number of particles (N) are all constant.

### Grand canonical ensemble

It represents an open system which can exchange energy (E) as well as particles with its surroundings but the volume (V) is kept constant.