Work is the area under the curve
When a gas expands by a tiny amount dV while pushing with pressure P, it does a tiny bit of work dW = P\,dV on the piston. Add up all those slivers as the volume changes and the total work done by the gas is an integral — which, read off a PV diagram, is simply the area under the path.
The work done BY a gas equals the area under its curve on a PV diagram. Expansion (volume increasing) gives positive work; compression gives negative work.
Four ways to change a gas
Four special processes appear again and again because each holds one thing fixed, making its work easy to compute. Learn these four shapes on the PV plane and you can read any engine cycle.
Isochoric (constant volume): the gas is sealed in a rigid box, dV = 0, so it does no work at all. A vertical line on the PV diagram. All the heat you add goes straight into internal energy: \Delta U = Q.
Isobaric (constant pressure): the gas expands against a fixed pressure — think of a piston loaded with a constant weight. A horizontal line on the PV diagram, and the work is just pressure times the volume change.
At constant pressure the area under the path is just a rectangle: pressure times the change in volume.
Isothermal (constant temperature): the gas is kept at a fixed T by contact with a big heat reservoir, so for an ideal gas \Delta U = 0 and every joule of heat that comes in leaves as work. The path is a curved hyperbola (P = nRT/V), and integrating gives a logarithm.
For an isothermal expansion of an ideal gas, work grows as the natural logarithm of the volume ratio; since ΔU = 0, the heat absorbed equals this work exactly.
Adiabatic (no heat exchanged): the gas is insulated or the change is so fast that no heat has time to flow, Q = 0. Then \Delta U = -W: the gas can only do work by spending its own internal energy, so it cools as it expands. This is why a spray can gets cold and why air cools as it rises. The path is steeper than an isotherm.
Along an adiabat, pressure and volume follow a steeper power law set by γ = CP/CV; because Q = 0, all work comes out of internal energy and the gas cools on expansion.
Worked example: isothermal expansion
Take 2.0 mol of an ideal gas held at 300 K and let it expand slowly to twice its original volume while staying at that temperature. How much work does it do, and how much heat must flow in?
Plug in n, R, T and a volume ratio of 2. The natural log of 2 is about 0.693, giving roughly 3460 J of work done by the gas.
Because the temperature never changed, ΔU = 0 for the ideal gas, so every joule of work had to be supplied by heat flowing in from the reservoir.
Cycles: back where you started
An engine cannot expand forever; it must return the gas to its starting state to go again. On the PV diagram that means tracing a closed loop. Over any complete cycle the gas comes home to the same P, V, T, so its internal energy is unchanged: \Delta U_{\text{cycle}} = 0. The first law then says the net heat taken in equals the net work put out.
For a closed cycle the net work done by the gas equals the net heat absorbed — and geometrically it is exactly the area enclosed by the loop on the PV diagram.