In statistical mechanics, the following molecular equation is derived from first principles
where  is the absolute pressure of the gas,  is the number density of the molecules (given by the ratio , in contrast to the previous formulation in which  is the number of moles),  is the absolute temperature, and  is the Boltzmann constant relating temperature and energy, given by:
where  is the Avogadro constant.
From this we notice that for a gas of mass , with an average particle mass of  times the atomic mass constant, , (i.e., the mass is  Da) the number of molecules will be given by
and since , we find that the ideal gas law can be rewritten as
In SI units,  is measured in pascals,  in cubic metres,  in kelvins, and  in SI units.