Thermodynamics

Entropy

A measure of disorder, or counting microscopic arrangements — S = k·ln(W)

Entropy S is a measure of the number of microscopic arrangements (W) consistent with a system's macroscopic state — S = k·ln(W). Equivalent: dS = dQ_reversible/T. The second law says total entropy of an isolated system never decreases. Connects thermodynamics, statistical mechanics, information theory, and the arrow of time.

  • Definition (statistical)S = k_B · ln(W)
  • Definition (thermodynamic)dS = dQ_rev / T
  • k_B (Boltzmann constant)1.381 × 10⁻²³ J/K
  • TrendsΔS_universe ≥ 0 (2nd law)
  • Information analogShannon entropy (in bits/nats)
  • Time's arrowEntropy increase distinguishes past from future

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

Definition

Entropy has two equivalent definitions:

1. Thermodynamic (Clausius, 1865):

dS = dQ_rev / T

For any reversible process, the change in entropy equals heat added divided by temperature.

2. Statistical (Boltzmann, 1877):

S = k_B · ln(W)

where W is the number of microscopic arrangements (microstates) consistent with the macroscopic state. k_B = 1.381 × 10⁻²³ J/K.

These give the same numerical answer; they're complementary views of the same physical quantity.

Microstates and macrostates

A macrostate is the macroscopic description (T, P, V, etc.). A microstate is the specific positions and momenta of all particles. Many microstates can correspond to the same macrostate.

For a gas of N particles in a box:

  • Macrostate "all gas in left half" — relatively few microstates.
  • Macrostate "uniform throughout box" — vastly more microstates.

The system spends time proportional to microstate count → mostly in high-entropy states.

Entropy of common processes

ProcessΔSNotes
Reversible isothermal expansion of ideal gasnR·ln(V_f/V_i)Positive (V increases)
Isobaric heating from T_i to T_fn·C_p·ln(T_f/T_i)Positive if T_f > T_i
Phase change (melt or boil)L·m / T_transitionBig positive jump
Mixing of two ideal gasesR·(n_A·ln(2) + n_B·ln(2))Always positive
Adiabatic free expansionnR·ln(V_f/V_i) > 0Despite Q=0, S increases (irreversible)
Reversible cycle0 (returns to start)S is a state function
Heat flow from hot to cold (Q from T_h to T_c)Q·(1/T_c - 1/T_h)Positive if T_h > T_c (always for natural flow)

Numerical entropy values

Substance / stateStandard entropy (J/(mol·K))
Diamond (C, solid)2.4
Graphite (C, solid)5.7
Iron (solid)27
Liquid water (25°C)70
Hydrogen gas (H₂, 25°C)131
Oxygen gas (O₂, 25°C)205
Steam (H₂O gas, 100°C)189
CO₂ gas214

Solids < liquids < gases — more particle freedom → more microstates → higher S.

JavaScript — entropy calculations

const k_B = 1.380649e-23;  // J/K
const N_A = 6.02214e23;    // particles/mol
const R = 8.314;           // J/(mol·K)

// Boltzmann entropy
function boltzmannS(W) { return k_B * Math.log(W); }

// Entropy change in isothermal expansion of ideal gas
function isothermalEntropyChange(n, V_i, V_f) {
  return n * R * Math.log(V_f / V_i);
}

console.log(`1 mol gas, V doubled: ΔS = ${isothermalEntropyChange(1, 1, 2).toFixed(2)} J/K`);  // ~5.76

// Entropy change for isobaric heating
function isobaricEntropyChange(n, C_p, T_i, T_f) {
  return n * C_p * Math.log(T_f / T_i);
}

// Heat 1 mol of water from 25°C to 100°C, C_p = 75 J/(mol·K)
console.log(`Heat water 25→100°C: ${isobaricEntropyChange(1, 75, 298, 373).toFixed(2)} J/K`); // ~16.9

// Phase change entropy
function phaseChangeEntropy(latent_heat, mass, transition_T) {
  return latent_heat * mass / transition_T;
}

// Melting 1 kg of ice (L_fusion = 334,000 J/kg, T = 273.15 K)
console.log(`Melt 1 kg ice: ${phaseChangeEntropy(334000, 1, 273.15).toFixed(0)} J/K`); // ~1223

// Heat transfer entropy change (always positive for natural flow)
function heatTransferEntropy(Q, T_hot, T_cold) {
  return Q * (1/T_cold - 1/T_hot);
}

console.log(`100 J from 500K to 300K: ${heatTransferEntropy(100, 500, 300).toFixed(3)} J/K`);  // +0.133

// Free expansion (gas expands into vacuum)
function freeExpansionEntropy(n, V_i, V_f) {
  // For ideal gas, free expansion is adiabatic (Q=0) but irreversible
  // Same formula as isothermal: nR·ln(V_f/V_i)
  return n * R * Math.log(V_f / V_i);
}

