First and second laws of thermodynamics
Anchor (Master): Callen, *Thermodynamics and an Introduction to Thermostatistics*, 2e (1985), Ch. 1–4; Landau & Lifshitz, *Statistical Physics*, Part 1, §1–4
Intuition [Beginner]
Energy is conserved. That is the first law of thermodynamics. Energy can move between forms — kinetic, potential, thermal, chemical — but the total never changes. In a thermodynamic system the bookkeeping is: the internal energy of a system changes by the heat added minus the work done. In symbols, .
Heat is energy transferred because of a temperature difference. Work is energy transferred by any other means — pushing a piston, turning a shaft, running a current through a resistor. Both are transfers across the boundary. The first law says the change in what is inside equals what came in as heat minus what went out as work.
The second law adds a direction. In an isolated system — no heat in, no work out — the total energy is constant, but something else always increases: entropy, denoted . Entropy measures how many microscopic arrangements are consistent with the macroscopic state you observe. A neat stack of cards has low entropy (few arrangements look "stacked"). The same cards scattered across the floor have high entropy (enormously many arrangements look "scattered").
The practical consequence: heat flows from hot to cold, never the other way on its own. A cup of coffee cools down in a room; the room never spontaneously donates thermal energy to heat the coffee back up. That asymmetry — the arrow of time — is what the second law gives you that Newton's laws do not. Newton's equations run equally well forwards and backwards. Thermodynamics does not.
Visual [Beginner]
Picture a gas sealed in a cylinder with a movable piston. The gas molecules bounce around inside, colliding with each other and the walls. Each collision transfers a tiny impulse; the aggregate of all those impulses on the piston face is the pressure . The piston's position fixes the volume .
Add heat to the gas (hold a flame to the cylinder). The molecules speed up — average kinetic energy rises, so temperature rises. Some of that extra energy pushes the piston outward, doing work on whatever is outside. The first law tracks the split: . Some energy stays inside (higher ), some leaves as work.
Now remove the flame and insulate the cylinder. No more heat can enter or leave. The second law says entropy cannot decrease in this isolated setup. The gas will never spontaneously compress itself, push the piston back in, and cool down — that would lower entropy without external intervention.
The picture encodes both laws: the first law governs the energy balance at the boundary, the second law governs which directions of change are allowed inside.
Worked example [Beginner]
A gas in a cylinder absorbs of heat from a flame and does of work pushing the piston outward.
Step 1. Apply the first law:
The internal energy of the gas increased by 300 J. The remaining 200 J left as work.
Step 2. Now insulate the cylinder (no heat exchange: ) and let the gas expand until it has done exactly 300 J of work. The first law gives:
The gas loses 300 J of internal energy and cools down. The initial 300 J of stored energy was completely converted to work.
Step 3. Could the gas instead have spontaneously absorbed 300 J from its cooler surroundings and heated back up, without any external input? The second law says no. Heat does not flow from cold to hot on its own. The coffee does not reheat itself by stealing thermal energy from the room.
Check your understanding [Beginner]
Formal definition [Intermediate+]
A thermodynamic system is specified by a set of state variables — quantities that depend only on the current equilibrium state, not on how the system arrived there. For a simple compressible system the fundamental state variables are: internal energy , entropy , volume , temperature , and pressure .
A state function is any quantity determined entirely by the state. , , , , are state functions. Heat and work are not state functions — they depend on the path taken between states.
First law (differential form). For an infinitesimal change,
The notation is an exact differential (the change in a state function), while and are inexact differentials (path-dependent). For a reversible process acting on a simple compressible system, and , giving the fundamental thermodynamic relation:
This equation is the backbone of thermodynamic manipulation. It is valid for any quasi-static (reversible) change of a simple system. The sign convention reflects: positive (expansion) means the system does work on the surroundings, reducing .
Second law. There are two classical statements.
Clausius statement: No process is possible whose sole result is the transfer of heat from a colder body to a hotter body.
Kelvin-Planck statement: No process is possible whose sole result is the absorption of heat from a reservoir and the conversion of all of that heat into work.
Both statements are equivalent (each implies the other via a contradiction argument). The second law can be reformulated as the entropy principle: for any spontaneous process in an isolated system,
with equality if and only if the process is reversible. The function is a state function (this requires proof and is the content of Clausius's theorem).
Entropy as a state function. Clausius's theorem establishes that for any cyclic process, , with equality for reversible cycles. This inequality guarantees the existence of a state function whose change between two equilibrium states and satisfies
with equality for reversible paths. The integral on the right is path-dependent; the entropy difference on the left is not.
Statistical interpretation (Boltzmann). The entropy of a macrostate with compatible microstates is
where is Boltzmann's constant. This bridges the macroscopic second law to a microscopic counting argument: macrostates with more microstates are more probable, and isolated systems evolve toward more probable macrostates.
Counterexamples to common slips
- The first law does not say that heat and work are forms of energy; it says they are ways energy is transferred. Internal energy is the energy; and are boundary transfers.
- The second law does not say "entropy always increases everywhere." It says entropy of an isolated system increases. A refrigerator decreases the entropy of its interior, but the entropy increase of the hot kitchen more than compensates.
- The equation holds only for reversible processes. For irreversible processes the inequality may hold, but , , remain well-defined state functions for equilibrium states connected by any path.
- The Kelvin-Planck statement forbids converting heat entirely into work in a cyclic process. A single expansion stroke can convert heat entirely into work — but then the system is in a different state and cannot repeat without an external reset.
Key theorem with proof [Intermediate+]
Theorem (Carnot's theorem). No heat engine operating between two reservoirs at temperatures (hot) and (cold) is more efficient than a Carnot engine operating between the same reservoirs. All reversible engines operating between and have the same efficiency, the Carnot efficiency
Proof. Suppose an engine has efficiency . Run a Carnot engine backwards between the same reservoirs as a refrigerator, using the work output of to drive it. By hypothesis, produces more work per unit of heat absorbed from than the Carnot refrigerator requires per unit of heat dumped to . The net effect of the combined machine: heat is transferred from to with no external work input (some work from drives the Carnot refrigerator, and there is work left over). This violates the Clausius statement of the second law. Contradiction.
Hence for any engine .
For the converse, any reversible engine operating between and can be used in place of the Carnot engine in the argument above. If a reversible engine had , run the Carnot engine backwards driven by ; the same contradiction follows. So all reversible engines have the same efficiency, equal to the Carnot efficiency.
The explicit value follows from computing the entropy balance for the four-step Carnot cycle (isothermal expansion at , adiabatic expansion, isothermal compression at , adiabatic compression back to the initial state): the total entropy change over the cycle is zero (reversible), giving , hence .
Corollary. The existence of a universal temperature scale on which the Carnot efficiency is is equivalent to the existence of the thermodynamic temperature scale. This is the basis of the Kelvin scale: is defined so that the efficiency of a Carnot engine depends only on the ratio , independent of the working substance.
Exercises [Intermediate+]
Caratheodory's axiomatic formulation [Master]
The classical statements of the second law (Clausius, Kelvin-Planck) are negative — they describe what cannot happen. Caratheodory (1909) gave a positive axiomatisation that makes the mathematical structure more transparent.
Caratheodory's principle. In every neighbourhood of any equilibrium state, there exist states that cannot be reached by an adiabatic process.
This innocuous-sounding geometric restriction on the set of reachable states turns out to be equivalent to the classical second law. The key mathematical content is the following.
Consider the differential form (the first law written for a simple system, with being the inexact heat 1-form). Caratheodory's principle, combined with a theorem on Pfaffian forms, implies:
Theorem (Caratheodory). If is a Pfaffian form on a manifold of equilibrium states and every neighbourhood of every point contains adiabatically inaccessible points, then admits an integrating factor: there exist functions and such that , with an exact differential.
The integrating factor is the thermodynamic temperature, and is entropy. The second law reduces to the existence of this integrating factor. The monotonicity of entropy (entropy increases for spontaneous processes) follows from the sign convention that .
This formulation has two virtues. First, it makes the second law a statement about differential geometry — the Frobenius integrability condition on the heat 1-form — rather than a prohibition on engine designs. Second, it generalises: Caratheodory's framework extends to systems with additional work terms (magnetic, chemical, surface) without changing the core argument.
The equivalence with the Clausius and Kelvin-Planck statements is shown in detail in Callen Ch. 4 and in Landsberg, Thermodynamics and Statistical Mechanics (1978), Ch. 6.
Thermodynamic potentials and Maxwell relations [Master]
The fundamental relation uses and as independent variables. Different experimental situations call for different independent variables. The Legendre transforms of produce the standard thermodynamic potentials.
Enthalpy :
Natural variables: . Useful for constant-pressure processes.
Helmholtz free energy :
Natural variables: . Minimised at equilibrium for a system at constant and .
Gibbs free energy :
Natural variables: . Minimised at equilibrium for a system at constant and (the most common experimental condition).
Each potential's exact differential yields a Maxwell relation by equality of mixed partial derivatives:
| Potential | Maxwell relation |
|---|---|
These four relations allow the substitution of measurable quantities (equations of state, heat capacities) for hard-to-measure quantities (entropy derivatives). They are the workhorses of thermodynamic computation.
Stability conditions. Equilibrium requires the relevant thermodynamic potential to be a minimum, which imposes convexity/concavity conditions. For at fixed : is convex in , giving , i.e., . This is the mechanical stability condition: the isothermal compressibility must be positive. Similarly, (thermal stability). Violation of stability signals a phase transition.
Third law and information-theoretic entropy [Master]
Third law (Nernst heat theorem). As , the entropy change in any isothermal process approaches zero. Equivalently, the entropy of a system in internal equilibrium approaches a constant (conventionally zero) as .
The third law has two consequences: (a) heat capacities vanish as (otherwise integrating would give a logarithmic divergence), and (b) it is impossible to reach in a finite number of steps. The statistical interpretation: at , the system occupies its unique ground state, , and .
Connection to information theory. Shannon (1948) defined the entropy of a discrete probability distribution as
For the uniform distribution over microstates, and . The thermodynamic entropy is then . This is not an analogy — it is an identification. Thermodynamic entropy is the Shannon entropy of the microstate distribution, scaled by . The second law is then a statement about the tendency of probability distributions to spread under weak coupling.
The deep consequence: thermodynamics is a special case of statistical inference. The maximum-entropy principle (Jaynes, 1957) recovers all of equilibrium thermodynamics by maximising Shannon entropy subject to constraints (mean energy, mean particle number, etc.). The Lagrange multipliers enforcing the constraints are identified as and (chemical potential over temperature). This perspective is developed further in 11.02.01 pending (Maxwell-Boltzmann) and 11.04.01 pending (canonical ensemble).
Lean formalization [Intermediate+]
Mathlib does not yet cover thermodynamics. The closest layers are:
Mathlib.MeasureTheory: measure spaces, integration, and the monotone convergence machinery that underpins the mathematical treatment of entropy.Mathlib.Analysis.Convex: convex functions and Legendre transforms, which appear in the thermodynamic potentials.Mathlib.Topology.ContinuousFunction: continuous state functions on manifolds of equilibrium states.
There is no Mathlib definition of "internal energy," "entropy," "temperature," or "heat engine." There is no formalisation of the Carnot cycle, the second law as an inequality on entropy, or Caratheodory's integrability theorem. The formalisation pathway is laid out in lean_mathlib_gap in the frontmatter.
lean_status: none reflects this gap; no lean_module ships with this unit. Tyler's review attests intermediate-tier correctness.
Connections [Master]
Conservation laws
09.01.03provide the first law in its most general form: energy conservation as a consequence of time-translation symmetry via Noether's theorem09.03.01pending. The first law of thermodynamics is the application of energy conservation to macroscopic systems with the energy budget split into heat and work.Noether's theorem
09.03.01pending connects continuous symmetries to conserved quantities. Energy conservation from time-translation invariance is the classical-mechanics precursor to the first law. The second law, however, has no Noether-type derivation — it is an independent physical principle.Multivariable chain rule
02.05.03is the computational tool behind every Maxwell relation and every partial-derivative manipulation in thermodynamics. The chain rule on the Legendre-transformed potentials generates the four Maxwell relations mechanically.Legendre transform
05.00.03is the mathematical operation producing each thermodynamic potential from by swapping an independent variable. The Legendre transform of with respect to gives ; with respect to gives ; with respect to both gives .Thermodynamic potentials
11.01.02pending (next unit) takes the potentials introduced here and develops their extremisation principles, stability analysis, and applications to phase transitions.Maxwell-Boltzmann distribution
11.02.01pending derives the velocity distribution of an ideal gas from the entropy-maximisation principle, using as its starting point.Canonical ensemble
11.04.01pending replaces the microstate counting by a Boltzmann-weighted sum over states, generalising to the Gibbs entropy .Chemical thermodynamics
14.06.01applies the first and second laws to molecular-scale reactions: free energies, equilibrium constants, and the thermodynamic driving force of chemical change all descend from the definitions of , , , and the potentials.Oxidative phosphorylation
17.04.02pending is a biological application: the proton-motive force across the inner mitochondrial membrane converts the free energy of the electrochemical gradient into ATP. The efficiency ceiling is set by the Carnot-like constraint that the free-energy drop per proton must exceed the free energy of ATP synthesis — a direct consequence of the second law.
Historical & philosophical context [Master]
Carnot (1824) laid the foundation in Reflexions sur la puissance motrice du feu without invoking energy conservation (which was not yet established). Carnot analysed heat engines using the caloric theory — heat as a fluid — and derived the efficiency ceiling that bears his name. His key insight was that the efficiency depends only on the temperature difference, not on the working substance.
Clausius (1850) reformulated Carnot's work in terms of the first law (energy conservation, newly established by Joule, Mayer, and Helmholtz) and introduced entropy as a state function in 1865. The name — from the Greek trope (transformation) — encoded the idea that entropy measures the "unavailable" energy, the portion that cannot be converted to work.
Kelvin (1851) independently arrived at the second law and established the absolute temperature scale. The Kelvin scale is defined by the Carnot efficiency: is the temperature on which holds, independent of any material property.
Boltzmann (1877) gave the statistical interpretation , connecting macroscopic entropy to microscopic combinatorics. This was controversial: Loschmidt's reversibility objection (1876) asked how time-reversible mechanics can produce irreversible entropy increase, and Zermelo's recurrence objection (1896) noted that Poincaré recurrence contradicts monotonic entropy increase. Boltzmann's response — that recurrence times are astronomically large and that entropy increase is statistical, not absolute — anticipated the modern resolution.
Caratheodory (1909) gave the axiomatic formulation: the second law as an integrability condition on the heat 1-form. This removed the need for engines, cycles, and anthropomorphic notions of "what cannot happen," replacing them with differential geometry. Ehrenfest and Lieb & Yngvason (1999) further refined the axiomatic approach.
Shannon (1948) and Jaynes (1957) completed the information-theoretic unification. Shannon entropy is the same function as thermodynamic entropy up to the factor . Jaynes showed that maximising Shannon entropy subject to constraints recovers all equilibrium thermodynamics, making the second law a theorem of statistical inference rather than a physical axiom.
The philosophical tension between the time-reversal symmetry of fundamental mechanics and the irreversibility of thermodynamics remains a central topic in the philosophy of physics. The dominant view (Boltzmann's statistical interpretation, refined by the Boltzmann equation and the BBGKY hierarchy) holds that irreversibility emerges from the special choice of low-entropy initial conditions — the "past hypothesis" (Albert, 2000) — rather than from any fundamental asymmetry in the laws.
Bibliography [Master]
Primary literature (cite when used; not all currently in reference/):
- Carnot, S., Reflexions sur la puissance motrice du feu et sur les machines propres a developper cette puissance (Bachelier, 1824). [Need to source — originator paper.]
- Clausius, R., "Ueber die bewegende Kraft der Warme", Annalen der Physik 155:3 (1850), 368–397; "Ueber verschiedene fur die Anwendung bequeme Formen der Hauptgleichungen der mechanischen Warmetheorie", Annalen der Physik 201:7 (1865), 353–400. [Need to source — first and second law papers.]
- Thomson, W. (Lord Kelvin), "On the Dynamical Theory of Heat", Trans. Roy. Soc. Edinburgh 20:2 (1851), 261–288.
- Boltzmann, L., "Uber die Beziehung zwischen dem zweiten Hauptsatze der mechanischen Warmetheorie und der Wahrscheinlichkeitsrechnung", Wiener Berichte 76 (1877), 373–435.
- Caratheodory, C., "Untersuchungen uber die Grundlagen der Thermodynamik", Math. Ann. 67 (1909), 355–386.
- Shannon, C. E., "A Mathematical Theory of Communication", Bell System Technical Journal 27 (1948), 379–423, 623–656.
- Jaynes, E. T., "Information Theory and Statistical Mechanics", Physical Review 106:4 (1957), 620–630.
- Callen, H. B., Thermodynamics and an Introduction to Thermostatistics, 2nd ed. (Wiley, 1985).
- Landau, L. D. & Lifshitz, E. M., Statistical Physics, Part 1, 3rd ed. (Course of Theoretical Physics Vol. 5, Pergamon, 1980).
- Schroeder, D. V., Thermal Physics (Addison-Wesley, 2000).
- Susskind, L. & Caballero, A., The Theoretical Minimum: Statistical Mechanics (Basic Books, 2013).
- Tong, D., Statistical Physics (DAMTP Cambridge lecture notes, §1 "Thermodynamics").
- Lieb, E. H. & Yngvason, J., "The Physics and Mathematics of the Second Law of Thermodynamics", Physics Reports 310:1 (1999), 1–96.
Wave 2 physics unit, produced 2026-05-18 (per docs/plans/PHYSICS_PLAN.md §5). Both cross-domain hooks_out targets are proposed; no chem/bio seed unit yet exists to receive confirmed promotion. Status remains draft pending Tyler's review and the §11 Next-Actions retro per PHYSICS_PLAN.