---
title: "The First Law: Internal Energy, Heat, and Work"
module: Thermodynamics
moduleNumber: 1
lessonNumber: 2
order: 102
summary: >
  The first law is energy conservation for a system that exchanges energy as
  both heat and work. Internal energy is a state function with an exact
  differential; heat and work are path-dependent process quantities. This lesson
  states $\d U=\delta Q+\delta W$, computes compression work as an area on the
  $P$–$V$ plane, defines the heat capacities $C_V$ and $C_P$ and the enthalpy
  that makes $C_P$ natural, and works the isothermal and adiabatic processes of
  an ideal gas, including the adiabat $PV^\gamma=\text{const}$.
topics: [Thermodynamics]
sources:
  - book: Schroeder
    ref: "Ch. 1 — Energy in Thermal Physics; §1.2 The Ideal Gas, §1.4 Compression Work, §1.5 Heat Capacities"
  - book: Reif
    ref: "Ch. 4 — Macroscopic Parameters and their Measurement; §4.1–4.4"
  - book: Kardar (Statistical Physics of Particles)
    ref: "Ch. 1 — Thermodynamics; §1.4"
  - book: Callen
    ref: "Ch. 1 — The Problem and the Postulates; §1.5–1.7"
draft: false
---

The first law is the statement that energy is conserved once heat is counted as
a form of energy transfer. Before the mechanical equivalent of heat was measured,
mechanical energy and thermal energy were separate ledgers; the first law merges
them. For a thermodynamic system the merged ledger has a single balance, the
internal energy, and two channels through which it changes, heat and work. The
content of the law is that these two path-dependent channels always sum to a
path-independent change.

## Internal energy as a state function

The **internal energy** $U$ of a system is the total energy of its microscopic
constituents in the frame where the system is at rest: kinetic energy of the
molecules plus the potential energy of their interactions, excluding the bulk
kinetic and potential energy of the system as a whole. For an equilibrium state,
$U$ is fixed by the state variables, so it is a state function with an exact
differential $\d U$. Around any cycle,

$$
\oint \d U = 0.
$$

This is an assertion, justified microscopically later by identifying $U$ with the
ensemble average of the Hamiltonian, and justified thermodynamically by the first
law itself: the existence of an energy function whose change equals the total
energy input is the empirical claim.

## Work

**Work** is energy transferred across the system boundary through a macroscopic
force acting over a displacement. For a fluid in a cylinder of cross-section $A$
whose piston advances a distance $\d x$ under external pressure $P_{\rm ext}$, the
work done **on** the system is $\delta W = F\,\d x = P_{\rm ext}A\,\d x = -P_{\rm ext}\,\d V$,
since advancing the piston decreases the volume, $\d V = -A\,\d x$. For a
quasi-static process the external pressure matches the system pressure up to an
infinitesimal, $P_{\rm ext}=P$, and

$$
\delta W = -P\,\d V, \qquad W = -\int_{V_a}^{V_b} P\,\d V.
$$

The sign convention taken here counts work done on the system as positive.[^sign]
Compression ($\d V<0$) then delivers positive work to the system, expansion
($\d V>0$) extracts it. The integral is the negative of the signed area under the
process curve on the $P$–$V$ plane, so it depends on the entire path, not just
the endpoints: different curves joining the same two states enclose different
areas and transfer different work.

[^sign]: The convention $\d U = \delta Q + \delta W$ with $\delta W=-P\,\d V$
(work on the system positive) follows Schroeder §1.4, Callen §1.6, and Kardar
§1.4. Engineering texts and Reif §4.1 often write $\d U = \delta Q - \delta W$
with $\delta W=+P\,\d V$ (work by the system positive); the physics is identical.

