Ideal Gas Law: PV = nRT

April 12, 2026

Problem

A gas is held in a rigid piston at 300 K with volume 25 L and 1 mole of gas. Show how the pressure changes when you vary temperature, volume, or amount of gas.

Explanation

Gas pressure seems mysterious until you see it for what it actually is: tiny particles crashing into the walls of their container, millions of times per second. Every collision gives the wall a little push. Add up all those pushes over the entire wall area, and you get a measurable force per unit area — which is exactly what "pressure" means.

Once you see gas pressure as billions of microscopic collisions, everything about the ideal gas law becomes intuitive. Want more pressure? Heat up the gas so the particles crash harder. Shrink the container so they crash more often. Add more particles so there are more crashes. That's literally what PV=nRTPV = nRT is saying, compressed into symbols.

The big picture: what's in that equation?

PV=nRTP\,V = n\,R\,T

  • PP is the pressure (force per unit area) the gas pushes on the container walls, measured in pascals (Pa) or atmospheres (atm).
  • VV is the volume the gas occupies, measured in cubic meters (m³) or liters (L).
  • nn is the amount of gas in moles — essentially "how many particles are there, counted in units of Avogadro's number (6.022×10236.022 \times 10^{23})."
  • TT is the absolute temperature in kelvin (never Celsius!), which is proportional to the average kinetic energy of the particles.
  • RR is the universal gas constant: R=8.314  J/(mol\cdotpK)R = 8.314\;\text{J/(mol·K)}. It's a conversion factor that makes the units work — pure bookkeeping.

The equation is a relationship between four properties that any gas at ordinary conditions obeys pretty accurately. If you know three of them, the equation tells you the fourth.

Why this one equation is so powerful

The ideal gas law actually contains three earlier historical laws as special cases, which you might have seen named individually. Let me show you:

Boyle's Law (1662): If you keep temperature and amount of gas fixed, then PV=constPV = \text{const}. Squeeze the gas into half the volume and the pressure doubles.

Charles's Law (1780s): If you keep pressure and amount of gas fixed, then V/T=constV/T = \text{const}. Heat the gas to twice the absolute temperature and it expands to twice the volume.

Gay-Lussac's Law (1809): If you keep volume and amount of gas fixed, then P/T=constP/T = \text{const}. Heat the gas to twice the temperature (in a sealed container) and the pressure doubles.

All three of these are just special slices of PV=nRTPV = nRT. Fix the right variables and the general law collapses into one of the named laws. That's why they're all equivalent once you have the full ideal gas law.

Solving the default problem: T=300  KT = 300\;\text{K}, V=25  LV = 25\;\text{L}, n=1  moln = 1\;\text{mol}

Let's find the pressure directly using the formula, then we'll check it three ways.

Method 1: Direct substitution into PV=nRTPV = nRT

Solve for PP:

P=nRTVP = \dfrac{nRT}{V}

Convert volume to SI units: V=25  L=0.025  m3V = 25\;\text{L} = 0.025\;\text{m}^{3}.

Plug in:

P=(1  mol)(8.314  J/mol\cdotpK)(300  K)0.025  m3P = \dfrac{(1\;\text{mol})(8.314\;\text{J/mol·K})(300\;\text{K})}{0.025\;\text{m}^{3}}

=2494.2  J0.025  m3= \dfrac{2494.2\;\text{J}}{0.025\;\text{m}^{3}}

99,768  Pa\approx 99{,}768\;\text{Pa}

That's about 99.8  kPa99.8\;\text{kPa}, or almost exactly 1 atmosphere (1 atm =101,325= 101{,}325 Pa). Which is comforting — a normal amount of air in a normal-sized container at room temperature should indeed be at roughly atmospheric pressure.

Method 2: Doubling the temperature (Gay-Lussac, isochoric)

Now suppose we hold volume constant at 25 L and heat the gas from 300 K to 600 K. What happens to pressure?

By Gay-Lussac's Law at constant VV and nn:

P1T1=P2T2\dfrac{P_{1}}{T_{1}} = \dfrac{P_{2}}{T_{2}}

