You probably learned early on in science classes that density is mass divided by volume, or the "amount" of a substance in a certain space. For solids, this is a pretty straightforward measure. If you fill a jar full of pennies, it would have a lot more "oomph" than if you filled it with marshmallows. There's a lot more substance packed into the jar when you fill it with pennies, whereas marshmallows are very puffy and light.

How about molecular weight? Molecular weight and density *seem* extremely similar, but there's an important difference. Molecular weight is a substance's mass per mole. It's not about how much space the substance takes up, but the "amount," the "oomph" or the "heft" of a certain amount of a substance.

So, to recap: **Density** is mass divided by volume. The mathematical formula looks like this:

The SI unit for mass is kilograms (although you may occasionally see it expressed in grams), and for volume it's typically m^{3}. So density in SI units is measured in kg/m^{3}.

Molecular weight is mass per mole, which is written:

Again, units matter: Mass, m, will probably be in kilograms, and n is a measurement of the number moles. So the units for molecular weight will be kilograms/mole.

## The Ideal Gas Law

So how do you convert back and forth between these measures? To convert a gas' molecular weight to density (or vice versa), use the **Ideal Gas Law**. The Ideal Gas Law defines the relationship between the pressure, volume, temperature and moles of a gas. It's written:

where P stands for pressure, V stands for volume, n is the number of moles, R is a constant that depends on the gas (and is usually given to you), and T is the temperature.

## Use the Ideal Gas Law to Convert Molecular Weight to Density

But the Ideal Gas Law doesn't mention molecular weight! However, if you rewrite n, the number of moles, in slightly different terms, you can set yourself up for success.

**Moles** is the same as mass divided by molecular weight.

With that knowledge, you can rewrite the Ideal Gas Law like this:

where M stands for molecular weight.

Once you have that, solving for density becomes simple. Density equals mass over volume, so you want to get mass over volume on one side of the equals sign and everything else on the other side.

So, the previous equation becomes:

when you divide both sides by RT.

Then multipling both sides by M and dividing by volume gives:

m÷V equals density, so

## Try an Example

Find the density of carbon dioxide (CO2) gas when the gas is at 300 Kelvin and 200,000 pascals of pressure. The molecular weight of CO2 gas is 0.044 kg/mole, and its gas constant is 8.3145 J/mole Kelvin.

You can start with the Ideal Gas Law, PV=nRT, and derive for density from there like you saw above (the advantage of that is that you only have to memorize one equation). Or, you can start with the derived equation and write:

Phew! Well done.