$$
% caption: Work $W=-\int P\,\d V$ is the negative signed area under the process curve; three paths from $a$ to $b$ sweep different areas and so transfer different work, even though $\Delta U$ is the same for all.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}\draw[->,black] (0,0)--(6.2,0) node[right,black]{$V$};
\draw[->,black] (0,0)--(0,4.4) node[above,black]{$P$};
\filldraw[black] (1,3.6) circle (2.2pt) node[above right]{$a$};
\filldraw[black] (5,1.0) circle (2.2pt) node[above right]{$b$};
\draw[acc,very thick] (1,3.6) .. controls (1.6,1.4) and (3.6,1.1) .. (5,1.0);
\draw[black,thick] (1,3.6)--(5,3.6)--(5,1.0);
\draw[black,thick,dashed] (1,3.6)--(1,1.0)--(5,1.0);
\node[acc] at (2.35,1.75) {curve};
\node[black] at (3.3,3.85) {high-$P$ path};
\node[black] at (2.0,0.75) {low-$P$ path};
\end{tikzpicture}
$$

Work has other forms with the same structure: magnetic work $B\,\d M$, surface
work $\gamma\,\d A$, elastic work, chemical work $\mu\,\d N$. Each is an intensive
force times the differential of its conjugate extensive displacement. The
fluid case $-P\,\d V$ is the running example, and the generalization is carried
into the thermodynamic-potential lesson.

## Heat and the first law

Energy can also cross the boundary without any macroscopic displacement, driven
instead by a temperature difference through a diathermal wall. That transfer is
**heat**, $\delta Q$. Like work, heat is a process quantity: the amount depends
on the path, and $\delta Q$ is inexact. The first law asserts that although
$\delta Q$ and $\delta W$ are each path-dependent, their sum is the exact
differential of the internal energy.

> **First law of thermodynamics.** For a closed system, the change in internal
> energy in any process equals the heat added plus the work done on the system,
> $$\d U = \delta Q + \delta W.$$
> Equivalently, over a finite process $\Delta U = Q + W$, and around any cycle
> $\oint \d U = 0$, so $\oint \delta Q = -\oint \delta W$.

The law does two things at once. It defines heat, as the difference $\d U - \delta W$
between the energy change and the identifiable work — the residual channel. And it
constrains the system, because $\d U$ is exact while neither term on the right is:
the inexactness of $\delta Q$ and $\delta W$ must cancel. For the quasi-static
fluid,

$$
\d U = \delta Q - P\,\d V.
$$

$$
% caption: $\d U$ is exact so it integrates to zero around a cycle; $\delta Q$ and $\delta W$ are inexact and each accumulates a nonzero loop integral, equal and opposite so that the energy closes.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}\draw[->,black] (0,0)--(5.6,0) node[right,black]{$V$};
\draw[->,black] (0,0)--(0,4.0) node[above,black]{$P$};
\draw[acc,very thick,->] (1.2,2.6) .. controls (1.6,3.6) and (3.4,3.6) .. (4.4,2.6);
\draw[acc,very thick,->] (4.4,2.6) .. controls (3.4,1.4) and (1.6,1.4) .. (1.2,2.6);
\node[acc] at (2.8,3.35) {closed cycle};
\node[black] at (2.8,1.9) {returns to start};
\filldraw[black] (1.2,2.6) circle (2pt);
\end{tikzpicture}
$$

## Heat capacities and enthalpy

The **heat capacity** measures the heat required to raise the temperature,
$C = \delta Q/\d T$. Because $\delta Q$ is path-dependent, the value depends on
what is held fixed. Two constraints matter.

At **constant volume**, no work is done, so $\delta Q = \d U$ and

$$
C_V = \left(\frac{\partial U}{\partial T}\right)_V.
$$

At **constant pressure**, the system does expansion work as it warms, so part of
the heat goes to work and $C_P>C_V$. Writing $\delta Q = \d U + P\,\d V$ at fixed
$P$ suggests grouping $U+PV$ into a single function.

> **Definition (Enthalpy).** The **enthalpy** is $H \equiv U + PV$. Its
> differential is $\d H = \d U + P\,\d V + V\,\d P = \delta Q + V\,\d P$, so at
> constant pressure $\delta Q = \d H$ and
> $$C_P = \left(\frac{\partial H}{\partial T}\right)_P.$$

