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