See also: Course-wide Conventions & Notation
Run the code: Notebook for Section 4.1, in which you can change and rerun the Python cells of this section in your browser.
The course map shows where this module sits in the course and which relations connect the microscopic and macroscopic descriptions. Select a module to unfold its sections.

Overview and Learning Objectives¶
Entropy completes the thermodynamic description of spontaneity by accounting for the dispersal of energy and matter. This section motivates entropy through examples where enthalpy alone fails, defines entropy as a state function via reversible heat, and derives the fundamental relation for simple compressible systems.
In Module 3, we established the First Law toolkit: internal energy , enthalpy , heat capacities and , and the five-step workflow for computing , , and under various process constraints. That toolkit tells us how much energy is exchanged — but not which direction a process will spontaneously proceed. We will see that exothermicity () often favors spontaneity but does not fully determine it. The missing piece is entropy, a state function that provides crucial insight into the direction of spontaneous change.
In Module 2, we built a statistical-mechanical framework in which macroscopic properties emerge as ensemble averages over microstates. Entropy turns out to have a particularly natural microscopic interpretation: it measures how many microstates are consistent with a given macrostate. This section introduces entropy from the macroscopic side; Section 4.3 will close the loop by connecting entropy to the partition function .
Learning objectives:
Explain why exothermicity () does not by itself guarantee spontaneity.
Define entropy as a state function using .
Verify that is exact for an ideal gas by applying the cross-derivative test.
Use the First Law for a reversible -only process to derive .
Compute entropy changes by integrating along a convenient reversible path, including for irreversible processes.
Core Ideas and Derivations¶
Exothermicity and Spontaneity¶
Exothermic reactions are often — but not always — spontaneous. An exothermic process releases heat to its surroundings, corresponding to a negative enthalpy change, . While this heat release can drive a process forward, enthalpy alone does not guarantee spontaneity; we must also consider entropy.
An Example: Formation of Liquid Water¶
Consider the formation of two moles of liquid water from hydrogen and oxygen gases at 298.15 K and 1 bar:
The standard enthalpy change for this reaction is for two moles of , so the reaction is exothermic.
In chemical terms, exothermicity is often associated with the formation of stronger chemical bonds in the products than those in the reactants. In this example, forming bonds in water releases more energy than what was required to break and bonds.
The formation of water is spontaneous under standard conditions, and the heat that it releases favors this direction.
A Counter Example: Mixing of Two Ideal Gases¶
If we mix two ideal gases, such as Ar and Kr, their intermolecular interactions are negligible (ideal-gas behavior), so . Nonetheless, mixing occurs spontaneously once the stopper is opened (Figure 4.1.1).
Source
import sys
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Circle, Polygon, Rectangle
sys.path.append("..") # the book folder, which holds figstyle
import figstyle as fs
RADIUS = {"Ar": 0.15, "Kr": 0.20} # drawn radius of an atom
BULBS = {"left": (0.0, 4.0), "right": (5.0, 9.0)} # range of x of each bulb; both span y from 0 to 3
def place(rng, atoms, taken):
"""Random positions for a list of (kind, bulb) without overlaps; `taken` holds (x, y, radius) of earlier atoms."""
for kind, bulb in atoms:
r, (x0, x1) = RADIUS[kind], BULBS[bulb]
while True:
x, y = rng.uniform(x0 + r + 0.2, x1 - r - 0.2), rng.uniform(r + 0.2, 3 - r - 0.2)
if all(np.hypot(x - xo, y - yo) > r + ro + 0.25 for xo, yo, ro in taken):
break
taken.append((x, y, r))
yield kind, x, y
def draw_bulbs(ax, c, atoms, is_open, labels):
"""Two bulbs joined by a neck with a stopper, the atoms inside, and the name of the gas below each bulb."""
outline = [(0, 0), (4, 0), (4, 1.1), (5, 1.1), (5, 0), (9, 0), (9, 3), (5, 3), (5, 1.9), (4, 1.9), (4, 3), (0, 3)]
ax.add_patch(Polygon(outline, closed=True, fc=c.ground, ec=c.ink, lw=1.4, joinstyle="round"))
color = {"Ar": c.vermilion, "Kr": c.blue}
for kind, x, y in atoms:
ax.add_patch(Circle((x, y), RADIUS[kind], fc=color[kind], ec="none"))
lift = 1.15 if is_open else 0.0 # an open stopper is pulled out of the neck
ax.add_patch(Rectangle((4.38, 1.0 + lift), 0.24, 1.45, fc=c.ink, ec="none"))
ax.plot([4.12, 4.88], [2.45 + lift, 2.45 + lift], color=c.ink, lw=2.2, solid_capstyle="round")
ax.text(4.5, 3.85 if is_open else 3.2, "stopper open" if is_open else "stopper closed", ha="center", va="bottom",
color=c.muted) # above the bulbs, whose tops are at y = 3
for x, (text, text_color) in zip((2.0, 7.0), labels):
ax.text(x, -0.3, text, ha="center", va="top", color=text_color)
ax.set(xlim=(-0.2, 9.2), ylim=(-0.85, 4.45), aspect="equal")
ax.axis("off")
def draw_mixing(c):
rng = np.random.default_rng(8251991)
before = list(place(rng, [("Ar", "left")] * 8 + [("Kr", "right")] * 8, []))
after = list(place(rng, ([("Ar", "left"), ("Kr", "left"), ("Ar", "right"), ("Kr", "right")]) * 4, []))
fig, axes = plt.subplots(1, 2, figsize=(fs.WIDTH, 2.3), constrained_layout=True)
draw_bulbs(axes[0], c, before, False, [("Ar", c.vermilion), ("Kr", c.blue)])
draw_bulbs(axes[1], c, after, True, [("Ar and Kr", c.ink), ("Ar and Kr", c.ink)])
fs.panel(axes[0], "a", "Before opening the stopper")
fs.panel(axes[1], "b", "After opening the stopper")
return fig
fs.show(draw_mixing, alt="Two sketches of two bulbs joined by a narrow neck with a stopper. In panel a, the stopper is "
"closed, the left bulb holds eight argon atoms, and the right bulb holds eight krypton atoms. "
"In panel b, the stopper is open, and each bulb holds four argon atoms and four krypton atoms.")Figure 4.1.1:Mixing of two ideal gases, Ar and Kr, (a) before and (b) after opening the stopper between the two bulbs. Because the atoms of an ideal gas do not interact, for this process.
Even though , the process is still spontaneous. If you were shown panels (a) and (b) of Figure 4.1.1 without their titles, you would know the natural direction of mixing. This spontaneous behavior underscores that enthalpy alone cannot capture whether a process will occur without additional driving forces. That driving force is entropy, which the rest of this section defines.
Definition of Entropy¶
- Entropy
- A state function denoted by , quantifying the degree of dispersal or spread of energy and matter, thereby predicting the direction of spontaneous change.
The General Claim¶
In Section 3.1, we noted a key distinction: is an exact differential, while and are inexact — their values depend on the path. We also noted that dividing the reversible heat by produces the exact differential .
It can be shown from the Clausius theorem (a consequence of the Second Law) that is always an exact differential, regardless of the substance. The factor is called an integrating factor for ; Appendix A reviews exact and inexact differentials. We therefore define entropy through
The change in entropy between two states and is
Because is exact, depends only on the initial and final states — not on the path. However, computing requires evaluating the integral along a reversible path (since holds only for reversible processes). For an irreversible process between the same two states, we construct any convenient reversible path connecting them and integrate along that path instead.
Verification: Ideal Gas¶
Rather than proving the general result, let us verify that is exact for an ideal gas — a case where we can check directly.
From Section 3.2, the First Law for a reversible process with only work, using and as independent variables, gives
For any ideal gas (not just monatomic), and , so
To decide whether a differential is exact, we use the cross-derivative test. A differential is exact if and only if
because the two sides are then the mixed second derivatives of a single function, which do not depend on the order of differentiation.
Here , , , and . For an ideal gas, depends only on , so depends only on as well, and . However, . The two derivatives differ, so is inexact.
Now divide by :
Apply the cross-derivative test with and :
Both derivatives are zero, so they are equal: is exact. Dividing by converted an inexact differential into an exact one, confirming the entropy definition for this case.
Integrating between two states gives the entropy change of an ideal gas:
At constant temperature only the second term remains (Example 1 below).
The monatomic case
For a monatomic ideal gas specifically, , so
which is manifestly the total differential of . This is an explicit entropy function for the monatomic ideal gas. More general substances have more complicated dependences, but the exactness of still holds.
Fundamental Thermodynamic Relation¶
From the definition of entropy, . For a simple closed system with only work (), the First Law gives
This is the fundamental thermodynamic relation for a simple compressible system:
Notice what has happened: the First Law in the form involves two inexact differentials that combine to give one exact differential. The fundamental relation rewrites the same physics using three exact differentials — , , and . The path-dependent has been replaced by the state-function product , and the path-dependent by . Converting inexact differentials into exact ones is the central mathematical achievement of introducing entropy.
The relation was derived for a reversible process, but it contains only state functions and their differentials. It therefore holds for any infinitesimal change between equilibrium states of a closed system with only work, whether the change is reversible or not. What is lost in an irreversible change is the identification of the two terms: is then not the heat, and is not the work.
Here, is naturally expressed as a function of the extensive variables and . In systems with additional types of work (e.g., electrical, surface, magnetic), the more general relation becomes
A state function’s natural variables are those that appear as independent variables in its total differential. For internal energy , the natural variables are and for a simple system with only work. Note that while we can always write as a function of other variables (like and ), doing so loses information — the natural-variable form encodes everything about the system’s thermodynamics, while does not. We will return to this point when we introduce free energies in Section 5.1.
Worked Examples¶
Example 1: Isothermal Expansion (Reversible)¶
Problem. Compute when one mole of an ideal gas expands reversibly and isothermally from to .
Solution. For a reversible isothermal expansion of an ideal gas,
Along a reversible isotherm of an ideal gas, (since depends only on ), so . Therefore
With and :
Result. Doubling the volume reversibly at constant increases the entropy by per mole.
Example 2: Free Expansion (Irreversible)¶
Problem. Compute when one mole of an ideal gas undergoes free expansion from to inside a rigid, insulated container (as in the worked example of Section 3.1).
Solution. In the free expansion, , so . The container is insulated, so . By the First Law, , which means for an ideal gas.
But does not mean ! The definition applies to a reversible path, and free expansion is decidedly irreversible. To compute , we need a reversible path connecting the same initial and final states.
The initial and final states have the same but different — exactly the endpoints of Example 1. Since is a state function,
Result. The entropy change of the gas is the same as for the reversible isothermal expansion, because entropy is a state function. Figure 4.3.3 in Section 4.3 follows this expansion particle by particle.
For an irreversible process, is found by constructing any reversible path between the same endpoints. The actual (irreversible) path enters only when computing and .
Examples 1 and 2 change the entropy of the gas by the same amount. For each of the two expansions, find the heat exchanged with the surroundings, the entropy change of the surroundings, and the total entropy change. In Example 1 the surroundings are a reservoir at the temperature of the gas.
Section 4.2 states the Second Law in terms of the total entropy of an isolated system.
When the stopper is opened, each gas spreads into twice its initial volume at constant temperature, and the two ideal gases do not interact. Use the results of Examples 1 and 2 to find for each gas, and then for moles of each. Compare the sign of with .
Concept Checks¶
In the ideal-gas mixing example, why can but the process still be spontaneous?
Why must be computed along a reversible path even for an irreversible process between the same states?
What are the natural variables of for a simple compressible system, and how do they appear in ?
How does the sign of (system + surroundings) relate to “directionality” (arrow of time) in spontaneous processes?
Two ideal-gas processes connect the same initial and final states: one reversible, one irreversible. Compare , , and for the two processes.
Key Takeaways¶
Spontaneity depends on more than enthalpy; entropy accounts for dispersal and multiplicity of accessible states.
Entropy is defined by and is a state function: its value depends only on the state, not the path.
Dividing by converts an inexact differential into an exact one — this is the central mathematical role of entropy.
For a closed system with only work, is the fundamental thermodynamic relation, expressing the First Law entirely in terms of exact differentials. It is derived for a reversible process and holds for any change between equilibrium states.
Entropy changes for irreversible processes are computed by finding a convenient reversible path between the same initial and final states and integrating along that path.