// Mixing entropy (ideal mixing of two gases)
function mixingEntropy(n_A, n_B) {
  // Each gas effectively expands to total volume
  const x_A = n_A / (n_A + n_B);
  const x_B = n_B / (n_A + n_B);
  // ΔS = -R · n_total · (x_A·ln x_A + x_B·ln x_B)
  return -R * (n_A + n_B) * (x_A * Math.log(x_A) + x_B * Math.log(x_B));
}

console.log(`Mix 1 mol A + 1 mol B: ${mixingEntropy(1, 1).toFixed(2)} J/K`);  // ~5.76 J/K

Where entropy shows up

  • Thermodynamics — engine efficiency. Carnot limit derived from entropy considerations.
  • Chemistry — Gibbs free energy. ΔG = ΔH - T·ΔS. Reactions favorable when ΔG < 0; entropy and enthalpy contributions matter.
  • Cosmology. Entropy of universe increasing → arrow of time, eventual heat death.
  • Black holes. Bekenstein-Hawking entropy S = A/4ℓ_p² (area of event horizon). Connection to quantum gravity.
  • Information theory. Shannon entropy H = -Σp·log p; data compression limits.
  • Computing. Landauer's principle — erasing 1 bit costs k_B·T·ln 2 of energy. Foundational limit on computation efficiency.
  • Statistical physics. Boltzmann's foundational work; modern field theory uses entropy throughout.

Common mistakes

  • Equating entropy with "messiness." Disorder is a casual proxy. Entropy is precisely defined — microstate count or dQ_rev/T.
  • Forgetting it's STATE function. S depends only on state, not path. For reversible cycle, ΔS = 0. (For irreversible process between same states, S of system can be the same, but entropy of universe still increased — heat was wasted to surroundings.)
  • Misapplying 2nd law to subsystems. Entropy can decrease locally; only the TOTAL must increase. Refrigerators, life, manufacturing all do this.
  • Using temperature in Celsius for dS = dQ/T. Always Kelvin — dQ at T = 0 K would be infinite ΔS, which isn't right (and 0 K can't be reached).
  • Confusing entropy with energy. Energy is conserved (1st law). Entropy is NOT — it can increase. Different quantities; both are state functions but not interchangeable.
  • Treating S = k·ln W as exact for any state. It's a definition for an equilibrium state with W microstates. Far-from-equilibrium systems need more careful treatment.

Frequently asked questions

What does S = k·ln(W) really mean?

W is the number of microstates (microscopic arrangements) consistent with the macroscopic state. More accessible microstates → higher entropy. For example, gas spread evenly throughout a box has many more microstates than gas all bunched in one corner — so it has higher entropy. Statistically, the system is overwhelmingly likely to be in the higher-W (higher-S) configuration. Boltzmann gravestone has this formula on it.

What's the difference between thermodynamic and statistical entropy?

They're the same quantity, expressed differently. Thermodynamic — defined by heat transfer (dS = dQ_rev/T). Statistical — defined by microstate counting (S = k·ln W). They give the same numerical answer for any well-defined system (in the thermodynamic limit). Boltzmann's brilliance was unifying them.

Why does mixing increase entropy?

Imagine two gases, one in left half, one in right half of a box, separated by a wall. Many microstates have this configuration, but FAR more microstates have them mixed. After removing the wall, mixed states are vastly more numerous — entropy increases. Even with the macroscopic state seeming random ("just mixed"), the increase in W (microstate count) is enormous.

How is entropy related to information?

Information theory's Shannon entropy H = -Σ p_i log p_i is mathematically analogous to thermodynamic entropy. Both measure "uncertainty" or "disorder." Erasing 1 bit of information has thermodynamic cost ≥ k_B·T·ln 2 (Landauer's bound). At room T, this is ~3 × 10⁻²¹ J — incredibly small but fundamental.

Does entropy always increase locally?

No, only in isolated systems. Subsystems can have decreasing entropy if they exchange heat/work with surroundings. Living things, refrigerators, organized buildings all reduce LOCAL entropy by increasing entropy elsewhere (waste heat, atmospheric heating). The 2nd law is about the TOTAL.

What's the entropy of a phase transition?

Going from solid to liquid (or liquid to gas) involves entropy increase — particles have more freedom (higher W). At equilibrium, ΔS = ΔH/T (latent heat / transition temperature). Water at 0°C: ΔS_fusion = 22 J/(mol·K). Water at 100°C: ΔS_vaporization = 109 J/(mol·K) — vaporization much more disorderly than melting.

How does entropy explain why time has a direction?

Most physics laws are time-symmetric (Newton, EM, QM). But the 2nd law isn't — entropy increases. The "low-entropy" state of the early universe (~10⁻³² s after Big Bang) and the high-entropy future creates time's directionality. We remember the past (when entropy was lower) but not the future. Eggs break, milk diffuses — all because of entropy increase.