P2=P1T2T1=99,768600300=199,536  PaP_{2} = P_{1} \cdot \dfrac{T_{2}}{T_{1}} = 99{,}768 \cdot \dfrac{600}{300} = 199{,}536\;\text{Pa}

Pressure doubles — makes sense, because the particles' average kinetic energy doubles when the absolute temperature doubles, so they hit the walls harder (and faster) by a factor of two.

Switch the process mode widget to "Isochoric" and drag the temperature. You'll see the pressure track linearly with TT.

Method 3: Halving the volume (Boyle, isothermal)

Now hold temperature at 300 K and compress the gas from 25 L to 12.5 L. What happens to pressure?

By Boyle's Law at constant TT and nn:

P1V1=P2V2P_{1} V_{1} = P_{2} V_{2}

P2=P1V1V2=99,7682512.5=199,536  PaP_{2} = P_{1} \cdot \dfrac{V_{1}}{V_{2}} = 99{,}768 \cdot \dfrac{25}{12.5} = 199{,}536\;\text{Pa}

Pressure also doubles — but for a different reason. The particles have the same speed (temperature is unchanged), but now they're packed into half the space, so they hit the walls twice as often. More collisions per second → double the pressure.

Switch the mode to "Isothermal" and drag the volume slider. Pressure scales inversely.

Method 4: Doubling the particle count (isobaric, variable VV)

Finally, what if we hold PP and TT fixed and double nn? By rearranging:

V=nRTPV = \dfrac{nRT}{P}

At fixed PP and TT, volume scales linearly with nn. Doubling the amount of gas doubles the volume. (Imagine a balloon — blow in twice as many particles and the balloon inflates to twice the volume at the same atmospheric pressure.)

What does the particle animation show?

Turn on Show particles in the controls. Those colored dots bouncing around the container are each representing a molecule. Their speed is scaled to be proportional to T\sqrt{T} — that's because the average kinetic energy of a gas molecule is:

12mv2=32kBT\langle \tfrac{1}{2}m v^{2}\rangle = \tfrac{3}{2}k_{\text{B}} T

where kB=R/NA=1.381×1023  J/Kk_{\text{B}} = R / N_{\text{A}} = 1.381 \times 10^{-23}\;\text{J/K} is Boltzmann's constant — basically RR divided by Avogadro's number to give you a "per-particle" gas constant.

Solving for speed:

vrms=3kBTmv_{\text{rms}} = \sqrt{\dfrac{3 k_{\text{B}} T}{m}}

For nitrogen (N₂, m4.65×1026  kgm \approx 4.65 \times 10^{-26}\;\text{kg}) at room temperature, vrms515  m/sv_{\text{rms}} \approx 515\;\text{m/s}. That's faster than the speed of sound! (Sound speed in air is about 343 m/s, and it depends on how fast molecular collisions can propagate information, which is tied to vrmsv_{\text{rms}}.)

Increase the temperature slider and the particles visibly speed up. Decrease it and they slow down. The pressure gauge responds accordingly.

Turn on Color by speed to see each particle colored according to its speed — fast ones in yellow/orange, slow ones in cyan. Even at the same temperature there's a distribution of speeds, which is a preview of the Maxwell-Boltzmann distribution (problem 182 in this category).

Why is it called an "ideal" gas?

The ideal gas law assumes two things about the molecules:

  1. Molecules don't interact with each other except when they physically collide (no electrical attraction or repulsion between them).
  2. The molecules themselves take up no volume — they're treated as point particles.

Neither assumption is exactly true for a real gas. At ordinary temperatures and pressures, these approximations are good enough that the ideal gas law predicts behavior to within about 1%. But the ideal gas model breaks down in two limits:

  • Very high pressures — the molecules are packed tight enough that the volume they themselves occupy becomes significant, and the "available" volume isn't really VV but VnbV - nb where bb is a per-molecule excluded volume.
  • Very low temperatures (near condensation) — the molecules are moving slowly enough that their intermolecular attractions start to matter, pulling them toward each other and reducing the effective pressure.

Real gases are described more accurately by the van der Waals equation:

