Two ways of changing a system, pushing on it and warming it, look nothing alike, and the whole of the First Law rests on the discovery that they are interchangeable currencies of the same quantity.
Work, from mechanics to thermodynamics
Mechanics defines work as force acting through a displacement: if a force moves its point of application a distance along its own line, the work done is . Nothing in that definition mentions temperature, gases or equilibrium, and it carries into thermodynamics unchanged. What changes is only that the force is now exerted by, or against, the boundary of a system.
Take the standard case: a gas in a cylinder closed by a frictionless piston of area . The gas presses on the piston face with force , where is the pressure at the boundary, and if the piston moves outward by the gas has done of work on its surroundings. The volume swept out is , which is the increase in the gas volume. Substituting, the work done by the gas is , and the work done on the gas is the negative of it:
The sign needs a decision, and this lesson makes it once and keeps it. Work done on the system is positive. Compress a gas and is negative, so is positive: you have put energy in, and the sign says so. Heat added to the system is positive on the same convention, and the First Law reads . The alternative treats work done by the system as positive, giving , and much of the engineering literature uses it, because engineers are usually selling the work a machine produces rather than paying for the work done on it. Neither is more correct. What is fatal is switching between them halfway through a problem.
Two conditions hide in the derivation. First, must be the pressure at the moving boundary, and only in a quasi-static process, slow enough that the gas stays uniform, is that the pressure of the gas as a whole. Burst a diaphragm and let a gas rush into a vacuum and it does no work at all, because there is nothing at the boundary to push against. Second, can only be integrated once the path is known: the work is the area under the curve traced on a pressure-volume diagram, and two curves between the same endpoints enclose different areas.

