matrix has a trace of one, : Note that for the grand ensemble, the basis states of the operators , , etc. are all states with multiple particles in Fock space, and the density matrix is defined on the same basis. Since the energy and particle numbers are all separately conserved, these operators are mutually commuting. The grand canonical ensemble can alternatively be written in a simple form using bra–ket notation, since it is possible (given the mutually commuting nature of the energy and particle number operators) to find a complete basis of simultaneous eigenstates , indexed by , where , , and so on. Given such an eigenbasis, the grand canonical ensemble is simply where the sum is over the complete set of states with state having total energy, particles of type 1, particles of type 2, and so on. Classical mechanical In classical mechanics, a grand ensemble is instead represented by a joint probability density function defined over multiple phase spaces of varying dimensions, , where the and are the canonical coordinates (generalized momenta and generalized coordinates) of the system's internal degrees of freedom. The expression for the grand canonical ensemble is somewhat more delicate than the canonical ensemble since: The number of particles and thus the number of coordinates varies between the different phase spaces, and, it is vital to consider whether permuting similar particles counts as a distinct state or not. In a system of particles, the number of degrees of freedom depends on the number of particles in a way that depends on the physical situation. For example, in a three-dimensional gas of monoatoms , however in molecular gases there will also be rotational and vibrational degrees of freedom. The probability density function for the grand canonical ensemble is: where is the energy of the system, a function of the phase , is an arbitrary but predetermined constant with the units of , setting the extent of one microstate and providing correct dimensions to . is an overcounting correction factor (see below), a function of . Again, the value of is determined by demanding that is a normalized probability density function: This integral is taken over the entire available phase space for the given numbers of particles. Overcounting correction A well-known problem in the statistical mechanics of fluids (gases, liquids, plasmas) is how to treat particles that are similar or identical in nature: should they