See also: Course-wide Conventions & Notation
Run the code: Notebook for Section 3.2, in which you can change and rerun the Python cells of this section in your browser.
Overview and Learning Objectives¶
If you heat a gas in a sealed rigid container versus a piston open to the atmosphere, the temperature changes will differ—even for the same amount of heat. Why? The answer lies in how constraints (constant vs. constant ) redirect energy between heat and work. This section develops a systematic workflow for applying the First Law under different process constraints, then illustrates it with common ideal-gas cases and a microscopic interpretation.
We begin by clarifying the definitions of quasi-static, reversible, and irreversible processes. We then outline a step-by-step method for using the First Law under different constraints, derive results for isochoric, isothermal, and adiabatic ideal-gas processes, and end with a microscopic interpretation that connects probability distributions of microstates with heat and work. Processes at constant pressure are taken up in Section 3.3.
Learning objectives:
Differentiate quasi-static, reversible, and irreversible processes and explain why reversibility is an idealization.
Explain why reversible expansion produces the maximum work for a given volume change (and reversible compression requires the minimum work).
Rewrite the First Law in terms of chosen independent variables and apply constraints (isothermal, isochoric, isobaric, adiabatic).
Integrate work and heat for common ideal-gas processes and relate results to state-variable changes.
Interpret microscopic changes in and as heat and work contributions to .
Core Ideas and Derivations¶
Thermodynamic Processes¶
- Quasi-static process
- A process carried out infinitesimally slowly so that the system remains nearly in equilibrium at all times. Each intermediate state is well-defined thermodynamically.
- Reversible process
- An idealized process that is (1) quasi-static and (2) free of dissipative effects, meaning it can be reversed with no net change to the system or surroundings.
- Irreversible process
- Any process that violates one or more of the conditions for reversibility (e.g., too rapid, frictional, or dissipative).
- Dissipative effects
- Processes that convert ordered energy into disordered (thermal) energy in a way that cannot be undone spontaneously. Common examples include friction, viscous drag, turbulence, electrical resistance, and heat flow across a finite temperature difference.
How to Apply the First Law of Thermodynamics¶
The First Law states (Section 3.1, Eq. (3.1.5)):
where is the change in internal energy, is the heat added to the system, and is the work done on the system. To make this law useful for specific processes, follow the five-step workflow below.
Workflow overview: (1) Choose independent variables → (2) Rewrite the First Law → (3) Apply constraints → (4) Define the system/EOS → (5) Integrate. Click each step for details.
Step 1. Choose Two Independent Variables
For a single-component, single-phase system, specifying two independent variables (plus the amount of substance) completely determines the thermodynamic state.
Convenience: Which variables are easiest to control with your experimental setup?
Necessity: Which variables can you reliably measure or keep constant?
Curiosity: Which variables are most relevant to the phenomenon you wish to explore?
Common choices include for gases in rigid containers and for processes open to the atmosphere.
Step 2. Rewrite the First Law in Terms of Your Chosen Variables
Start from . For a reversible process with only work, (Section 3.1, Eq. (3.1.8)), so
Now expand as a total differential in your chosen variables. For example, with and :
which gives
Note that this expression for has three contributions: the response of to temperature, the response of to volume, and the work term. This is not just the total differential of —the work term matters.
Step 3. Apply Constraints
Constant state variables:
Isobaric (), Isochoric (), Isothermal ().
Adiabatic:
If the boundary is thermally insulating, .
“Adiabatic” means no heat transfer, but the system may still perform or receive work.
Applying a constraint eliminates one or more terms from your Step 2 expression, often making the resulting differential equation separable and integrable.
Step 4. Define the System (Equation of State)
Specify an equation of state if known (e.g., for an ideal gas, or the van der Waals EOS from Section 1.4) and an expression for (e.g., for a monatomic ideal gas, from Section 2.5).
Use them to evaluate and the partial derivatives of that appear in your expression for .
This step is where the physics of the system enters: different substances yield different results for the same constraint.
Step 5. Integrate the First Law
Integrate the differential relationships to link total heat () or work () to finite changes in state variables.
For reversible processes, the integration path in state space is well-defined.
For irreversible processes, compute from state variables (it’s path-independent) and use the First Law to relate and .
Figure 3.2.1 shows the four constraints as paths of an ideal gas on a – diagram. All four paths start from the same state.
Source
import sys
import matplotlib.pyplot as plt
import numpy as np
sys.path.append("..") # the book folder, which holds figstyle
import figstyle as fs
R_GAS = 0.083145 # L bar K^-1 mol^-1
GAMMA = 5 / 3 # monatomic ideal gas
V_1, V_2, T_1 = 5.0, 20.0, 300.0 # L, L, K (one mole)
P_1 = R_GAS * T_1 / V_1 # bar
P_HEATED = 1.3 * P_1 # bar, the end of the isochoric heating (390 K)
def draw_paths(c):
fig, ax = plt.subplots(figsize=(6.4, 4.0), constrained_layout=True)
V = np.linspace(V_1, V_2, 400)
P_isobaric, P_isothermal, P_adiabatic = np.full_like(V, P_1), P_1 * V_1 / V, P_1 * (V_1 / V) ** GAMMA
# The area under a path is |w|. Each band has the color of the path that bounds it from above.
ax.fill_between(V, P_isothermal, P_isobaric, color=c.tint(c.green, 0.8), lw=0)
ax.fill_between(V, P_adiabatic, P_isothermal, color=c.tint(c.blue, 0.75), lw=0)
ax.fill_between(V, 0, P_adiabatic, color=c.tint(c.vermilion, 0.75), lw=0)
# Paths, each named at its final state with the condition that defines it
for P, color, name in [(P_isobaric, c.green, "isobaric\n$dP = 0$"), (P_isothermal, c.blue, "isothermal\n$dT = 0$"),
(P_adiabatic, c.vermilion, "adiabatic\n$\\delta q = 0$")]:
ax.plot(V, P, color=color)
ax.plot(V[-1], P[-1], "o", color=color, ms=6.5, zorder=5, clip_on=False)
ax.text(V[-1] + 0.5, P[-1], name, color=color, va="center", clip_on=False)
ax.plot([V_1, V_1], [P_1, P_HEATED], color=c.purple)
ax.plot(V_1, P_HEATED, "o", color=c.purple, ms=6.5, zorder=5)
ax.text(V_1 + 0.45, P_HEATED, "isochoric, $dV = 0$", color=c.purple, va="center")
# Initial state
ax.plot(V_1, P_1, "o", color=c.ink, ms=6.5, zorder=6)
ax.text(V_1 - 0.35, P_1, "initial\nstate", ha="right", va="center")
ax.set(xlabel="Volume $V$ (L)", ylabel="Pressure $P$ (bar)", xlim=(2.6, 20), ylim=(0, 7.0))
ax.set_xticks([5, 10, 15, 20])
return fig
fs.show(draw_paths, alt="Pressure against volume with four paths that start from one state at 5 L and about 5 bar. The "
"isochoric path rises vertically at 5 L to about 6.5 bar. The isobaric path runs horizontally to "
"20 L. The isothermal path falls to about 1.2 bar at 20 L. The adiabatic path falls more steeply "
"to about 0.5 bar at 20 L. The areas under the isobaric, isothermal, and adiabatic paths are "
"shaded, and the isobaric path has the largest area.")Figure 3.2.1:Four reversible paths of one mole of a monatomic ideal gas from the same initial state, : isochoric heating, and isobaric, isothermal, and adiabatic expansion to . The area between a path and the volume axis is for that path. The areas overlap: the area under the isobaric path includes the blue and orange areas, and the area under the isothermal path includes the orange area. The isochoric path has no area under it, so .
Applying the Workflow: and as Independent Variables¶
For many systems—especially gases—choosing and as independent variables simplifies calculations. Let us walk through the five-step workflow for a monatomic ideal gas. Steps 3 and 4 can be taken in either order. Here the ideal gas is specified first (Step 4), because this simplifies the expression to which the constraints are then applied (Step 3).
Step 1–2: First Law in Terms of and ¶
Starting from the First Law for a reversible process with only work,
we rewrite as a total differential in and :
Substituting:
Step 4: Ideal-Gas Simplification¶
For an ideal gas, depends only on (Section 2.5), so . For a monatomic ideal gas specifically,
Equation (3.2.7) then simplifies to
Step 3: Process Constraints¶
Applying these constraints to Equation (3.2.9):
Table 3.2.1:Processes for an Ideal Gas ( and as Independents)
Constraint | Condition | Resulting |
|---|---|---|
Isochoric | ||
Isothermal | ||
Adiabatic |
Step 5: Integrations Under Specific Constraints¶
Isochoric ()
With no volume change, there is no work (). All energy enters as heat:
Since , we also have .
Isothermal ()
For an ideal gas, (because depends only on ). The system absorbs heat to offset the work it does:
And .
Adiabatic ()
Setting in Equation (3.2.9):
Separating variables:
Integrating both sides:
Dividing through by :
Exponentiating:
Comparing Isothermal and Adiabatic Expansions¶
How does the path affect the work? Figure 3.2.2 compares a reversible isothermal expansion with a reversible adiabatic expansion from the same initial state. The area under each curve is for that process.
Source
import sys
from fractions import Fraction
import matplotlib.pyplot as plt
import numpy as np
sys.path.append("..") # the book folder, which holds figstyle
import figstyle as fs
# Parameters
n = 1.0 # mol
R = 8.314 # J/(mol K)
T1 = 300 # K
V1 = 5.0e-3 # m^3 (5 L)
V2 = 20.0e-3 # m^3 (20 L)
gamma = 5/3 # monatomic ideal gas
P1 = n * R * T1 / V1 # initial pressure
# Volume array
V = np.linspace(V1, V2, 500)
V_L = V * 1e3 # convert to liters for plotting
# Isothermal: P = nRT/V
P_iso = n * R * T1 / V
# Adiabatic: P V^gamma = P1 V1^gamma => P = P1 (V1/V)^gamma
P_adi = P1 * (V1 / V)**gamma
# Convert pressures to bar for plotting
P_iso_bar = P_iso / 1e5
P_adi_bar = P_adi / 1e5
P1_bar = P1 / 1e5
# Work along each path
w_iso = -n * R * T1 * np.log(V2 / V1) # J
w_adi = -(P1 * V1**gamma / (1 - gamma)) * (V2**(1 - gamma) - V1**(1 - gamma)) # J
def draw(c):
fig, ax = plt.subplots(figsize=(6.4, 3.7), constrained_layout=True)
# Areas under the curves
ax.fill_between(V_L, P_adi_bar, P_iso_bar, color=c.tint(c.blue, 0.75), lw=0)
ax.fill_between(V_L, 0, P_adi_bar, color=c.tint(c.vermilion, 0.75), lw=0)
# Curves, each labeled at its final state
for P_bar, color, name, w in [(P_iso_bar, c.blue, f"isothermal ($T = {T1}$ K)", w_iso),
(P_adi_bar, c.vermilion,
rf"adiabatic ($\gamma = {Fraction(gamma).limit_denominator(9)}$)", w_adi)]:
ax.plot(V_L, P_bar, color=color)
ax.plot(V_L[-1], P_bar[-1], "o", color=color, ms=6.5, zorder=5, clip_on=False)
ax.text(V_L[-1] + 0.5, P_bar[-1], f"{name}\n$w = {w / 1e3:.2f}$ kJ".replace("-", "−"), color=color,
va="center", clip_on=False)
# Initial state
ax.plot(V1 * 1e3, P1_bar, "o", color=c.ink, ms=6.5, zorder=5)
ax.text(V1 * 1e3 + 0.4, P1_bar, "initial state", va="center")
ax.set(xlabel="Volume $V$ (L)", ylabel="Pressure $P$ (bar)", xlim=(4, 20), ylim=(0, 5.5))
return fig
fs.show(draw, alt="Pressure against volume for two expansions of an ideal gas from 5 L and about 5 bar to 20 L. The "
"isothermal curve at 300 K ends at about 1.2 bar, and the work is minus 3.46 kJ. The adiabatic "
"curve falls more steeply and ends at about 0.5 bar, and the work is minus 2.26 kJ. The area under "
"the adiabatic curve is smaller than the area under the isothermal curve.")Figure 3.2.2:Reversible isothermal and adiabatic expansions of one mole of a monatomic ideal gas from to . The area under each curve is for that path, and the labels give . The orange area lies under both curves.
Microscopic Interpretation of the First Law¶
As developed in Section 2.1, macroscopic thermodynamic properties are ensemble averages over microstates. This perspective gives a powerful physical picture of heat and work at the molecular level.
From a statistical mechanics perspective, the internal energy is
where is the probability of occupying the -th microstate with energy , and is the total number of accessible microstates. The total differential can be written as
For a closed system (constant ) with only work, the microstate energies depend on the volume, so . Noting that
we identify pressure as
Hence,
Comparing term by term with , which holds for a reversible process, we identify:
Figure 3.2.3 illustrates these two mechanisms. Panel (a) shows the initial state, panel (b) the result of adding heat (the probabilities change, and the energy levels stay), and panel (c) the result of doing work by compression (the energy levels shift, and the probabilities stay).
Source
from matplotlib.patches import Rectangle
def boltzmann(E, kT):
"""Boltzmann probabilities for levels E at thermal energy kT."""
weights = np.exp(-E / kT)
return weights / weights.sum()
# Energies and kT in units of the initial level spacing
E_initial = np.array([0.5, 1.5, 2.5, 3.5, 4.5])
kT_initial = 1.5
p_initial = boltzmann(E_initial, kT_initial)
p_heated = boltzmann(E_initial, 2 * kT_initial) # heating: twice the temperature, same levels
E_compressed = 2 * E_initial # compression: twice the level spacing
p_compressed = boltzmann(E_compressed, 2 * kT_initial) # and twice the temperature: same probabilities
def draw_levels(c):
gutter = 0.2 # room for the arrows of panel (c)
fig, axes = plt.subplots(1, 3, figsize=(fs.WIDTH, 4.0), constrained_layout=True, sharey=True,
gridspec_kw=dict(width_ratios=[0.8, 0.8, 0.8 + gutter]))
bar = 0.44 # height of a probability bar
small = fs.BASE - 1.5
def levels_and_bars(ax, E, p, level_color, bar_color, text_color, label_from=None):
"""Levels E with a bar of length p on each, and the value of p beside the bar."""
ends = p if label_from is None else np.maximum(p, label_from)
for i in range(len(E)):
ax.plot([0, 0.8], [E[i], E[i]], color=level_color, lw=1.4, solid_capstyle="butt")
ax.add_patch(Rectangle((0, E[i]), p[i], bar, fc=bar_color, ec="none"))
ax.text(ends[i] + 0.02, E[i] + bar / 2, f"{p[i]:.2f}", color=text_color, va="center", fontsize=small)
# (a) Initial state
levels_and_bars(axes[0], E_initial, p_initial, c.gray, c.tint(c.gray, 0.45), c.ink)
axes[0].text(0.78, 8.25, "Boltzmann distribution", ha="right", va="center")
# (b) After heating: same levels, new probabilities (the dashed outlines are the initial ones)
levels_and_bars(axes[1], E_initial, p_heated, c.gray, c.tint(c.vermilion, 0.3), c.vermilion,
label_from=p_initial)
for E, p in zip(E_initial, p_initial):
axes[1].add_patch(Rectangle((0, E), p, bar, fc="none", ec=c.ink, lw=1.0, ls=(0, (3, 2))))
axes[1].text(0.78, 8.25, r"$\delta q = \sum_i E_i\,dp_i > 0$", ha="right", va="center")
# (c) After compression: new levels, same probabilities (the dashed lines are the initial levels)
for E in E_initial:
axes[2].plot([0, 0.8], [E, E], color=c.ink, lw=1.0, ls=(0, (3, 2)))
levels_and_bars(axes[2], E_compressed, p_compressed, c.vermilion, c.tint(c.gray, 0.45), c.ink)
for E_old, E_new, x in zip(E_initial, E_compressed, [-0.035, -0.035, -0.075, -0.115, -0.155]):
fs.arrow(axes[2], (x, E_old), (x, E_new), c.vermilion, lw=1.2, scale=9)
axes[2].text(0.78, 8.25, r"$\delta w = \sum_i p_i\,dE_i > 0$", ha="right", va="center")
for ax, letter, title in zip(axes, "abc", ["Initial state", "After heating", "After compression"]):
left = -gutter if ax is axes[2] else 0
ax.plot([0, 0], [0, 10], color=c.muted, lw=0.9) # zero of the probability
ax.set(xlim=(left, 0.8), ylim=(0, 10), xticks=[0, 0.25, 0.5, 0.75], yticks=[], xlabel="Probability $p_i$")
ax.set_xticklabels(["0", "0.25", "0.5", "0.75"])
ax.spines["left"].set_visible(False)
ax.spines["bottom"].set_bounds(0, 0.8)
fs.panel(ax, letter, title)
axes[0].set_ylabel("Energy")
return fig
fs.show(draw_levels,
alt="Three panels, each with five energy levels drawn as horizontal lines and a bar on each level whose "
"length is the probability of that level. Panel a, the initial state: the levels are equally spaced, "
"and the probabilities fall from 0.50 on the lowest level to 0.04 on the highest. Panel b, after "
"heating: the levels are at the same energies, and the probabilities have changed to 0.35, 0.25, 0.18, "
"0.13, and 0.09, so the higher levels are more populated. Panel c, after compression: every level has "
"moved up to twice its energy, and the probabilities are the same as in the initial state.")Figure 3.2.3:Microstate energies (horizontal lines) and occupation probabilities (bars, with the value of beside each bar). (a) Initial state. (b) After heating: the energy levels are unchanged, and the distribution shifts toward higher-energy states (). The dashed outlines are the initial probabilities. (c) After compression: the probabilities are unchanged, and every energy level shifts upward (). The dashed lines are the initial levels, and each arrow joins a level before and after the compression. The probabilities in each panel are Boltzmann probabilities (Section 2.2): heating doubles at fixed levels, and the compression doubles the level spacing and together, which leaves every unchanged.
In Figure 3.2.4, a particle in a one-dimensional box (Section 2.5) takes the place of the schematic levels. Choose a process, move its slider, and follow the heat, the work, and the change in internal energy.
Figure 3.2.4:Heat and work for a particle in a one-dimensional box. Panel (a) shows the energy levels with a bar for each probability , and panel (b) shows the heat , the work , and the change in internal energy since the starting state. Energies are in units of , the energy of the lowest level at the starting length .
Two things to try:
Heat the particle at fixed length, and then compress the box without heat. For each step, say which of and changes and why.
Go from the starting state to and along two routes. On the first route, heat to and then compress. On the second route, compress and then heat. Compare , , and for the two routes.
Worked Example¶
Isothermal Reversible Expansion of an Ideal Gas¶
One mole of an ideal gas expands reversibly and isothermally at from to . Compute , , and .
Assumptions. Ideal gas, reversible process, isothermal; for an ideal gas .
Work
For a reversible process, at every step:
With , , , and :
Internal energy
Heat from the First Law
Result. , , and . The gas does work on the surroundings, and an equal amount of heat flows in from the thermal reservoir to maintain the temperature.
Concept Checks¶
Why is reversibility useful even when real processes are irreversible?
What distinguishes an isothermal process from an adiabatic process in terms of energy transfer mechanisms?
For an ideal gas, why does ?
In the microscopic expression , which term corresponds to heat and which to work (under the stated conditions)?
An isothermal expansion and an adiabatic expansion start from the same initial state and end at the same final volume. Which produces more work? Which produces a larger temperature change?
Key Takeaways¶
A reversible expansion does the maximum work on the surroundings, and a reversible compression requires the minimum work.
Choosing independent variables and constraints turns the First Law into solvable differential relations.
Ideal-gas isothermal expansion has and .
Adiabatic constraints set and force to change when work is done; the relation governs the temperature–volume coupling.
On a – diagram, the magnitude of the reversible work equals the area under the curve, so the work depends on the path that is followed.
Microscopically, heat changes the probability distribution over fixed energy levels, while work shifts the energy levels themselves.