A helium balloon rises; a carbon dioxide cloud from dry ice sinks to the floor. Both are about density, and the The Ideal Gas Law gives a gas's density from its molar mass, its pressure and its temperature.
Key idea
Write the moles as mass over molar mass, $n = m/\mathcal{M}$, in $PV = nRT$ and rearrange: $$d = \frac{m}{V} = \frac{P\mathcal{M}}{RT}, \qquad \mathcal{M} = \frac{dRT}{P}.$$ With $R = 0.08206\ \text{L·atm/(mol·K)}$, $P$ in atm and $T$ in K, $d$ comes out in g/L. Heavier molecules, higher pressure or lower temperature mean a denser gas.
Why it works
At a given temperature and pressure, a liter of any ideal gas holds the same number of molecules (Avogadro's law). So the density simply follows the mass of each molecule: $\mathrm{CO_2}$ (44 g/mol) is about 1.5 times as dense as air (29 g/mol), and helium (4 g/mol) about a seventh. Squeeze the gas (raise $P$) and more molecules fit in each liter; warm it (raise $T$) at constant pressure and it spreads out, so each liter holds fewer. A gas has no fixed density the way a solid does.
Worked example: Density of carbon dioxide
Find the density of $\mathrm{CO_2}$ ($44.01\ \text{g/mol}$) at $25^\circ\text{C}$ and $1.00\ \text{atm}$.
- $T = 298.15\ \text{K}$.
- $$d = \dfrac{P\mathcal{M}}{RT} = \dfrac{(1.00)(44.01)}{(0.08206)(298.15)} = 1.80\ \text{g/L}$$
- Air at the same conditions is about 1.18 g/L, so $\mathrm{CO_2}$ sinks in air.
Answer: $1.80\ \text{g/L}$
Worked example: Identify a gas
A pale yellow-green gas has a density of $2.90\ \text{g/L}$ at $25^\circ\text{C}$ and $1.00\ \text{atm}$. Find its molar mass and suggest what it is.
- $$\mathcal{M} = \dfrac{dRT}{P} = \dfrac{(2.90)(0.08206)(298.15)}{1.00} = 71.0\ \text{g/mol}$$
- $\mathrm{Cl_2}$ has $\mathcal{M} = 70.90\ \text{g/mol}$ and is yellow-green.
Answer: About $71\ \text{g/mol}$: chlorine, $\mathrm{Cl_2}$.
Worked example: Hot air
Air (average molar mass $28.96\ \text{g/mol}$) is heated from $25^\circ\text{C}$ to $100^\circ\text{C}$ at $1.00\ \text{atm}$. How does its density change?
- At $298.15\ \text{K}$: $d = \dfrac{28.96}{(0.08206)(298.15)} = 1.18\ \text{g/L}$.
- At $373.15\ \text{K}$: $d = \dfrac{28.96}{(0.08206)(373.15)} = 0.946\ \text{g/L}$.
- The hot air is about 20% less dense, which is what lifts a hot-air balloon.
Answer: From $1.18$ to $0.946\ \text{g/L}$.
Common mistake
Treating a gas as if it had a fixed density, like a solid or liquid. Its density depends strongly on temperature and pressure: the same nitrogen is 1.25 g/L at 0 °C and 1 atm but 12.5 g/L at 10 atm. Check: whenever you use a gas density, the temperature and pressure must be stated with it.