Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Equations of state: from the ideal gas to a real one

The puzzle: a lighter that sloshes, a cylinder that never does

Shake a butane lighter and you can hear it: liquid fuel, sloshing inside a transparent plastic shell, at room temperature, held there by nothing more exotic than the pressure of its own vapour. Beside it, a steel cylinder of compressed nitrogen sits on a workbench. Squeeze its regulator as hard as engineering allows and nothing sloshes — nitrogen at room temperature never liquefies, no matter how hard you compress it.

Both are just gases confined under pressure. Both, at low enough density, obey the same law:

PV=NkBT.PV = Nk_BT .

That law has no substance-specific constant in it anywhere — no molecular size, no attraction, nothing that could possibly distinguish butane from nitrogen. A law blind to what the molecules are cannot explain why one of them puddles at room temperature and the other flatly refuses to.

The answer is not exotic. Real molecules attract each other weakly at a distance, and they are not points — they take up room. Putting both effects back into the equation of state, carefully, is this module’s entire content.

Predict before you calculate

Commit to an answer for each of these before running anything. Write them down.

  1. You have a gas bottle at (N,V,T)(N, V, T). You bring an identical second bottle and open the valve between them, so the two merge into one system at the same TT — twice the gas, in twice the volume. Which of PP, VV, TT, NN, UU change, and which stay the same?

  2. CO2\mathrm{CO_2} at 280 K280\ \mathrm{K} is compressed slowly at fixed temperature. As the volume shrinks, does the pressure keep climbing, level off at some point, or do something else? Sketch the curve you expect.

  3. Is there a temperature above which no pressure, however large, can turn a gas into a liquid?

  4. Two different gases — say CO2\mathrm{CO_2} and N2\mathrm{N_2} — are each held at the same reduced temperature and reduced pressure (that is, the same multiple of their own critical temperature and critical pressure, even though those critical points are wildly different numbers). Do the two gases have the same compressibility factor ZZ, or does ZZ depend on which gas it is?

Explore the model

The laboratory notebook for this module lets you build a substance’s van der Waals surface from its constants aa and bb, morph it continuously from the flat ideal-gas sheet, drag a state point across it, and watch the three shadows that point casts onto the surrounding walls.

Here is the surface itself, rotating, as aa and bb turn on from zero and a fold appears where a flat sheet used to be:

The van der Waals (P,v,T)(P, v, T) surface, morphing on from the flat ideal-gas sheet as aa and bb are turned up to a real substance’s values. The fold that appears below the critical temperature is the geometric signature of liquefaction — nothing in the flat ideal surface could ever produce it.

Now watch a single isotherm sweep down through the critical temperature:

One van der Waals isotherm, replotted as its temperature sweeps from above the critical temperature to below it. Above TcT_c the curve falls smoothly, just like an ideal gas. Below TcT_c it develops a non-monotonic wiggle — the van der Waals loop — flagged here and left unexplained; see Verify.

And here is a single state point sliding across the surface, its three shadows tracing an isotherm, an isochore, and an isobar onto the three walls around it:

A state point moves in three legs — constant TT, then constant vv, then constant PP — and its shadow on each wall traces the corresponding named curve: an isotherm, an isochore, an isobar. Every point on the surface is simultaneously all three kinds of curve, depending on which pair of coordinates you hold fixed.

Run the laboratory now, then come back. Three things are worth doing before you read on:

Derive the result

The state postulate

Intensive versus extensive: the doubling test

Pressure had better be intensive for “the pressure of the gas” to mean anything: two adjacent litres of the same gas at the same temperature must report the same pressure, or a single gauge reading would be meaningless. The laboratory verifies this by direct computation for every equation of state below; the doubling test above is the reason it must come out that way.

The ideal gas law, reviewed

Two corrections, and the van der Waals equation

Excluded volume. A real molecule is not a point; it excludes other molecules from the small region bb it occupies. Replacing the per-particle volume vv available to move around in with the reduced volume v−bv - b:

P=kBTv−b.P = \frac{k_BT}{v - b}.

Because the denominator is smaller than vv, this correction alone always raises the pressure above the ideal value: molecules crowded into less usable room collide with the walls more often.

Adding both corrections to the ideal gas law gives the van der Waals equation of state:

  P=kBTv−b−av2  \boxed{\; P = \frac{k_BT}{v - b} - \frac{a}{v^2} \;}

Setting a=b=0a = b = 0 recovers the ideal gas law exactly — not approximately, as Verify checks directly against gases.ideal_gas_pressure. Neither correction is derived from first principles here; each is argued physically and then simply added, which is exactly why the box above is a model-assumption, not a theorem: the van der Waals equation is a plausible model, not a consequence of the state postulate the way the ideal gas law can be read as one.

