The first law says energy is conserved, but it does not say which way things go. Heat flows from hot to cold, gases spread out, ice melts in a warm room, and never the reverse on their own. The quantity that tracks this direction is entropy, and it comes from counting. You will need logarithms.
🔑 Key idea
A microstate is one specific arrangement of all the particles and their energy. $W$ is the number of microstates that look the same from outside. Entropy is $S = k\ln W$, with $k = 1.38 \times 10^{-23}\ \text{J/K}$ (Boltzmann's constant). Systems drift toward the conditions with the most microstates, so entropy tends to increase.
💡 Why it works
Every microstate is equally likely. Put 4 gas molecules in a box with two halves: there are $2^4 = 16$ microstates. Only 1 has all four on the left, but 6 have two on each side. So the spread-out state is 6 times more likely than the bunched-up one. With $6 \times 10^{23}$ molecules, the odds against all of them gathering on one side are beyond astronomical, which is why it never happens. The logarithm makes entropy add up properly: two systems together have $W = W_1W_2$, so $S = S_1 + S_2$.
Ten particles in a box with a divider. Count the ways to have k on the left: the even split has by far the most arrangements.
Worked examples
✏️ Worked example: Counting arrangements
Ten gas molecules move freely in a box. What is the chance that all ten are in the left half at once? How many microstates have exactly five on each side?
Each molecule has 2 choices, so there are $2^{10} = 1024$ microstates in all.
All on the left: 1 microstate, a chance of $1/1024$.
Five and five: choose which 5 are on the left, $\binom{10}{5} = 252$ microstates (about 25% of all).
Answer: $1/1024$; 252 microstates.
✏️ Worked example: A gas doubling its volume
One mole of an ideal gas expands into a vacuum, doubling its volume. Find $\Delta S$.
Each molecule now has twice as many places to be, so $W$ is multiplied by $2^{N_A}$.
$\Delta S = k\ln(2^{N_A}) = N_Ak\ln 2 = R\ln 2$, since $N_Ak = R$.
$\Delta S = (8.314)(0.693) = 5.76\ \text{J/K}$. No heat flowed and no energy changed, yet entropy rose.
Answer: $+5.76\ \text{J/K}$.
Two small solids sharing six quanta of energy. Starting with all the energy in A, the most likely split spreads it over both: that spreading is heat flowing from hot to cold.
⚠️ Common mistake
Thinking of entropy only as messiness. Messiness misleads: two gases mixing and energy spreading from a hot object to a cold one both raise entropy, though neither looks messier. Check: ask how many ways the particles and the energy can be arranged.
Count arrangements yourself, and watch heat flow from hot to cold by pure chance, in the Science Lab's Entropy and the Second Law chapter.