Can Gravity Decrease Entropy?

John Baez

August 7, 2000

If you weren't careful, you might think gravity could violate the 2nd law of thermodynamics. Start with a bunch of gas in outer space. Suppose it's homogeneously distributed. If it's big enough, it will start clumping up thanks to its gravitational self-attraction. So starting from complete disorder, it looks like we're getting some order! Doesn't this mean that the entropy of the gas is dropping?

Well, it's a bit trickier than you might think. First of all, you have to remember that a gas cloud heats up as it collapses gravitationally! The clumping means you know more and more about the positions of the atoms in the cloud. But the heating up means you know less and less about their velocities. So there are two competing effects. It's not obvious which one wins!

Let's do a little calculation to see how this works. The trick is to keep things simple so we can easily see what's going on. This requires some idealizations.

Entropy Calculation — Part 1

We'll assume a ball of some ideal gas with volume V and a total of N identical gas atoms in it. We assume these atoms interact only gravitationally, and we use Newtonian physics everywhere. We'll start out by assuming that the cloud is "virialized", meaning that the kinetic energy K and potential energy P are related by

K = -P/2
This relationship is true (in a time-averaged sense) when the cloud satisfies the conditions of the virial theorem. Later we'll have to see whether, and when, this assumption is justified.

We'll also assume we can treat the cloud as being in at least approximate thermal equilibrium, so that it has some temperature T. (Again, we'll have to question this assumption later.) Given this, the kinetic energy K is proportional to NT. It we use ~ to mean "proportional to, with a positive constant of proportionality", we can write this as follows:

K ~ NT
Putting these facts together we get
P ~ -NT                         (1)
But the potential energy P is proportional to -N2/R, where R is the radius of the ball:
P ~ -N2/R
and of course the volume is proportional to R3:
V ~ R3
P ~ -N2 / V1/3                   (2)
Now combining (1) and (2), we get
NT ~ N2 / V1/3
T ~ N / V1/3                     (3)
This describes how the cloud of gas gets hotter as it shrinks.

Now the entropy of an ideal gas is given by

S = kN [(3/2) ln T + ln (V/N)]
where k is Boltzmann's constant.

Here's how we can understand this formula: the 3/2 k ln T part comes from our ignorance of each atom's momentum, while the k ln (V/N) comes from our ignorance of each atom's position. (We use V/N instead of V here because the atoms are indistinguishable, so each one effectively roams over a volume V/N.) Finally, we multiply by the number of atoms, N, to get the total entropy of the gas cloud.

If we use (3) to write the temperature in terms of the volume, and also expand ln (V/N) in the obvious way, we get

S = kN [(3/2) ln N - (1/2) ln V + C + ln V - ln N] 
for some constant C. This simplifies to
S = kN [(1/2) ln N + (1/2) ln V + C]
and so we see the entropy DECREASES as the volume of the ball decreases.

Yikes! Does this mean that gravity violates the 2nd law of thermodynamics?

No, not really. Before we jump to that conclusion, we have to think a bit harder — there some things we still haven't taken into account.

You might want to guess what those things are. I'll eventually tell you. But before I do, let's go over the calculation we just did, and see exactly what it's saying. First of all, let's see exactly why the increasing uncertainty of the velocities of the atoms doesn't create enough entropy to counteract the decreasing uncertainty of their positions.

Entropy Calculation — Part 2

In the calculation I just did, it's a bit hard to see exactly why the entropy of the gas cloud goes down as it shrinks. As the gas cloud shrinks, each atom roams around a smaller region in position space. That tends to reduce the entropy. But as the gas cloud shrinks, it gets hot — so each atom roams around a bigger region in momentum space. That tends to increase the entropy.

To figure out which effect wins, we need to multiply the position space volume available to our atom by the momentum space volume available to it. This gives us the phase space volume that our atom can wander around in. The logarithm of this phase space volume, times Boltzmann's constant, is approximately the entropy per atom in our cloud.