The critical point

Look again at the isotherm animation above. Above TcT_c, pressure falls monotonically as vv grows — one vv for every PP, exactly as for an ideal gas. Below TcT_c, the curve is no longer monotonic: it rises where it should fall. The boundary between the two behaviours is a single special point, where the isotherm’s slope and its curvature both vanish at once:

(∂P∂v)T=0,(∂2P∂v2)T=0.\left(\frac{\partial P}{\partial v}\right)_T = 0, \qquad \left(\frac{\partial^2 P}{\partial v^2}\right)_T = 0.

Because PP depends on vv and TT alone — no explicit NN, since PP is intensive — solving these two equations together (a standard but slightly tedious piece of algebra, omitted here) gives:

Reduced variables and the compressibility factor

Define reduced variables Pr=P/PcP_r = P/P_c, vr=v/vcv_r = v/v_c, Tr=T/TcT_r = T/T_c — pressure, per-particle volume and temperature measured in units of the substance’s own critical point. Substituting the closed forms above into the van der Waals equation and simplifying eliminates aa, bb and every substance-specific number entirely:

Verify computationally

Deriving a formula and trusting it are different things. The laboratory checks the result several ways, and each check is also a test in the project’s test suite, so the claims on this page cannot silently rot.

1. The ideal-gas limit. As a,b→0a, b \to 0, gases.van_der_waals_pressure converges on gases.ideal_gas_pressure — the same function module 4 and module 5 already rely on (kinetics.py and paths.py import it from gases.py rather than each carrying their own copy).

2. The critical point: closed form versus a numerical scan. vdw_critical_point gives (vc,Tc,Pc)(v_c, T_c, P_c) from three lines of algebra. The laboratory also measures TcT_c a second, independent way — the kind of procedure an experimentalist without a closed form would actually run. Note what that procedure cannot be: below TcT_c the isotherm’s loop makes ∂P/∂v\partial P/\partial v cross zero at two perfectly ordinary points, so simply hunting for the smallest slope anywhere on a grid finds a sub-critical isotherm just as happily as the critical one. The laboratory instead sweeps down through the supercritical branch, where the isotherm stays monotonic and its flattest point shrinks continuously toward zero as T→Tc+T \to T_c^+, and stops at the first temperature that flattens below a small threshold.

3. Z approaches 1 in the dilute limit. As v→∞v \to \infty at fixed TT, both correction terms in the van der Waals equation vanish and Z→1Z \to 1 — the formal statement of “ideal gas” as a limit rather than a category.

4. The NIST CO2 isotherm falsifies “the ideal gas law is universal”. data/co2-isotherm-280k.csv holds representative published values for carbon dioxide’s isothermal pressure-volume behaviour at 280 K280\ \mathrm{K} — comfortably below CO2\mathrm{CO_2}'s critical temperature of 304.13 K304.13\ \mathrm{K}. Computing Z=Pv/(kBT)Z = Pv/(k_BT) along that isotherm and overlaying the ideal prediction Z=1Z = 1 shows the two diverging sharply as the gas is compressed: the measured pressure plateaus at the substance’s saturation pressure while a naive P=kBT/vP = k_BT/v prediction keeps climbing without limit, and ZZ falls to a small fraction of 1 deep in the two-phase region.

Transfer the idea

