First, on the basis of a universal definition of density – the amount of substance per unit volume. In that case, if pure hydrogen is in a sealed vessel, the gas density is determined by the elementary formula (M1 – M2)/V, where M1 is the total mass of the vessel with the gas, M2 – mass of empty vessel, and V is the internal volume of the vessel.
If you want to determine the density of hydrogen, with such initial data, as its temperature and pressure, then comes to the aid of the universal equation of state ideal gas law or the equation Mendeleev – Clapeyron: PV = mRT/M.
P – gas pressure
V is the volume
R – the universal gas constant
T is the gas temperature in degrees Kelvin
M – molar mass of gas
m – the actual weight of gas.
An ideal gas is a mathematical model of gas in which the potential energy of interaction between molecules compared to their kinetic energy can be neglected. In the model of an ideal gas between the molecules are forces of attraction or repulsion and collision of the particles with other particles or vessel walls are absolutely elastic.
Of course, neither hydrogen nor another gas is not ideal, but this model allows calculating with high accuracy at conditions close to atmospheric pressure and room temperature. For example, given the task: find the density of hydrogen at a pressure of 6 atmospheres and a temperature of 20 degrees Celsius.
First, set all the initial value SI (6 atmospheres = 607950 PA, 20 degrees C=293 degrees K). Then write the equation Mendeleev-Clapeyron law PV = mRT/M. Convert it in the form: P = mRT/MV. Since m/V is density (the ratio of the mass of a substance to its volume), you get: the density of hydrogen = PM/RT, where all the necessary data for the solution we have. You know the amount of pressure (607950), temperature (293), universal gas constant (8,31), the molar mass of hydrogen (0,002).
Substituting these numbers into the formula you get: the density of hydrogen under specified conditions of pressure and temperature is 0.499 kg/cubic meter, or about 0.5.