Enthalpy is the natural energy for constant-pressure processes, which describes
most chemistry and much of everyday physics, where the atmosphere fixes $P$. It
is the first of the thermodynamic potentials, obtained from $U$ by a Legendre
transform swapping the conjugate pair $(P,V)$; the systematic construction is the
fourth lesson.

For an ideal gas the two capacities differ by a fixed amount. Since $U$ depends on
$T$ alone (shown next) and $PV=Nk_BT$,

$$
C_P - C_V = \left(\frac{\partial (U+PV)}{\partial T}\right)_P - \left(\frac{\partial U}{\partial T}\right)_V = Nk_B,
$$

the **Mayer relation** for an ideal gas. Their ratio, the **adiabatic index**
$\gamma \equiv C_P/C_V$, governs adiabatic processes below.

## Internal energy of the ideal gas

That $U$ depends on temperature alone for an ideal gas is an experimental result —
Joule's free-expansion experiment, in which a gas expanding into vacuum through an
adiabatic, rigid boundary does no work and exchanges no heat, so $\Delta U = 0$,
and its temperature is found not to change despite the volume change. Hence
$(\partial U/\partial V)_T = 0$ and

$$
U = U(T), \qquad \d U = C_V\,\d T.
$$

For a monatomic ideal gas the equipartition theorem (derived in a later module)
gives $U = \tfrac{3}{2}Nk_BT$, so $C_V = \tfrac{3}{2}Nk_B$, $C_P = \tfrac{5}{2}Nk_B$,
and $\gamma = 5/3$. A diatomic gas at room temperature adds two rotational degrees
of freedom, $C_V = \tfrac{5}{2}Nk_B$ and $\gamma = 7/5$.

## Isothermal and adiabatic processes

Two quasi-static processes of the ideal gas recur throughout the subject.

An **isothermal** process holds $T$ fixed, so $\d U = 0$ and all the heat becomes
work. Along an isotherm $P = Nk_BT/V$, and

$$
W_{\rm iso} = -\int_{V_a}^{V_b} \frac{Nk_BT}{V}\,\d V = -Nk_BT\ln\frac{V_b}{V_a},
\qquad Q_{\rm iso} = -W_{\rm iso} = Nk_BT\ln\frac{V_b}{V_a}.
$$

An isotherm is a hyperbola $PV=\text{const}$ on the $P$–$V$ plane.

An **adiabatic** process exchanges no heat, $\delta Q = 0$, so $\d U = \delta W$
and the gas does work entirely at the expense of its internal energy. With
$\d U = C_V\,\d T$ and $\delta W = -P\,\d V = -Nk_BT\,\d V/V$,

$$
C_V\,\d T = -\frac{Nk_BT}{V}\,\d V
\;\Longrightarrow\;
\frac{\d T}{T} = -\frac{Nk_B}{C_V}\frac{\d V}{V} = -(\gamma-1)\frac{\d V}{V},
$$

using $Nk_B = C_P - C_V$ and $\gamma = C_P/C_V$. Integrating gives $TV^{\gamma-1}=\text{const}$,
and substituting $T\propto PV$ yields the **adiabat**

$$
PV^{\gamma} = \text{const}.
$$

Because $\gamma>1$, the adiabat is steeper than the isotherm at every point: an
adiabatic expansion cools the gas, dropping its pressure faster than the
isothermal hyperbola would. The two curves cross transversally, and the wedge
between them is the working region of the Carnot cycle in the next lesson.