(P+an2V2)(Vnb)=nRT\left(P + \dfrac{a n^{2}}{V^{2}}\right)(V - nb) = nRT

where aa (attraction) and bb (excluded volume) are gas-specific constants. For most practical purposes — tires, weather balloons, scuba tanks, car engines at typical operating ranges — the simple ideal gas law is good enough.

Real-world connections

The ideal gas law is everywhere once you know to look for it:

  • Car tires. When you check tire pressure on a cold winter morning, you'll find it's a few psi lower than in summer. That's Gay-Lussac: volume is fixed (rigid tire), so lower temperature means lower pressure. Tire pressure typically drops about 1 psi for every 10°F (5.6°C) drop in temperature.
  • Hot air balloons. Heat the air inside a balloon and it expands to fill more volume at the same (atmospheric) pressure — Charles's Law. The heated air is less dense than surrounding cool air, so the balloon floats.
  • Scuba diving. As a diver descends, the water pressure squeezes the air in their lungs to a smaller volume (Boyle's Law). That's why divers have to exhale continuously when ascending — if they hold their breath, the expanding air can rupture their lungs.
  • Weather. A warm, moist air mass rises, cools adiabatically (see problem 178), and eventually the cooler air can't hold as much water vapor, so clouds form. The whole process obeys gas laws.
  • Cooking. A pressure cooker raises the boiling point of water by increasing pressure — which makes steam, which has a larger volume than liquid water (vapor is roughly n=1n = 1 mol/V=22.4V = 22.4 L at STP, while liquid water is n=1n = 1 mol/V=0.018V = 0.018 L — a factor of ~1250).

Common mistakes to watch for

  • Using Celsius for TT. The equation absolutely requires kelvin. Converting from 25°C to 298 K is essential. Plugging in 25 instead of 298 gives the wrong answer by more than a factor of ten.
  • Mixing unit systems. If you use R=8.314  J/(mol\cdotpK)R = 8.314\;\text{J/(mol·K)}, then PP must be in pascals, VV in m³, and TT in kelvin. If you use R=0.0821  L\cdotpatm/(mol\cdotpK)R = 0.0821\;\text{L·atm/(mol·K)} instead, then VV should be in liters and PP in atmospheres. Don't mix.
  • Forgetting to convert volume units. 25 L =0.025= 0.025 m³, not 0.250.25 or 2500025000. The factor of 1000 is very easy to lose.
  • Confusing nn (moles) with NN (number of molecules). The equation as written uses moles. If you have NN molecules, convert: n=N/NAn = N / N_{\text{A}} where NA=6.022×1023N_{\text{A}} = 6.022 \times 10^{23}.
  • Applying the law outside its regime. Very high pressure (>10 atm), very low temperature (near the boiling point), or very dense gases — the ideal gas law starts to fail. Use van der Waals or a real-gas equation of state in those regimes.

Try it

  • Set the mode to "Isothermal" and sweep the volume slider. Watch the pressure rise as you compress — this is Boyle's Law in action. The particle density visibly increases, and you can see more wall collisions per unit time.
  • Set the mode to "Isobaric" (pressure fixed) and sweep temperature. Volume grows linearly with TT — that's Charles's Law. In this mode, the right wall of the container physically moves outward to maintain constant pressure.
  • Set the mode to "Isochoric" (volume fixed) and sweep temperature. Pressure grows linearly with TT — Gay-Lussac. The particles visibly speed up and hit the walls harder.
  • Turn on "Show derivation" to see the formula P=nRT/VP = nRT/V substituted with your current slider values, step-by-step.
  • Turn on "Show STP reference" to overlay the standard-temperature-and-pressure benchmark (T=273.15  KT = 273.15\;\text{K}, P=1  atmP = 1\;\text{atm}). For 1 mole, STP gives V=22.4  LV = 22.4\;\text{L}.
  • Crank the temperature way up (toward 800 K). Notice how the particles become nearly invisible due to their high speed — that's why gas in a rocket engine combustor moves so fast.

Interactive Visualization

Parameters

300.00
0.03
1.00
Free
80.00
1.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Ideal Gas Law: PV = nRT | MathSpin