Check your understanding

  1. The state postulate says a simple compressible substance’s equilibrium states form a single two-dimensional surface in (P, v, T) space. Given the values of any two independent intensive variables -- say P and T -- what does the state postulate say about the rest?

    A. v (and every other equilibrium property) is already fixed -- the two you chose pick out one point on the surface, and a point on a surface has no remaining freedom. B. P, v and T are three fully independent knobs, so all three must be measured separately. C. Only extensive variables like V and N determine the state; P and T alone are not enough. D. This is true only for the ideal gas; real gases need a third independent variable.

    Check your answer

    Correct answer: A — v (and every other equilibrium property) is already fixed -- the two you chose pick out one point on the surface, and a point on a surface has no remaining freedom.

    • A. Right. That is exactly what “a single two-dimensional surface” means: two coordinates locate a point on it, and the third coordinate is then read off, not separately chosen.

    • B. This is what the state postulate denies. If P, v and T were independent, equilibrium states would fill a three-dimensional volume, not sit on a two-dimensional surface -- and there would be no such thing as “the equation of state”.

    • C. Backwards. P and T (both intensive) are exactly what the state postulate says suffices to fix v; N sets how much substance you have, not which point on the per-particle surface it occupies.

    • D. The state postulate is a general claim about any simple compressible substance’s equilibrium surface -- the van der Waals gas included. It does not add a degree of freedom the ideal gas lacked.

  2. You have a gas bottle at (N, V, T). You open a valve to an identical second bottle at the same state, merging into one system with twice the gas, in twice the volume, at the same T. Which of the following correctly lists what changes?

    A. V, N and U (the internal energy) double; P and T stay exactly the same. B. P, V, T and N all double. C. Nothing changes -- joining two identical systems just makes a bigger version of the same state. D. Only T changes, since heat flows between the two halves until they equilibrate.

    Check your answer

    Correct answer: A — V, N and U (the internal energy) double; P and T stay exactly the same.

    • A. Correct -- the doubling test: extensive quantities (V, N, U) double, intensive quantities (P, T, and v = V/N) do not move at all.

    • B. Doubling P and T along with V and N would make “the pressure of the gas” depend on how much gas happened to be in the room -- which cannot be right, since two adjacent litres of the same gas at the same temperature must report the same pressure.

    • C. V, N and U genuinely double; the two halves really do add up to twice the substance. Only the intensive quantities (P, T, v) stay fixed, not everything.

    • D. The two halves start at the same T, so there is nothing to equilibrate -- T was never going to move, and neither was P.

  3. A room measures 30 m^3 and holds air at 101325 Pa and 293 K. Using P V = N k_B T with k_B = 1.381e-23 J/K, how many gas particles does the room contain?

    Check your answer

    Correct answer: 7.51e+26 (± 2e+24)

    N = P V / (k_B T) = (101325)(30) / [(1.381e-23)(293)] = 7.51e26 particles -- the same calculation as P V = N k_B T, solved for N instead of P.

  4. CO2 gas at 280 K is compressed slowly at fixed temperature, well past several times its critical volume. Which best describes what a pressure gauge on the container actually reads, compared with the ideal-gas prediction P = k_B T / v?

    A. The measured pressure climbs more slowly than the ideal prediction, then plateaus at the substance’s saturation pressure while the ideal prediction keeps climbing without limit. B. The measured pressure tracks P = k_B T / v exactly at any density, since every gas obeys the ideal gas law. C. The measured pressure rises faster than the ideal prediction at every volume. D. The measured pressure drops to zero once the substance starts to condense.

    Check your answer

    Correct answer: A — The measured pressure climbs more slowly than the ideal prediction, then plateaus at the substance’s saturation pressure while the ideal prediction keeps climbing without limit.

    • A. Right -- this is exactly what the NIST CO2 isotherm data in this module shows: the real gas departs from P = k_B T / v well before condensation, and then flattens into a plateau the ideal law has no mechanism to produce at all.

    • B. This is exactly the claim the module’s NIST CO2 data falsifies. The ideal gas law contains no substance-specific constant, so it cannot know that CO2 condenses -- real CO2’s measured pressure departs sharply from the ideal prediction long before the plateau, let alone during it.

    • C. Attraction dominates over most of the compression, which lowers the measured pressure below the ideal prediction, not raises it -- only deep in the compressed liquid does pressure rise steeply.

    • D. Condensation holds the pressure at a constant, nonzero value -- the saturation pressure -- not zero. A pressure of zero would mean no gas left at all.

  5. Using a, b fit from CO2’s measured critical point (T_c = 304.13 K, P_c = 7.3773e6 Pa, via a = 27(k_B T_c)^2/(64 P_c), b = k_B T_c/(8 P_c)), compute the van der Waals pressure at a molar volume of 1.2e-3 m^3/mol (per-particle v = V_m/N_A) and T = 280 K. Give the signed fractional deviation from the ideal prediction k_B T/v at the same state (negative if the van der Waals pressure is lower).

    Check your answer

    Correct answer: -0.094 (± 0.01)

    Ideal: P = k_B T/v ~= 1.940e6 Pa. Van der Waals: P ~= 1.758e6 Pa. The attraction term a/v^2 dominates at this density -- the excluded-volume correction 1/(v-b) is still close to 1/v since v is far larger than b here -- so the net shift is negative, about -9.4%, well before condensation is anywhere in sight.

  6. A gas has per-particle van der Waals constants a = 1.0037e-48 Pa m^6 and b = 7.0855e-29 m^3 (converted from independently published textbook molar constants for CO2, not fit from its critical point). Using k_B T_c = 8a/(27b), compute T_c in kelvin.

    Check your answer

    Correct answer: 304.0 (± 1.0)

    T_c = 8a/(27 k_B b) ~= 304.0 K -- within 0.1% of CO2’s measured critical temperature, 304.13 K, even though a and b here came from an independent fit, not from the critical point itself. P_c = a/(27 b^2) ~= 7.40e6 Pa lands within about half a percent of the measured 7.3773e6 Pa the same way.

  7. Two different gases -- say CO2 and N2 -- are held at the same reduced temperature T_r and the same reduced pressure P_r, even though their critical points (and their a, b) are completely different numbers. Do the two gases have the same compressibility factor Z, or does Z depend on which gas it is?

    A. The same Z -- the law of corresponding states says any van der Waals substance at a given (T_r, P_r) has the same reduced volume v_r, and Z is built entirely out of reduced quantities once P_c v_c/(k_B T_c) = 3/8 is used to eliminate the substance- specific constants. B. Z depends on the gas’s chemistry, so it is never the same for two different gases. C. The same Z, but only because CO2 and N2 happen to have similar molecular masses -- for a very different pair of gases it would not hold. D. Only if both gases are measured at exactly their own critical points, T_r = P_r = 1.

    Check your answer

    Correct answer: A — The same Z -- the law of corresponding states says any van der Waals substance at a given (T_r, P_r) has the same reduced volume v_r, and Z is built entirely out of reduced quantities once P_c v_c/(k_B T_c) = 3/8 is used to eliminate the substance- specific constants.

    • A. Correct. P_r = 8T_r/(3v_r - 1) - 3/v_r^2 has no a, b or N_A left in it at all, so fixing (T_r, P_r) fixes v_r -- and hence Z -- the same way for every van der Waals substance, regardless of its own critical point.

    • B. This is true of the un-reduced pressure -- two gases at the same (v, T) generally have different P, because a and b differ. But once P, v and T are measured in units of each gas’s own critical point, that substance-specific information cancels out of the reduced equation entirely.

    • C. The law of corresponding states does not depend on molecular mass, or on any property of the two gases matching -- it follows from a, b cancelling out of the reduced van der Waals equation algebraically, for any pair of substances at all.

    • D. The reduced equation holds at every (T_r, P_r), not only at the critical point -- T_r = P_r = 1 is just the one point every reduced isotherm is required to pass through, by construction.

  8. In a few sentences: explain why a real substance’s P-v-T surface can fold below its critical temperature while the ideal-gas surface never can, naming the physical role that a and b each play in producing the fold.

    Check your answer

    The ideal-gas surface P = k_B T/v is smooth and monotonically falling in v at every fixed T, for the simple reason that it has no substance-specific information in it at all -- nothing in the formula can produce a region where pressure rises with volume. The van der Waals correction adds two such pieces of information: b, the excluded volume, which diverges the pressure as v approaches b from above; and a, the mean-field attraction, which pulls the pressure down at larger v. Below T_c, the competition between a rapidly rising 1/(v-b) term at small v and a slowly falling a/v^2 term at larger v produces a genuine non-monotonic region -- the fold, and its wiggle -- that cannot exist without both ingredients: setting either a or b to zero removes the critical point entirely (Problem 5(d) on the problem set makes this precise).