$$
% caption: Through a common point the adiabat $PV^\gamma=\text{const}$ falls more steeply than the isotherm $PV=\text{const}$, because $\gamma>1$; an adiabatic expansion cools the gas while an isothermal one holds $T$ fixed by absorbing heat.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}\draw[->,black] (0,0)--(6.2,0) node[right,black]{$V$};
\draw[->,black] (0,0)--(0,4.6) node[above,black]{$P$};
\draw[acc,very thick] plot[domain=0.9:5.6,samples=80] (\x,{3.0/\x});
\draw[black,very thick,densely dashed] plot[domain=1.15:4.2,samples=80] (\x,{3.0*(2.0/\x)^(1.6667)});
\filldraw[black] (2.0,1.5) circle (2.2pt);
\node[acc,right] at (5.0,{3.0/5.0+0.12}) {isotherm};
\node[black,right] at (3.4,{3.0*(2.0/3.4)^(1.6667)+0.25}) {adiabat};
\node[black] at (2.05,1.15) {common point};
\end{tikzpicture}
$$

The path dependence of heat and work, and the path independence of their sum, is
sharpest in a direct comparison of two routes between the same endpoints.

> **Worked example.** One mole of ideal gas goes from state $a=(P_0,V_0)$ to
> state $b=(P_0/2,\,2V_0)$, so $T$ is the same at both ends since $PV$ is
> unchanged; call it $T_0=P_0V_0/R$. Compute $Q$ and $W$ along (i) the isotherm
> $PV=P_0V_0$ and (ii) the two-leg path that first expands at constant pressure
> $P_0$ to $2V_0$, then drops pressure at constant volume to $P_0/2$.
>
> Along the isotherm $\Delta U=0$, so
> $$W_{\rm i}=-RT_0\ln\frac{2V_0}{V_0}=-P_0V_0\ln 2,\qquad Q_{\rm i}=+P_0V_0\ln 2.$$
> Along the two-leg path the isochoric leg does no work, so
> $$W_{\rm ii}=-P_0(2V_0-V_0)=-P_0V_0,$$
> and since $\Delta U=0$ again, $Q_{\rm ii}=+P_0V_0$. The work differs,
> $P_0V_0\ln 2\approx0.69\,P_0V_0$ versus $P_0V_0$, and the heat differs by the
> same amount, yet $\Delta U=Q+W=0$ on both paths. Heat and work are
> path-dependent; their sum is not.

The heat and work bookkeeping of any process reduces to the same accounting: heat
in, work in, and the stored change in internal energy that balances them.

$$
% caption: The first law as a balance sheet: heat added and work done on the system are the two inputs, and their sum is the change in the stored internal energy.
\begin{tikzpicture}[>=Latex,font=\footnotesize,scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}\draw[acc,very thick,fill=acc!10] (2.4,0) rectangle (5.2,2.4);
\node[acc] at (3.8,1.7) {system};
\node at (3.8,1.0) {$\mathbf{d}U$ stored};
\draw[->,acc,very thick] (0.2,1.85)--(2.35,1.85) node[midway,above,black]{$\delta Q$ in};
\draw[->,acc,very thick] (0.2,0.55)--(2.35,0.55) node[midway,above,black]{$\delta W$ in};
\node[black,align=left] at (6.9,1.2) {$\mathbf{d}U=$\\[1pt] $\delta Q+\delta W$};
\end{tikzpicture}
$$

## Summary

- Internal energy $U$ is a state function with exact $\d U$; heat $\delta Q$ and
  work $\delta W$ are path-dependent process quantities.
- The first law $\d U = \delta Q + \delta W$ conserves energy across both
  channels; the inexactness of the two terms cancels so their sum is exact.
  Quasi-static fluid work is $\delta W = -P\,\d V$, the negative signed area under
  the process curve.
- $C_V = (\partial U/\partial T)_V$ and $C_P = (\partial H/\partial T)_P$ with
  $H = U+PV$; for an ideal gas $C_P - C_V = Nk_B$ and $\gamma = C_P/C_V$.
- An ideal gas has $U=U(T)$. Its isotherm is $PV=\text{const}$ with
  $Q = Nk_BT\ln(V_b/V_a)$; its adiabat is $PV^\gamma=\text{const}$, steeper than
  the isotherm, and adiabatic expansion cools the gas.
