The First Law of Thermodynamics

Pump up a bike tyre with a hand pump and the barrel gets hot — noticeably, sometimes almost too hot to hold. You didn't light anything; you just squeezed some air. So where did the warmth come from? You pushed, and that push went straight into the gas, speeding up its particles. You did work on the gas, and it stored that work as extra internal energy — which is exactly what "hotter" means.

Heating is not the only way to raise a gas's internal energy: doing mechanical work on it does the job just as well. The first law of thermodynamics is the bookkeeping rule that ties the two together. It is nothing more than conservation of energy, written out carefully for a gas — but writing it carefully, and getting every sign right, is the whole art of this topic.

Two ways to change a gas's internal energy

Trap some gas in a cylinder under a piston and there are exactly two ways to change the energy locked in its particles:

Every joule that goes in this way has to end up somewhere, and for a sealed lump of gas the only place it can go is the internal store. So the change in internal energy is simply the sum of the two inputs:

\Delta U = Q + W.

That is the first law of thermodynamics. Read it out loud: the increase in a system's internal energy equals the heat supplied to it plus the work done on it. Nothing is created and nothing vanishes — energy is only shuffled between the surroundings and the gas's particles.

For a closed system (a fixed quantity of gas), the change in internal energy is the heat supplied to the system plus the work done on the system: It is conservation of energy applied to a gas: internal energy can only change by heating or by working.

The sign convention — pin it down now

The single hardest thing about the first law is not the physics but the bookkeeping of signs. We will use one convention throughout, and it is worth branding onto your memory:

With this "energy in is positive" convention, both terms on the right of \Delta U = Q + W add energy to the gas when they are positive — tidy and symmetric. If instead heat leaves the gas, Q is negative; if the gas expands and does work on its surroundings, W is negative. Whenever you write a number down, first ask: is energy going into the gas or out of it? In means plus, out means minus.

Work at constant pressure: W = -p\,\Delta V

How much work does compressing a gas actually do? Take a gas held at constant pressure p in a cylinder of cross-sectional area A, and push the piston in by a small distance d.

Step 1 — the force on the piston. Pressure is force per unit area, so to hold the gas at pressure p the piston pushes with force

F = pA.

Step 2 — the work done pushing it in. Work is force times distance:

W = Fd = pA\,d.

Step 3 — turn distance into a volume change. Moving the piston in by d shrinks the gas's volume, and the amount it shrinks by is A\,d. Compression reduces the volume, so \Delta V = -A\,d, i.e. A\,d = -\Delta V. Substituting,

W = p\,(A\,d) = -p\,\Delta V.

So the work done on a gas at constant pressure is W = -p\,\Delta V. Check the signs against the convention: compress it (\Delta V < 0) and W = -p\,\Delta V > 0 — positive work done on the gas, exactly as it should be. Let it expand (\Delta V > 0) and W < 0 — the gas is doing work on the surroundings instead, draining its own internal energy.

Putting the two results together gives the working form of the first law for a gas at constant pressure:

\Delta U = Q - p\,\Delta V.

Four special processes

The power of \Delta U = Q + W is that in many important situations one of the three quantities is zero, and the law collapses to something simple. Four cases are worth knowing cold.

That last case is the bike pump. The squeeze is quick, so hardly any heat escapes through the barrel in time — the change is roughly adiabatic, Q \approx 0, and your work W lands almost entirely in the gas's internal energy: \Delta U = W > 0. Hotter gas, warm barrel.

Worked examples

Example 1 — heat in, work in. A gas is supplied 500\text{ J} of heat while a piston compresses it, doing 200\text{ J} of work on the gas. Find the change in internal energy.

Both inputs add energy, so both are positive: Q = +500\text{ J}, W = +200\text{ J}.

\Delta U = Q + W = 500 + 200 = +700\text{ J}.

The internal energy rises by 700\text{ J}, so the gas gets hotter.

Example 2 — heat in, gas expands. A gas absorbs 800\text{ J} of heat and, at a constant pressure of 2.0\times10^{5}\text{ Pa}, expands by \Delta V = +2.0\times10^{-3}\text{ m}^3. Find \Delta U.

The gas expands, so it does work on the surroundings — the work done on it is negative:

W = -p\,\Delta V = -(2.0\times10^{5})(2.0\times10^{-3}) = -400\text{ J}. \Delta U = Q + W = 800 + (-400) = +400\text{ J}.

Only half the heat stayed in the gas as internal energy; the other 400\text{ J} went into pushing the piston out.

Example 3 — adiabatic compression. A gas is compressed rapidly in an insulated cylinder, the piston doing 300\text{ J} of work on it. No heat can escape. What happens to the internal energy?

Insulated and fast, so Q = 0:

\Delta U = Q + W = 0 + 300 = +300\text{ J}.

Every joule of work becomes internal energy — the gas heats up sharply, with no flame in sight. This is precisely how a diesel engine ignites its fuel.

Example 4 — isothermal expansion. A gas expands slowly at constant temperature, doing 600\text{ J} of work on the surroundings. How much heat flows, and in which direction?

Constant temperature means \Delta U = 0. The gas does 600\text{ J} of work on the surroundings, so the work done on it is W = -600\text{ J}. Then

0 = Q + W \;\Rightarrow\; Q = -W = +600\text{ J}.

600\text{ J} of heat flows into the gas — exactly enough to replace the energy it spent doing work, keeping its temperature (and internal energy) unchanged.

See the first law happen

Here is a cylinder of gas. Slide Q to pour heat in (or draw it out), and slide W to do work on the gas (push the piston in) or let it expand. Watch three things: the heat arrow at the base, the work arrow on the piston, and the ΔU bar on the right. The bar is just Q + W — whenever it rises above the line the gas warms, whenever it drops below the gas cools. Set Q = 0 for an adiabatic change, or trim Q and W so they cancel for an isothermal one, and see the temperature hold steady.

Three sign-and-heat traps that catch nearly every exam candidate:

A petrol engine needs a spark to ignite its fuel. A diesel engine has no spark plug at all — so what sets the fuel alight? The answer is the first law. On the compression stroke the piston slams into the air in the cylinder so fast that essentially no heat escapes: the change is adiabatic, Q \approx 0. The piston does a large amount of work W on the air, and since \Delta U = W, all of it becomes internal energy. The air is squeezed to a small fraction of its volume and its temperature rockets to around 500\,^\circ\text{C} — hotter than the ignition point of diesel. Fuel sprayed into that superheated air bursts into flame on contact, no spark required.

It is the exact same physics as the warm bike pump, just turned up to eleven: work in, no heat out, internal energy up, temperature up. Rudolf Diesel patented the idea in the 1890s, and every diesel lorry, ship and generator on Earth still runs on that one line of thermodynamics.