The ideal gas law can be manipulated to find the density of a gas if the molecular mass is known. Here's how to perform the calculation and advice about common mistakes and how to avoid them.

### Gas Density Problem

What is the density of a gas with molar mass 100 g/mol at 0.5 atm and 27 °C?**Solution:**

Before you begin, keep in mind what you're looking for as an answer, in terms of units. Density is defined as mass per unit volume, which could be expressed in terms of grams per liter or grams per milliliter.

You may need to do unit conversions. Keep on the lookout for unit mismatches when you plug values into the equation.

First, 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

Examine the units of R carefully. This is where many people get into trouble. You'll get an incorrect answer if you enter a temperature in Celsius or pressure in Pascals, etc. Use atmosphere for pressure, liters for volume, and Kelvin for temperature.

To find the density, we need to find the mass of the gas and the volume. First, find the volume. Here is the ideal gas law equation rearranged to solve for V:

V = nRT/P

Second, find the mass. The number of moles is the place to start. The number of moles is the mass (m) of the gas divided by its molecular mass (MM).

n = m/MM

Substitute this mass value into the volume equation in place of n.

V = mRT/MM·P

Density (ρ) is mass per volume. Divide both sides by m.

V/m = RT/MM·P

Invert the equation.

m/V = MM·P/RT

ρ = MM·P/RT

So, now you have the ideal gas law rewritten in a form you can use given the information you were given. Now it's time to plug in the facts:

Remember to use absolute temperature for T: 27 °C + 273 = 300 K

ρ = (100 g/mol)(0.5 atm)/(0.0821 L·atm/mol·K)(300 K) ρ = 2.03 g/L**Answer:**

The density of the gas is 2.03 g/L at 0.5 atm and 27 °C.

### How To Decide If You Have a Real Gas

The ideal gas law is written for ideal or perfect gases. You can use values for real gases so long as they act like ideal gases. To use the formula for a real gas, it must be at low pressure and low temperature. Increasing pressure or temperature raises the kinetic energy of the gases and forces the molecules to interact. While the ideal gas law can still offer an approximation under these conditions, it becomes less accurate when molecules are close together and energetic.