Derivation of the Gibbs entropy, Lagrange’s method of undetermined multipliers, Boltzmann distribution, and molecular partition function q.