density function in the classical limit, and that it has ergodic properties. After checking that p(n1, n2, ..., nN) is a constant of motion, an ergodic assumption for the probabilities p(n1, n2, ..., nN) makes p a function of the energy only. After this procedure, one finally arrives at the density matrix formalism when seeking a form where p(n1, n2, ..., nN) is invariant with respect to the representation used. In the form it is written, it will only yield the correct expectation values for quantities which are diagonal with respect to the quantum numbers n1, n2, ..., nN. Expectation values of operators which are not diagonal involve the phases of the quantum amplitudes. Suppose we encode the quantum numbers n1, n2, ..., nN into the single index i or j. Then our wave function has the form The expectation value of an operator B which is not diagonal in these wave functions, so The role which was originally reserved for the quantities is thus taken over by the density matrix of the system S. Therefore, 〈B〉 reads The invariance of the above term is described by matrix theory. The trace is invariant under cyclic permutations, and both the matrices and B can be transformed into whatever basis is convenient, typically a basis of the eigenvectors. By cyclic permutations of the matrix product, it can be seen that an identity matrix will arise and so the trace will not be affected by the change in basis. A mathematical framework was described where the expectation value of quantum operators, as described by matrices, is obtained by taking the trace of the product of the density operator and an operator (Hilbert scalar product between operators). The matrix formalism here is in the statistical mechanics framework, although it applies as well for finite quantum systems, which is usually the case, where the state of the system cannot be described by a pure state, but as a statistical operator of the above form. Mathematically, is a positive-semidefinite Hermitian matrix with unit trace. Definition Given the density matrix ρ, von Neumann defined the entropy as which is a proper extension of the Gibbs entropy (up to a factor ) and the Shannon entropy to the quantum case. To compute S(ρ) it is convenient (see logarithm of a matrix) to compute the eigendecomposition of . The von Neumann entropy is then given by Since, for a