A common homework problem involving the ideal gas law is finding the density of an ideal gas. The idea of the problem is to bring in previously learned concepts of density and molecular mass into problems involving mostly pressures, volumes, and temperatures. This example problem will show how to find the density of an ideal gas using the ideal gas law.
Density of an Ideal Gas Example Problem
Question: What is the density of an ideal gas with a molecular mass of 50 g/mol at 2 atm and 27 °C?
Solution:
Let’s start with the ideal gas law:
PV = nRT
where
P = pressure
V = volume
n = number of moles of gas
R = gas constant = 0.0821 L·atm/mol·K
T = absolute temperature
We know density ( ρ ) is mass (m) per unit volume. While the equation has a volume variable, there is no obvious mass variable. The mass can be found in the number of moles of the ideal gas.
The molecular mass ( M ) of the gas is the mass of one mole of the gas. This means n moles of the gas has a mass of nM grams.
m = nM
If we solve this for n we get
n = m/M
Now we have enough to find the density of the gas. First, solve the ideal gas equation for V.

Substitute n for what we found earlier

Divide both sides by m

Invert the equation

density ( ρ ) = m/V, so

From our question:
M = 50 g/mol
P = 2 atm
T = 27 °C
The first thing we need to do is convert the temperature to absolute temperature. Check out Converting Celsius to Kelvin Example for review. The conversion between Kelvin and Celsius is:
TK = TC + 273
TK = 27 + 273
TK = 300 K
Another tricky part of ideal gas problems is matching the units on the ideal gas constant R. We’re using liters, atm, and Kelvin so we can use the value
R = 0.0821 L·atm/mol·K
Plug all these values into our equation

ρ = 4.06 g/L
Answer: The density of an ideal gas of 50 g/mol at 2 atmospheres and 27 °C is 4.06 g/L.
This problem was straightforward to complete, but there are still parts where errors can be careless. When working with ideal gas problems, it is necessary to work with absolute temperatures. Remember to convert your units. The other tricky spot is choosing the correct value for R suited for your problem’s units. Here are some common R values for different units of volume, pressure, and temperature.
R = 0.0821 L·atm/mol·K
R = 8.3145 J/mol·K
R = 8.2057 m3·atm/mol·K
R = 62.3637 L·Torr/mol·K or L·mmHg/mol·K