Derivation of the ideal gas law