So let's calculate these volumes.

We've already seen that the atoms in a gas cloud have a kinetic energy inversely proportional to its radius:

K ~ R-1
And since kinetic energy is proportional to velocity squared, this means that the average velocity of each atom in the cloud scales like
v ~ R-1/2
Thus each atom wanders around in a region in momentum space with volume
Vmomentum ~ R-3/2
On the other hand, it wanders around in a region in position space with volume equal to that of the cloud:
Vposition ~ R3
The phase space volume occupied by this atom is thus
Vphase ~ Vmomentum Vposition ~ R-3/2 R3 = R3/2
Here we see quite clearly how as the cloud shrinks, the position uncertainty the atoms decreases faster than the momentum uncertainty grows. This is why the entropy of the gas cloud decreases when the cloud shrinks.

(If you are a careful sort of person, you may want to compare our calculation here with the more careful one in the last section. Take the logarithm of the phase space volume I just computed and multiply it by Boltzmann's constant to get the entropy per atom. Then multiply by N, the number of atoms, to get a formula for the total entropy S of the gas cloud. This formula will be a bit different from the formula for S we got in the last section. It's a good exercise to figure out why. If you get get stuck, consult any good book on statistical mechanics, like this one:

This is my favorite introduction to the subject, and it's well worth reading.)

Negative Specific Heat

So far, we've seen the entropy of a gas cloud actually decreases as it collapses under its own gravity. At this point, you should be dying to see how I'm going to rescue the 2nd law of thermodynamics! But before I do that, I want to point out another odd fact: our gravitationally bound ball of gas has a negative specific heat! In other words, the less energy it has, the hotter it gets.

To see why, let's figure out the relation between the temperature and energy of this ball of gas. Remember, the virial theorem says that K = -P/2, so P = -2K, so the total energy of the gas ball is

E = K + P = -K
On the other hand, we've already said that
K ~ NT
so we must have
T ~ -E/N

Sounds paradoxical, eh?

It's not really so weird if you think about it. As the gas ball collapses, it loses energy: the kinetic energy goes up, but the potential energy goes down even faster! Since the kinetic energy goes up, the gas gets hot. Energy goes down, temperature goes up!

In fact, it's typical for a gravitationally bound system to have a negative specific heat. Imagine a satellite so low that it starts running into the earth's atmosphere and spiralling down. As it loses energy, it gets hotter, and finally burns up!

This feature of gravitationally bound systems makes them quite tricky. Only systems with positive specific heat can be in thermal equilibrium with their environment. So gravitationally bound systems can never be in thermal equilibrium with their environment! They always want to keep shrinking, thus losing energy and gaining entropy.

Ultimately they want to become black holes...

... and then things get a bit more complicated. It's probably best if you think about that on your own a bit.

For now, I just want to point out that these 3 facts are closely related:

The first one says that
dE/dR > 0                      (1)
where R is the radius of the cloud. The second one says that
dS/dR > 0                      (2)
The third one says that
dE/dT < 0                      (3)
If we divide (2) by (1) and use the definition of temperature, namely 1/T = dS/dE, we get T > 0. That's good — we already know the temperature of the gas cloud is positive. If we divide (1) by (3) we get dT/dR < 0. This is also good — we already know that the gas cloud gets hot as it shrinks.

It follows that though some of the inequalities (1)-(3) are a bit surprising, if we switched the direction of any one of these inequalities, we'd get a contradiction with things we know.

Saving the Second Law of Thermodynamics

As our gas cloud shrinks, its entropy goes down... so the entropy of something else must go up, or the 2nd law of thermodynamics is in deep trouble!

So: what is it whose entropy goes up?

Well, I said I'd tell you the answer to this puzzle, but by now I've had a change of heart. I had so much fun figuring out the answer myself that I'd hate to deprive you of this pleasure. So go ahead, figure it out. But if you give up, click here for a hint.

© 2000 John Baez