Exam-style problems for this module — the ones worth doing with a pen — are collected in the problem set.

Explain it in your own words

Answer in a few sentences each. These are the questions that reveal whether the ideas landed; no number will save you.

  1. Explain why calling the ideal gas law a “law” can mislead a reader, and say precisely what kind of statement it actually is.

  2. Explain, without writing an equation, why no pressure — however large — liquefies a gas above its critical temperature.

  3. Explain why v=V/Nv = V/N is intensive although VV and NN are each extensive.

  4. Describe what would be physically wrong with a substance whose isotherm had (∂P/∂v)T>0(\partial P/\partial v)_T > 0 somewhere.

Advanced: the virial expansion

The van der Waals equation is one particular, simple model of “real gases differ from ideal ones.” The systematic version of the same idea writes the compressibility factor as a power series in the density 1/v1/v:

Z=1+B(T)v+C(T)v2+⋯ ,Z = 1 + \frac{B(T)}{v} + \frac{C(T)}{v^2} + \cdots,

the virial expansion, whose coefficients can in principle be computed exactly from the intermolecular potential, order by order, rather than guessed at with two constants. Expanding the boxed van der Waals equation in powers of 1/v1/v gives its own second virial coefficient in closed form:

B(T)=b−akBT.B(T) = b - \frac{a}{k_BT} .

At low TT, B(T)<0B(T) < 0 — attraction dominates and Z<1Z < 1; at high TT, B(T)>0B(T) > 0 — excluded volume dominates and Z>1Z > 1. The crossover defines the Boyle temperature,

TB=akBb,T_B = \frac{a}{k_Bb},

the one temperature at which a van der Waals gas behaves ideally (Z=1Z = 1) over the widest possible range of density, because the two corrections cancel to leading order in 1/v1/v at every density simultaneously. Real gases have Boyle temperatures too, and the virial expansion — unlike the two-constant van der Waals model — can in principle be pushed to as many terms as the data justify.