Example. A gas is compressed at a constant pressure of 150 kPa from 3.0 L to 1.2 L. How much work is done on the gas?
At constant pressure the integral is just . Here m³, so J. The volume shrank, the surroundings pushed the piston in, and the positive sign says energy went into the gas, exactly as the convention promises.
Now you. A gas expands at a constant pressure of 250 kPa from 2.0 L to 5.0 L. How much work is done on the gas?
Answer
m³, so J. The gas expanded, so the work done on it is negative: it delivered 750 J to the surroundings.
Work that is not
It is easy to leave a first course believing that thermodynamic work means a piston. The piston is one instance of a general pattern: work is always an intensive quantity, a generalised force, multiplied by the change in an extensive quantity, a generalised displacement.
Stir a liquid with a paddle wheel and the shaft does work on it through the torque it exerts, . Notice what this pair cannot do: a paddle can put energy into a fluid, but no arrangement of paddles will pull it back out of a still fluid and lift the weight again. Pass a current through a resistor immersed in the system and the electrical work in time is . Stretch a wire by against tension and the work is , positive now rather than negative, because tension and extension point the same way while pressure resists expansion. Increase the area of a liquid film by against surface tension and the work is . So is not the First Law but a special case of it, valid when the only work is boundary displacement, and forgetting the other terms is how a perfectly good energy balance ends up not balancing.
Caloric, and why it had to die
For most of the eighteenth century heat was understood as a substance. Caloric was an invisible, weightless, self-repelling fluid that flowed from hot bodies to cold ones, and the theory was not foolish: it explained why heat runs downhill in temperature, since caloric particles repel and spread out, and it explained thermal expansion, since adding fluid to a body should swell it. Joseph Black's distinction between temperature and quantity of heat, and his discovery of latent heat in the 1760s, were made in caloric language and are still correct. Lavoisier listed caloric among the chemical elements in 1789, and Sadi Carnot's 1824 analysis of heat engines assumed that caloric passes through an engine undiminished.
The fatal property of caloric is that, being a substance, it must be conserved. You can move it, concentrate it or release it from where it lies latent, but you cannot make it. That is what Benjamin Thompson, Count Rumford, attacked at the Munich arsenal in 1798. Supervising the boring of brass cannon, he noticed that the process produced heat without apparent end: as long as the horses turned the borer, heat kept coming. He immersed a cannon blank and its borer in water and, by friction alone, brought it to a boil in about two and a half hours, with no fire anywhere near it.
The measurements he made to close the loopholes matter more than the boiling water. If the metal were releasing stored caloric its capacity to hold heat should have changed, so he compared the specific heat of the borings with that of the parent metal and found no difference. If caloric were a substance it should weigh something, so he weighed bodies hot and cold and found no change. Above all the supply was inexhaustible, and, as he wrote, anything which an insulated body can continue to furnish without limitation cannot possibly be a material substance. His own conclusion, that heat is a form of motion, was not accepted quickly: he could show caloric was wrong without saying what the exchange rate was between the work the horses did and the heat that appeared.
Joule and the mechanical equivalent of heat
James Prescott Joule, a Manchester brewer's son with good instruments and an obsessive standard of care, spent 1843 to 1850 measuring that exchange rate by as many independent methods as he could contrive: forcing water through narrow tubes, compressing air, running current through a resistance (which gave him the law ). Each gave a similar figure, and their agreement was the argument.
The famous apparatus is the paddle wheel. Two weights on cords fall a measured height, turning a spindle carrying vanes that stir water inside an insulated copper vessel fitted with fixed baffles, so the water is churned rather than spun. The energy input is known exactly: for the falling weights, corrected for the small kinetic energy they retain at the bottom and for friction in the pulleys. The output is a temperature rise, and the difficulty is that the rise is tiny. Joule was resolving a few hundredths of a degree Fahrenheit with mercury thermometers he had calibrated himself, at a time when that precision was close to unheard of.
His 1850 paper gives the mechanical equivalent of heat as 772.692 foot-pounds of work per British thermal unit, about 4.159 joules per calorie against a modern 4.1855 for the 15 degree calorie, low by roughly six parts in a thousand. The significance is not the digits but the claim behind them: a fixed amount of work always produces the same amount of heat, whatever mechanism converts it. Heat is not a substance. It is energy in transit, and work is the same energy arriving by a different route.
Adiabatic work, and where internal energy comes from
Joule's result can be turned into a definition, and this is the honest route into the First Law, because it introduces heat as a derived quantity rather than assuming everyone already knows what heat is.
Start with an adiabatic process, one in which the system is thermally insulated so that its only interaction with the surroundings is work. That can be said without mentioning heat: an adiabatic boundary is one across which the state of the system is unaffected by anything outside except displacement of the boundary itself. Now take two equilibrium states, 1 and 2, and connect them adiabatically in every way you can devise: stir a fluid, compress it, run a current through a resistor inside it, do all three in various orders. The experimental finding, Joule's finding generalised, is that the work required is the same for every adiabatic path. Churn a kilogram of water from 20 to 21 degrees, or compress it, or heat it electrically; the same 4.18 kilojoules are needed each time.
A quantity whose change is the same along every path is the difference of a function of state. So define the internal energy by
the adiabatic work between the two states. This fixes up to an additive constant, exactly as gravitational potential energy is fixed only up to a choice of zero. Note what has been achieved: is a property of the state, while work is a property of a process.
Now remove the insulation and take the system between the same two states by some other route. The state change is the same, so is the same, but the measured work is generally different. Energy has crossed the boundary by a route that is not work, and that quantity is what we define heat to be:
Heat is not assumed, not defined by feeling warm, and not a fluid. It is the residual: the amount by which the actual work falls short of the adiabatic work between the same two states. Calorimetry and the rest follow from that definition plus a way of measuring work.
The First Law and inexact differentials
Rearranged, the definition becomes the statement usually called the First Law of Thermodynamics:
The energy of a closed system changes by exactly the heat added to it plus the work done on it, and by nothing else: no third channel, no leak. The law is a definition of plus one empirical claim, the path independence of adiabatic work, and that claim is what makes exist as a state function. It cannot be proved from mechanics. It is a summary of what experiment has never contradicted in nearly two centuries of looking.
Example. A gas absorbs 850 J of heat while a piston compresses it, doing 300 J of work on it. What is ?
On this lesson's convention both entries are positive as given: heat in is positive, work done on the system is positive. So J. The internal energy rises by 1150 J, and it does not matter in what order or by what mechanism the two contributions arrived.
Now you. A gas loses 420 J of heat to its surroundings while 640 J of work is done on it. What is ?
Answer
Heat leaves, so J; work is done on the system, so J. Then J. The internal energy rises even though the gas is losing heat, because the work put in more than covers the loss.
The differential form exposes the asymmetry. Write it as , with a on the left and a on the right. The marks an exact differential: is the differential of a function that exists, , so integrating it between two states gives regardless of route. The marks an inexact one. No function of the state has as its differential: it makes no sense to ask how much heat a system contains, only how much crossed its boundary during a process. Writing is therefore a category error.
The cyclic integral makes the distinction concrete. Take a system round a closed loop back to its starting state. Since depends on the state alone,
always, for every cycle, in every substance. But need not vanish, and in a working engine it had better not: an engine runs precisely because it absorbs more heat over a cycle than it rejects. What the First Law demands is that the two inexact integrals cancel, . Over one cycle the net heat absorbed equals the net work delivered, which is the entire budget of every engine ever built.
Perpetual motion of the first kind
A perpetual motion machine of the first kind is a device that runs in a cycle and delivers net work while absorbing no net heat: energy from nothing, forever. The First Law kills it in one line. Round a cycle , so , and if no net heat is absorbed then no net work can be delivered. A machine returned to its initial state has no store left to draw on, because is back where it started. The argument runs both ways: accept that no cyclic device can create energy and you can reconstruct the existence of .
Be clear about what the law does not forbid, because it forbids less than beginners expect. It has no objection to a machine that takes heat from the ocean and turns all of it into work, with the books balancing perfectly. Such a device, a perpetual motion machine of the second kind, would power a ship from seawater and violate no conservation principle. That it is nonetheless impossible needs a second, independent law, which is where this course goes shortly.
Two paths, one state change
Here is the whole lesson in numbers. Take one mole of an ideal monatomic gas at K and kPa, so m³, or 12.47 litres. Bring it to state 2 with m³ at K, so kPa. Since the temperature of an ideal gas fixes its internal energy, for this state change whatever route is taken.
Path A, reversible isothermal expansion. Hold the gas at 300 K and let it expand slowly against a pressure matched to its own at every instant, with . Then . With J and , the work is J. Since , the First Law gives J: the gas absorbs 1729 J of heat and hands every joule straight out as work.
Path B, expand at constant pressure, then cool at constant volume. Hold at 200 kPa and expand from to : the work is J, and the temperature at the end of the leg is K. For a monatomic ideal gas J, so J, which the check confirms. Now cool at fixed volume from 600 K back to 300 K, dropping the pressure to 100 kPa. No volume change means no work, so and J.
Add the legs: J and J. The work differs from path A by 765 J, more than forty per cent, and so does the heat. Yet is zero on both. Neither nor is a property of the endpoints, and their sum is nothing else.
Example. 2.0 mol of an ideal gas at 350 K expands reversibly and isothermally from 10.0 L to 30.0 L. Find and .
The method is path A's. For a reversible isothermal expansion , and with J and , J. The temperature is unchanged, so for an ideal gas , and the First Law gives J: every joule of heat absorbed leaves again as work.
Now you. 0.50 mol of an ideal gas at 400 K expands reversibly and isothermally from 5.0 L to 20.0 L. Find and .
Answer
J and , so J. Since at constant temperature, J.
That is the result the rest of the subject is built on, and it leaves an obvious question. The constant-pressure leg needed 6235.5 J for a 300 K rise, while the constant-volume leg gave up only 3741.3 J over the same 300 K, a ratio of exactly . What a temperature change costs depends on what is held fixed while you make it, and the bookkeeping for constant-pressure processes is tidy enough to deserve a state function of its own. That function is enthalpy, and it is next.