# Example: Calculating entropy by counting microstates

## Understanding the situation

In our analysis of the entropy change in heat flow, we analyzed a toy model to see how the macroscopic form of entropy, $S = Q/T$, gave  us insight into what would happen spontaneously. Now, let's look at a toy model example that lets us see how the microstate counting form of entropy, $S = k_B \ln W$, can also give us insights into what happens spontaneously. (This example will be of particular interest when we start thinking about free energy.)
We choose a model that is simple enough that we can see all the details.

## Presenting a sample problem

Consider an example of an isolated box of volume $2V$ divided into two equal compartments. An ideal gas occupies half of the container and the other half is empty. When the partition separating the two halves of the box is removed and the system reaches equilibrium again, how does the new entropy of the gas compare to the energy of the original system?

$\implies$

## Solving this problem

One way to do this is to imagine breaking up the left side of the box into M small volumes. (Small compared to the size of the box, but large compared to the size of an atom, so we don't have to worry about atoms "filling up one of the small volume".)

Let's first calculate the entropy of the initial state.

We can put one molecule into the left side of the box into the box in M ways. We can do this for each molecule, so the total number of ways we can put the molecules into the bins is $M \times M \times M ... \times M$ (N times) so

$$W_1 = M^N$$

Now this isn't quite right, since if we put more than one atom into a box it doesn't matter in which order we put it in. We should really divide by the number of permutations of the atoms in each box. But if we have a dilute gas, there is a lot of space, and very few of our boxes will have more than one atom in it. We can fix this, but it's not really worth it. We'll ignore this for now.

So the entropy of the initial state is:

$$S_1 = k_B \ln(M^N) = k_BN \ln M$$

Now pull out the partition so the molecules spread to both parts. The $N$ molecules can now be put into $2M$ different small volumes.

We get the new number of microstates and the entropy to be

$$W_2 = (2M)^N = 2^NM^N = 2^NW_1$$

so

$$S_2 = k_B \ln((2M)^N) = k_BN \ln(2M) = k_BN [ln 2 + \ln M] = k_BN \ln 2 + S_1$$

We get the cool result that the change in the entropy, $ΔS = S_2 - S_1= k_BN \ln 2$, is proportional to $N$ (so it's extensive) and is independent of the size of $M$, so the change doesn't depend on how big are the little boxes we break the big box into.

Joe Redish 2/15/18

Article 605