Work done by gases

Push a bicycle pump slowly and the piston fights back — the compressed air inside is doing negative work on your hand, while your hand does positive work on the gas. Let go of a stretched balloon's neck and the escaping gas expands, shoving air out of the way and doing positive work on its surroundings. In both cases the amount of work done is not just "force times distance" in the usual sense; it depends on how the pressure of the gas changes as its volume changes, and it feeds straight into the first law of thermodynamics as the term that links heat, internal energy, and mechanical output. This idea — work done by (or on) a gas as it expands or is compressed — is one of the most numerically testable ideas in Class 11 thermodynamics, because it can be read directly off a pressure-volume graph as the area under the curve. Get comfortable with three cases: constant pressure, constant temperature, and constant volume, and you can handle almost every numerical this unit throws at you, including multi-step and cyclic processes.

The core insight

Work done by a gas equals ∫p dV\int p\,dV, the area under its path on a pp–VV diagram, so the same expansion can do different amounts of work depending on the path taken, not just the start and end states.

The core idea

Work as area under the curve. When a gas pushes a piston outward by a tiny volume dVdV while at pressure pp, it does a small amount of work dW=p dVdW = p\,dV. Adding up (integrating) these tiny contributions as the gas goes from volume V1V_1 to V2V_2 gives the total work done by the gas:

W=∫V1V2p dVW = \int_{V_1}^{V_2} p\,dV

where: WW is work done by the gas (joule, J), pp is pressure (pascal, Pa), and V1V_1, V2V_2 are the initial and final volumes (m³). Geometrically, this integral is exactly the area trapped between the pp–VV curve and the volume axis, between V1V_1 and V2V_2 — so before calculating anything, sketching the process on a pp–VV diagram tells you roughly what answer to expect.

Isobaric (constant pressure). If pp does not change during the process, it can be pulled out of the integral:

W=p(V2−V1)=p ΔVW = p(V_2 - V_1) = p\,\Delta V

where: ΔV=V2−V1\Delta V = V_2 - V_1 is the change in volume. On the diagram this is just the area of a rectangle of height pp and width ΔV\Delta V.

Isothermal (constant temperature, ideal gas). Using the ideal gas law pV=nRTpV = nRT at fixed TT, so p=nRT/Vp = nRT/V, the integral becomes a standard logarithmic result:

W=nRTln⁡ ⁣(V2V1)W = nRT\ln\!\left(\frac{V_2}{V_1}\right)

where: nn is the number of moles, R=8.314 J mol−1K−1R = 8.314\ \text{J mol}^{-1}\text{K}^{-1} is the universal gas constant, and TT is the (constant) absolute temperature in kelvin. This curve on a pp–VV diagram is a hyperbola (p∝1/Vp \propto 1/V), so the "rectangle" shortcut does not apply here — only the log formula does.

Isochoric (constant volume). If dV=0dV = 0 throughout, the gas does zero work, no matter how much its pressure or temperature changes: W=0W = 0. There is simply no area under the curve because the curve is a vertical line.

Sign convention and the first law. Work done by the gas is positive when it expands (V2>V1V_2 > V_1) and negative when it is compressed (V2<V1V_2 < V_1) — work is then done on the gas. This WW is exactly the work term in the first law of thermodynamics, Q=ΔU+WQ = \Delta U + W, so a sign slip here silently flips the sign of the heat or internal-energy change you calculate next.

Figure
A pressure volume diagram showing a rectangle area for constant pressure expansion next to a curved hyperbola area for isothermal expansion between the same two volumes
Work done equals the area under the p-V path constant pressure (isobaric) p V V1 V2 W = p delta V constant temperature (isothermal) p V V1 V2 W = nRT ln(V2/V1)
Derivation ADeriving isothermal work for an ideal gas

Start from the general definition W=∫V1V2p dVW = \int_{V_1}^{V_2} p\,dV and combine it with the ideal gas law to obtain the closed-form logarithmic expression W=nRTln⁡(V2/V1)W = nRT\ln(V_2/V_1) that lets you compute the work done in an isothermal expansion or compression directly from moles, temperature, and the volume ratio, without ever integrating a pressure that is changing point by point.

Step 1. For nn moles of an ideal gas, the equation of state is pV=nRTpV = nRT. At constant temperature TT, this can be rearranged to express pressure purely as a function of volume: p=nRTVp = \dfrac{nRT}{V}, with nn, RR, and TT all fixed numbers during the process.

Step 2. Substitute this expression for pp into the work integral: W=∫V1V2nRTV dVW = \int_{V_1}^{V_2} \dfrac{nRT}{V}\,dV. Since nRTnRT is constant, it can be pulled outside the integral sign, leaving W=nRT∫V1V2dVVW = nRT \int_{V_1}^{V_2} \dfrac{dV}{V}.

Step 3. The remaining integral is a standard one: ∫dVV=ln⁡V\int \dfrac{dV}{V} = \ln V. Evaluating between the limits V1V_1 and V2V_2 gives ln⁡V2−ln⁡V1\ln V_2 - \ln V_1, which by the laws of logarithms combines into a single term.

