Work and thermodynamic paths
The puzzle: same start, same finish, different bill¶
Take a gas in a cylinder. Its state is fixed by two numbers — say its pressure and its volume. Move it from state to state , and you might reasonably expect the cost of the journey to be fixed too. A litre of gas at two atmospheres is a litre of gas at two atmospheres, whatever route you took to get there.
That expectation is wrong, and the way in which it is wrong organises the whole of thermodynamics.
Two engineers each take the same gas from to . The first lets it expand slowly while keeping it at constant pressure, then cools it at constant volume. The second lets it expand while holding its temperature fixed. Both end with exactly the same gas in exactly the same state — same pressure, same volume, same temperature, same energy. And yet they did different amounts of work, and they moved different amounts of heat.
The answer will force us to be careful about a distinction we have been sliding over: some quantities describe where a system is, and others describe what happened to it. Confusing the two is the single most common error in this subject, and the mathematics has a precise name for the difference — exact versus inexact differentials.
Predict before you calculate¶
Commit to answers before reading on.
A gas expands from to at constant pressure. Then a second gas expands between the same two volumes at constant temperature, starting from the same pressure. Which does more work, and why?
In the two-leg route above (expand at constant pressure, then cool at constant volume) and the isothermal route, which transfers more heat?
Take a gas around a closed loop, back to exactly where it started. Is the net work zero? Is the net change in internal energy zero?
A gas is compressed suddenly by slamming a piston down. Is the work still the area under the curve in the – plane?
Explore the model¶
The laboratory for this module is a path editor: you place points in the – plane, the notebook joins them into a route, and it computes the work along that route while comparing it with other routes between the same two endpoints.
Here is the comparison the module is about. Two routes leave the same point and arrive at the same point. The bars track the work accumulating along each one:
Two routes traced between identical endpoints in the pressure–volume plane, with bars tracking the work accumulating along each. Identical endpoints, identical final state — and two different bills. Nothing about the endpoints could have told you this; only the route does.
And here is why engines can exist at all. A cycle brings the gas back to precisely where it started, so every state function returns to its value. The enclosed area does not:
A rectangular cycle traced repeatedly in the pressure–volume plane, with the enclosed area shading in. Around a closed loop , but . The shaded area is the net work per cycle, and an engine is a device for collecting it.
Before reading the derivation, do three things in the notebook:
Draw any two different routes between the same endpoints and compare the work.
Draw a closed loop and check whether the net work is zero.
Compare an isotherm with an adiabat starting from the same point, and notice which is steeper.
Derive the result¶
System and boundary. The gas inside the cylinder. The piston is the moving boundary.
Sign convention. This course uses, everywhere and without exception,
where is positive when heat flows into the gas and is positive when work is done on the gas. Compressing a gas therefore does positive work on it; letting it expand does negative work on it.
The work done in a small displacement¶
The gas pushes on the piston with force , where is the piston’s area. To move the piston inward by , an external agent must do work on the gas. The volume change is , so
For a finite quasistatic path from to ,
Everything hinges on that innocent-looking inside the integral. It is the gas’s own pressure, and writing it there already assumes the gas has one — that it is in equilibrium throughout. That assumption is exactly the quasistatic condition in the model specification, and question 4 above was about what happens when it fails.
Why the answer depends on the route¶
inside the integral is not a fixed function of ; it depends on what else you are doing to the gas. Along an isotherm, . Along an adiabat, is constant. Along an isobar, is constant. Each gives a different curve between the same two points, and therefore a different area beneath it.
For the ideal-gas routes in the puzzle, between and at the same temperature:
With these are and respectively. The two-leg route costs about 45% more work, for an identical final state.
The exactness of , and the inexactness of and ¶
For an ideal gas, , a function of the state alone. Its change between two states is therefore the same for every route:
This is why the phrase “the heat contained in this gas” is not merely imprecise but meaningless. A gas contains internal energy. Heat is one of the two ways energy crosses its boundary; work is the other. Asking how much heat is in a gas is like asking how much of the water in a lake arrived by river rather than by rain.
Combining the two facts gives the resolution of the puzzle: since is fixed by the endpoints and is not, the first law forces to differ too, by exactly the compensating amount:
The two path functions vary; their combination does not.
Verify computationally¶
Four checks, each of which is also an automated test in the project’s suite.
1. The closed forms. Numerical integration of along an isotherm reproduces , and along an adiabat reproduces , to a relative error below 10-6.
2. Convergence. The trapezoid rule converges at second order. Refining the sampling of a path from 17 to 257 points shrinks the error by the predicted factor, and the fitted convergence order is 2.0. A scheme that produced a plausible number without that scaling would be wrong in a way no eyeball could catch.
3. Path dependence, quantitatively. Two routes between identical endpoints differ in by more than , while their agree to machine precision. That single pair of numbers is the entire lesson of this module in computational form.
4. The first law closes. On every path, identically. This is not a check of physics — it is a check that the code has not quietly redefined a sign.
Transfer the idea¶
The state-versus-path distinction is not a quirk of gases.
Altitude and distance travelled. Your change in altitude between two points on a mountain is a state function of the endpoints; the distance you walked is not. Nobody is tempted to ask how much “distance” is stored at the summit.
Bank balance, deposits and withdrawals. The balance is a state function; the amounts deposited and withdrawn are path functions. A balance of £100 does not consist of “£300 of deposits and −£200 of withdrawals” — the split is a property of the history, not of the account.
Electrical work. For a battery, plays exactly the role of ; the pattern “intensive variable times change in extensive variable” recurs for every kind of work, including magnetic () and surface () work.
Engines. A cycle returns the working substance to its starting state, so and the net work equals the net heat. Everything an engine does is contained in the fact that the path functions do not cancel around a loop even though the state functions do. That is module 7.
Check your understanding¶
A cylinder of gas sits on a bench. Which question is meaningful, and which is not?
A. “How much internal energy does it have?” is meaningful; “how much heat does it contain?” is not. B. Both are meaningful — heat is simply the thermal part of the internal energy. C. Neither is meaningful, because both depend on the path taken. D. “How much heat does it contain?” is meaningful; “how much internal energy?” is not, because energy has no absolute zero.
Check your answer
Correct answer: A — “How much internal energy does it have?” is meaningful; “how much heat does it contain?” is not.
A. Correct. Internal energy is a state function, so the gas has a definite amount of it. Heat is one of the two ways energy crosses the boundary, so it belongs to a process, not to a state. A gas contains energy; it does not contain heat.
B. There is no way to separate internal energy into a “thermal part” that arrived as heat and a “mechanical part” that arrived as work. Two identical gases in identical states may have been prepared by entirely different mixes of heating and compression.
C. Internal energy does not depend on the path — that is exactly what makes it a state function, and it is why ΔU comes out the same for every route between two states.
D. It is true that internal energy is measured from an arbitrary reference, but that affects only the zero point; differences are perfectly well defined. Heat, by contrast, has no state-function status at all, not even up to a constant.
A gas is taken from state A to state B along two different quasistatic paths. Which statement is always true?
A. ΔU is the same on both paths; W_on and Q may each differ, but their sum does not. B. W_on is the same on both paths, because the endpoints are the same. C. Q is the same on both paths, because the temperature change is the same. D. Both W_on and Q are the same, since the gas cannot tell which route it took.
Check your answer
Correct answer: A — ΔU is the same on both paths; W_on and Q may each differ, but their sum does not.
A. Exactly. The first law ties the two path functions to one state function: whatever work fails to supply, heat must make up. This is the whole content of the module in one sentence.
B. Work is the area under the path in the P-V plane, and different paths between the same endpoints enclose different areas. For the standard example the two-leg route costs about 45% more than the isotherm.
C. The temperature change is indeed the same — it is a state function. But heat is not determined by ΔT alone; it also depends on how much work was done along the way.
D. The gas indeed cannot tell — which is precisely why its state functions are identical. The path functions describe what happened at the boundary, and the boundary very much can tell.
Using dU = δQ + δW_on, a gas expands isothermally and reversibly. What are the signs of W_on, Q and ΔU?
A. W_on < 0, Q > 0, ΔU = 0. B. W_on > 0, Q < 0, ΔU = 0. C. W_on < 0, Q = 0, ΔU < 0. D. W_on < 0, Q > 0, ΔU > 0.
Check your answer
Correct answer: A — W_on < 0, Q > 0, ΔU = 0.
A. Right. The gas pushes its piston out, so work done on it is negative; its temperature and hence its internal energy are unchanged; so heat must flow in to supply exactly the energy the gas spent on its surroundings.
B. The signs are inverted. In our convention W_on is positive when work is done ON the gas, i.e. during compression. This is expansion.
C. That describes an adiabatic expansion, where no heat flows and the gas cools. Here the temperature is held fixed, which requires heat to flow in.
D. For an ideal gas U depends only on temperature, and the temperature is constant, so ΔU must be exactly zero.
Why is heat written δQ rather than dQ?
A. Because there is no function Q of the state whose difference gives the heat transferred. B. Because δ denotes a small quantity while d denotes an infinitesimal one. C. Because heat is not conserved, unlike energy. D. Because heat can be negative, and d is reserved for positive quantities.
Check your answer
Correct answer: A — Because there is no function Q of the state whose difference gives the heat transferred.
A. Correct, and the cross-derivative test makes it concrete: for an ideal gas ∂M/∂V ≠ ∂N/∂T for δQ, so no such function exists. Dividing by T repairs the failure and produces the entropy — which is why δQ/T earns a proper d.
B. Both symbols denote infinitesimals. The distinction is not about size but about whether the infinitesimal is the differential of some state function.
C. Non-conservation is not the issue: work is not conserved either, and volume is conserved but perfectly exact. What matters is whether a state function exists.
D. Exact differentials are routinely negative — dU is negative whenever a system loses energy. Sign has nothing to do with exactness.
A piston is slammed down suddenly, compressing a gas. Is the work done on the gas equal to the area under a curve in the P-V plane?
A. No — during the process the gas has no single pressure, so there is no curve to draw. B. Yes — the work is always the area under the curve, since that is the definition. C. Yes, provided the initial and final states are equilibrium states. D. No — because work is only defined for reversible processes.
Check your answer
Correct answer: A — No — during the process the gas has no single pressure, so there is no curve to draw.
A. Right. The work is -∫P_ext dV, using the pressure applied at the boundary. Only when the process is quasistatic does P_ext equal the gas’s own P, and only then is the area under the P-V curve the work.
B. The definition is δW_on = -P_ext dV at the boundary. Writing the gas’s own P there smuggles in the assumption that the gas is in equilibrium throughout, which a slammed piston violates.
C. Well-defined endpoints are not enough. The integral needs a well-defined pressure at every point along the way, not just at the ends.
D. Work is perfectly well defined for irreversible processes; it is simply not given by the area under a P-V curve for the gas. Engines would be unanalysable otherwise.
One mole of ideal gas at 300 K expands isothermally and reversibly from 10.0 L to 20.0 L. Compute the work done ON the gas, in joules. Use R = 8.314 J/(mol K).
Check your answer
Correct answer: -1729.0 (± 15.0)
W_on = -nRT ln(V2/V1) = -(1)(8.314)(300) ln 2 = -1729 J. The sign is negative because the gas does work on its surroundings. If you obtained +1729 you are using the other sign convention — which is fine elsewhere, but not in this course.
A gas is taken around a closed cycle and returns to its exact starting state. Which is true of one complete cycle?
A. ΔU = 0, and the net work on the gas equals minus the net heat absorbed. B. All of ΔU, Q and W_on are zero, since nothing has changed. C. ΔU = 0 and W_on = 0, so Q = 0 as well. D. The net work equals the area under the upper curve of the cycle.
Check your answer
Correct answer: A — ΔU = 0, and the net work on the gas equals minus the net heat absorbed.
A. Correct — and this is what makes engines possible. The state function returns to its value, so the two path functions must cancel each other rather than vanish individually.
B. Only the state function must return to its value. If Q and W_on both vanished around every loop, no engine could ever produce net work, and yet they plainly do.
C. The net work around a loop is minus the enclosed area, which is zero only for a degenerate loop with no area. A genuine cycle encloses area.
D. It equals the enclosed area — the area under the upper branch minus the area under the lower one, since the return leg contributes with the opposite sign.
A gas expands adiabatically and quasistatically. What happens to its temperature?
A. It falls, because the gas does work on its surroundings with no heat flowing in to replace the energy. B. It stays constant, because “adiabatic” means no temperature change. C. It rises, because compression of the surroundings heats the gas. D. It stays constant, because no heat enters or leaves.
Check your answer
Correct answer: A — It falls, because the gas does work on its surroundings with no heat flowing in to replace the energy.
A. Correct. Adiabatic means Q = 0, so the first law gives ΔU = W_on < 0 for an expansion. The gas pays for the work out of its own internal energy, and for an ideal gas that energy is the temperature.
B. This confuses adiabatic with isothermal. Adiabatic constrains the heat (Q = 0); isothermal constrains the temperature. They are different constraints, and for an expanding gas they give opposite answers — which is exactly why the two curves in the P-V plane have different slopes.
C. The gas is expanding, not being compressed. An adiabatic compression does raise the temperature, and that is how a diesel engine ignites its fuel.
D. No heat crossing the boundary does not mean no energy crossing it. Work is the other channel, and along an adiabat it is the only one.
Before calculating: a gas expands from V to 2V, once at constant pressure and once at constant temperature, both starting from the same state. Predict which route does more work on the surroundings, and by roughly what factor.
Check your answer
The isobaric route does more: |W| = P₁V for constant pressure against N k_B T ln 2 ≈ 0.69 P₁V for the isotherm, so about 45% more. The reason is visible without algebra — along the isotherm the pressure falls as the gas expands, so the gas is pushing against less and less, while the isobaric route keeps the pressure at its initial value the whole way. Anyone who predicted the isotherm was probably picturing the isotherm’s larger temperature-related heat flow rather than the area under the curve.
In a few sentences, explain to a classmate why “reversible” means more than “can be run backwards”, using a concrete example where a process can be undone for the system but not for the universe.
Check your answer
A strong answer distinguishes restoring the system from restoring system and surroundings together. Free expansion is the standard example: a gas that has expanded into a vacuum can certainly be pushed back into its original volume, but doing so requires work from outside and dumps heat into the surroundings, which are then permanently changed. A reversible process leaves no such trace anywhere. Answers that stop at “you can run the film backwards” have described time-reversal of the mechanics, which is true of the free expansion too and therefore cannot be the distinguishing feature.
Exam-style problems are in the problem set.
Explain it in your own words¶
Explain to someone who has not taken this course why “the heat contained in a gas” is not a meaningful quantity, using an analogy of your own rather than one of ours.
A student writes for a process. What has gone wrong, and what is the correct way to write what they meant?
Two processes take a gas between the same states; one transfers twice as much heat as the other. Explain how this is consistent with energy conservation.
Why does the notation use for heat and work but for internal energy? Answer in terms of what would go wrong if we used for all three.
Advanced: what “inexact” means mathematically¶
Differential forms. In the plane the heat transfer of an ideal gas is
For a differential to be exact — that is, to be for some function — it must satisfy . Here while . The test fails, and it fails by exactly the amount that makes heat path-dependent. There is no function , and no amount of clever algebra will produce one.
Integrating factors. Remarkably, dividing by fixes it:
and now the cross-derivatives both vanish. The inexact has become an exact differential, and the state function whose differential it is has a name: the entropy, . That is an integrating factor for heat is one way to state the second law, and it is what module 7’s Clausius inequality establishes.
Irreversible work, properly. When a piston is slammed down, the gas near it is compressed before the far side knows anything has happened; there is no single and the – plane has no curve to draw. What is still true is that the work done on the gas is , using the external pressure applied at the boundary. For a quasistatic process and the two agree. Otherwise during compression and during expansion, so an irreversible round trip always leaves the gas with more energy than it started with — which is dissipation, seen from the mechanical side. If you answered “yes” to question 4 in the predictions, this paragraph is the correction.