In statistical mechanics, the grand canonical ensemble (also known as the macrocanonical ensemble) is the statistical ensemble that is used to represent the possible states of a mechanical system of particles that are in thermodynamic equilibrium (thermal and chemical) with a reservoir. The system is said to be open in the sense that the system can exchange energy and particles with a reservoir, so that various possible states of the system can differ in both their total energy and total number of particles. The system's volume, shape, and other external coordinates are kept the same in all possible states of the system. The thermodynamic variables of the grand canonical ensemble are chemical potential (symbol: ) and absolute temperature (symbol: . The ensemble is also dependent on mechanical variables such as volume (symbol: which influence the nature of the system's internal states. This ensemble is therefore sometimes called the ensemble, as each of these three quantities are constants of the ensemble. Basics In simple terms, the grand canonical ensemble assigns a probability to each distinct microstate given by the following exponential: where is the number of particles in the microstate and is the total energy of the microstate. is Boltzmann's constant. The number is known as the grand potential and is constant for the ensemble. However, the probabilities and will vary if different are selected. The grand potential serves two roles: to provide a normalization factor for the probability distribution (the probabilities, over the complete set of microstates, must add up to one); and, many important ensemble averages can be directly calculated from the function . In the case where more than one kind of particle is allowed to vary in number, the probability expression generalizes to where is the chemical potential for the first kind of particles, is the number of that kind of particle in the microstate, is the chemical potential for the second kind of particles and so on ( is the number of distinct kinds of particles). However, these particle numbers should be defined carefully (see the note on particle number conservation below). The distribution of the grand canonical ensemble is called generalized Boltzmann distribution by some authors. Grand ensembles are apt for use when describing systems such as the electrons in a conductor, or the photons in a cavity, where the shape is fixed but the energy and number of particles can easily fluctuate due to