Step 4. Using ln⁡V2−ln⁡V1=ln⁡(V2/V1)\ln V_2 - \ln V_1 = \ln(V_2/V_1), the work done by the gas during an isothermal process becomes W=nRTln⁡ ⁣(V2V1)W = nRT\ln\!\left(\dfrac{V_2}{V_1}\right). If V2>V1V_2 > V_1 (expansion), the logarithm is positive and W>0W > 0; if V2<V1V_2 < V_1 (compression), the logarithm is negative and W<0W < 0, consistent with the sign convention.

Worked example

Two moles of an ideal gas at 300 K300\ \text{K} expand isothermally and reversibly from a volume of 5.0 L5.0\ \text{L} to 15.0 L15.0\ \text{L}. Take R=8.314 J mol−1K−1R = 8.314\ \text{J mol}^{-1}\text{K}^{-1}. Find the work done by the gas, and then find how much work the gas would do if it were instead compressed back from 15.0 L15.0\ \text{L} to 5.0 L5.0\ \text{L} at the same temperature.

Step 1. Identify the process as isothermal, so W=nRTln⁡(V2/V1)W = nRT\ln(V_2/V_1) applies directly, with n=2n = 2, T=300 KT = 300\ \text{K}, V1=5.0 LV_1 = 5.0\ \text{L}, V2=15.0 LV_2 = 15.0\ \text{L}. Litres cancel in the ratio V2/V1V_2/V_1, so no unit conversion is needed for the logarithm.

Step 2. Compute the volume ratio and its logarithm: V2/V1=15.0/5.0=3V_2/V_1 = 15.0/5.0 = 3, and ln⁡(3)≈1.0986\ln(3) \approx 1.0986.

Step 3. Substitute into the formula: W=(2)(8.314)(300)ln⁡(3)=4988.4×1.0986≈5479 JW = (2)(8.314)(300)\ln(3) = 4988.4 \times 1.0986 \approx 5479\ \text{J}.

Step 4. So the gas does approximately 5479 J (about 5.48 kJ) of work on its surroundings during this expansion. Because the process is isothermal for an ideal gas, ΔU=0\Delta U = 0, so by the first law all of this work is supplied as heat absorbed from the surroundings, Q=W≈5479 JQ = W \approx 5479\ \text{J}.

Competitive stretch

For the reverse compression from 15.0 L15.0\ \text{L} back to 5.0 L5.0\ \text{L} at the same 300 K300\ \text{K}, the volume ratio inverts to V2/V1=5.0/15.0=1/3V_2/V_1 = 5.0/15.0 = 1/3, and ln⁡(1/3)=−ln⁡(3)≈−1.0986\ln(1/3) = -\ln(3) \approx -1.0986. So W=4988.4×(−1.0986)≈−5479 JW = 4988.4 \times (-1.0986) \approx -5479\ \text{J}: the gas now does negative work, meaning the surroundings do about 5479 J of work on the gas, and (again since ΔU=0\Delta U = 0) the gas releases this same amount as heat to the surroundings. The magnitude matches the expansion exactly, confirming that isothermal work over the same volume ratio is symmetric in size but opposite in sign when the process is reversed.

Common traps

  • Using W=pΔVW = p\Delta V when pressure is not constant — this shortcut only applies to isobaric processes; an isothermal (or any other varying-pressure) process needs the correct integral or the logarithmic formula instead.
  • Forgetting that work depends on the path taken on a pp–VV diagram between two states, not just on the initial and final states — unlike internal energy, work is not a state property, so different paths between the same two points give different WW.
  • Sign errors: work done by the gas is positive during expansion and negative during compression; getting this backwards flips the sign of ΔU\Delta U or QQ obtained from the first law, Q=ΔU+WQ = \Delta U + W.
  • Mixing up litres and cubic metres, or forgetting that 1 L=10−3 m31\ \text{L} = 10^{-3}\ \text{m}^3, when a problem gives volumes in litres but expects an answer in joules using SI-unit pressure.

Ask the tutor: Want to try a multi-step cyclic process where you have to add up work over several isobaric and isothermal legs on one p-V diagram? Ask the AI tutor for a guided walkthrough.

Why is work not a state property like internal energy?

Internal energy depends only on the current state of the gas (its temperature, for an ideal gas), so ΔU\Delta U is fixed once you know the start and end states. Work, however, equals the area under the specific path traced on the pp–VV diagram, and different paths between the same two states enclose different areas. That is exactly why the first law needs both QQ and WW as path-dependent terms to balance the path-independent ΔU\Delta U.

Why does an isothermal process need integration while an isobaric one does not?

In an isobaric process, pressure is a constant, so it can be pulled straight out of the integral ∫p dV\int p\,dV, leaving just pΔVp\Delta V — no calculus needed beyond multiplication. In an isothermal process, pressure keeps changing as volume changes (following p=nRT/Vp = nRT/V), so you must actually integrate 1/V1/V over the range, which produces the natural logarithm term ln⁡(V2/V1)\ln(V_2/V_1).

If a gas is compressed, does that mean negative work always means heat is absorbed?

Not necessarily — it depends on the process. During isothermal compression, ΔU=0\Delta U = 0, so the first law Q=ΔU+WQ = \Delta U + W with negative WW gives negative QQ, meaning heat is released, not absorbed. Whether heat is absorbed or released during compression depends on how ΔU\Delta U and WW combine for that specific process; only for isothermal ideal-gas processes can you assume ΔU=0\Delta U = 0 automatically.

Before this

Where this leads