Entropy and the Second Law

Why does a gas spread out but never gather itself back into a corner? Count the microstates and the direction of time appears.

Advanced

Free expansion of a gas

All particles start in the left half. Remove the partition and they spread out. Nothing pushes them right; there are simply far more ways to be spread out.

Particles do not collide with each other, so each one wanders independently.

fraction on the left S / Smax partition removed
Left / right
80 / 0
Microstates Ω = C(N, n_left)
1.00
Entropy S = k ln Ω
0.0 k (max 53.0 k)
P(all on left) = 2^−N
8.27 × 10^-25

The partition is in place. Remove it to start the expansion. For large N the fraction hugs 1/2. A spontaneous return to the left side is possible in principle but you would wait far longer than the age of the universe.

Heat flow between a hot and a cold block

Two identical blocks touch. Heat flows from hot to cold until they share one temperature, and the total entropy only goes up.

A500 KB250 KQt = 0.0 s590time (0 to 50 s)ΔS total (J/K)
Heat transferred Q
0 J
ΔS of hot block
0.0 J/K
ΔS of cold block
+0.0 J/K
ΔS total
+0.0 J/K

Right now a parcel of 100 J leaving A at 500 K and entering B at 250 K changes the total entropy by 100 / 250 − 100 / 500 = +0.200 J/K. The reverse transfer, cold to hot, would give -0.200 J/K, which the second law forbids. The flow stops at 375 K, where the gain becomes zero.

What entropy measures

Put N gas particles in a box and ask only how many are in the left half. If n are on the left, the number of ways to choose which particles those are is the binomial coefficient Ω = C(N, n). Boltzmann defined the entropy of that macrostate as S = k ln Ω.

With the partition in place every particle is on the left, so Ω = 1 and S = 0. Once the partition is gone the even split has by far the most microstates: for N = 100 there are about 10²⁹ ways to split 50/50 but only one way to have all 100 on the left. Each particle moves at random, so the gas drifts towards the states that make up almost all of the possibilities and stays there.

That is the second law of thermodynamics: the entropy of an isolated system does not decrease. It is not a force but overwhelming probability. With 4 particles you will see them all return to the left within seconds. With a mole of gas the odds are 1 in 2^(6 × 10²³), so it never happens.

Key formulas

Boltzmann entropy

S = k ln Ω

k
Boltzmann constant, 1.381 × 10⁻²³ J/K
Ω
number of microstates for the macrostate

Particles split between two halves

Ω(n) = C(N, n) = N! / (n! (N − n)!)

n
particles in the left half

ln N! is computed as ln 1 + ln 2 + … + ln N, so huge numbers never overflow.

Clausius entropy change

ΔS = Q / T

Q
heat transferred reversibly (J)
T
absolute temperature (K)

Heat flowing from hot to cold

ΔStotal = Q / Tcold − Q / Thot > 0

Free expansion to double volume: ΔS = N k ln 2

How to use this visualizer

  1. 1
    Choose the number of particles N. Changing N puts all particles back in the left half.
  2. 2
    Press Remove partition and watch the blue fraction-on-the-left curve fall to about one half while S / Smax climbs to about 1.
  3. 3
    Try N = 4 or 6. The curve jumps around and the gas regularly gathers on the left again; the counter shows how often.
  4. 4
    Now try N = 400. The curve barely wiggles and the probability of a return, 2^−N, is around 10^−120.
  5. 5
    In the heat-flow panel, set the two starting temperatures and press Start contact. The hot block loses less entropy than the cold block gains, so the total rises until both reach the average temperature.

Why big systems never run backwards

Probability that all particles are found in the left half, and typical fluctuation of the left fraction around ½
Particles NP(all on left) = 2^−NTypical fluctuation
21 / 4≈ 0.35
101 / 1024≈ 0.16
100≈ 10^−30≈ 0.05
1,000≈ 10^−301≈ 0.016
6 × 10²³ (1 mol)10^(−1.8 × 10²³)≈ 10⁻¹²

Key ideas

Microstates and macrostates

A macrostate is what you measure, such as "30 particles on the left". A microstate says exactly which particles are where. Many microstates share one macrostate.

Entropy counts possibilities

S = k ln Ω measures how many microstates are compatible with what you see. Spread-out states have vastly more.

Irreversibility is statistics

The laws of motion run equally well backwards. Processes look one-way because the reverse requires landing in an absurdly rare set of microstates.

Heat flows downhill

Moving heat Q from hot to cold raises entropy by Q/T_cold − Q/T_hot > 0. The reverse would lower it, so it never happens on its own.

Practice problems

Problem 1: Counting microstates

Six particles share a box. How many microstates have 3 on the left, and how many have all 6 on the left? What is the entropy difference between the two macrostates, in units of k?
Show solution

Ω(3) = C(6, 3) = 6! / (3! 3!) = 20

Ω(6) = C(6, 6) = 1

ΔS = k ln 20 − k ln 1 = k ln 20

ΔS ≈ 3.00 k; the even split is 20 times as likely

Problem 2: Heat between two reservoirs

1200 J of heat flows from a reservoir at 600 K to one at 300 K. Find the entropy change of each reservoir and of the universe.
Show solution

Hot reservoir: ΔS = −Q / T = −1200 / 600 = −2.0 J/K

Cold reservoir: ΔS = +Q / T = 1200 / 300 = +4.0 J/K

Total: −2.0 + 4.0 = +2.0 J/K

ΔSuniverse = +2.0 J/K > 0, so the process is allowed

Reversing it would give −2.0 J/K, which is why heat never flows from cold to hot on its own.

Discussion

Questions, ideas or a different approach? Join the conversation.