## Degrees of freedom: mechanical vs. thermal

One of the most important principles of thermodynamics is the *equipartition theorem*:

A system in thermodynamic equilibrium will have an internal thermal energy of in each degree of freedom.

But there's a subtlety here: what exactly are degrees of freedom? There are (at least) two slightly different kinds:

- A
**mechanical degree of freedom**is any way in which a system can freely change its spatial configuration - A
**thermodynamic degree of freedom**is any way in which a system can freely increase its stored energy

The degrees of freedom the equipartition theorem mentions are the thermodynamic variety. It's important to know this because the equipartition theorem predicts the heat capacity for many substances in the high-temperature limit, and if if you count the wrong kind of degrees of freedom, you'll get the wrong answer.

# Diatomic molecules

One simple example of this is a diatomic molecule. If you want to figure out how many *mechanical* degrees of freedom this molecule has, you just count up all the various distances that you need to completely specify the molecule's spatial configuration. They break down like this:

- Three positions , , to specify the center of mass of the molecule
- Two angles , to specify the orientation of the molecule (there is a third angle which only becomes relevant at high energies, but I'll ignore it for now)
- One distance to specify the separation between the atoms (the length of the chemical bond)

for a total of six mechanical degrees of freedom: three translation, two rotation, one vibration.

Alternatively, you could think of the molecule as two independent atoms, each with three position coordinates. That gives you six degrees of freedom, but you then have to subtract off the number of rigid constraints. For a diatomic molecule, there are none, but for a more complex molecule, you might have some constraints to deal with.

Especially given this latter interpretation, you might be surprised to find out that the internal energy of a diatomic gas is actually , which means there are actually 7 degrees of freedom. How is that possible, when the individual atoms only allow for 6?

As you might expect, the explanation for this "paradox" is that there are only 6 *mechanical* degrees of freedom, but that doesn't limit the number of *thermodynamic* degrees of freedom. The two kinds are completely different. You can't count thermodynamic degrees of freedom by just examining how the particles can move; instead, you need to look at the Hamiltonian and count up the quadratic terms.

The Hamiltonian for a diatomic molecule can be written in terms of the individual particle coordinates as

where is the equilibrium separation between the atoms. Alternatively, you can write it as

which clearly shows the difference between the translational energies (the first three terms), the rotational energies (the next two), and the vibrational energies (the last two, kinetic and potential respectively). There are seven terms in here, and according to the equipartition theorem, each of them represents an energy of .

# Directly calculating the energy

Even without counting terms, there is a way to see that this Hamiltonian corresponds to a system with seven thermodynamic degrees of freedom — or more precisely, to see that it stores on average. You just compute the expectation value of the energy stored in the system, over all possible thermodynamic states.

Here is the Hamiltonian for the state , and is a factor indicating the relative probability of state , which is the Boltzmann factor, . The method I'm about to describe comes from *An Introduction to Thermal Physics* by Daniel Schroeder.

Suppose we're using the first version of the Hamiltonian from above, where the variables are the individual positions and momenta of the two atoms. In this case, each state is identified by those variables, . Since these are continuous variables, I'll multiply both the top and bottom of by a product of very small increments, , and take the limit as all these increments go to zero:

is just a space-saving abbreviation for .

So how does one go about calculating this integral?

## Calculation of the partition function

Let's start with the denominator for simplicity. If you're not familiar with thermodynamics, take note that the denominator is the sum of the Boltzmann factor (the probability weight) over all possible states, and it is called the *partition function*. It's the first thing you calculate when solving any thermodynamic problem; you'll see why at the end of this post.

Because the Hamiltonian is a sum of terms, (I'll get to what and etc. are momentarily), we can break down the Boltzmann factor into a *product* of the corresponding individual Boltzmann factors, . And if each of those terms depends on different variables, that means the integral over all twelve variables breaks down into a product of some number of independent integrals, one for each piece of the Hamiltonian. Specifically, we can treat each of the momentum terms of the Hamiltonian as a separate "piece": and so on.

Each of the momentum integrals is a Gaussian integral, so each factor in parentheses works out to .

That takes care of the momentum-dependent pieces of the Hamiltonian, but what about the coordinate-dependent piece, the potential energy term? That one's trickier because you can't break it up into individual terms, each of which depends on only one coordinate. So we'll have to handle that integral some other way.

Fortunately, it's not that hard. In the other form of the Hamiltonian, the one which was broken up into translational, rotational, and vibrational terms, the potential energy term took a very simple form, , where is the distance between the atoms. That suggests that we should use a change of variables, where one of the new variables is this distance . For the other five new variables, I'll use the three coordinates of the center of mass position and two angles specifying the orientation of the molecule, , though as I'll show shortly, it doesn't even matter what those other variables are!

In order to do the integral in these coordinates, I'll need to calculate the Jacobian determinant for this change of variables.

You could calculate the value of that determinant using the definition

but it's not going to matter (and it'd be an ugly formula), so let's skip the calculation and just represent the (unknown) value as .

With the new coordinates, *now* I can break the position-space integral into factors depending on different variables:

The first of those factors is just another Gaussian integral (half-Gaussian, really), with a value of . The rest of them... well, they're technically infinite, but again, it's not going to matter! I'll just conveniently ignore it for now, and just lump all those infinite integrals along with the factor into one constant . Putting it all together, that gives the following expression for the partition function:

## Using the partition function

The reason the partition function is so useful is that you can get all sorts of useful thermodynamic quantities out of it by taking derivatives. For example, look at the following neat trick:

This last expression is exactly the numerator of the fraction we're trying to calculate! That means we can find the expectation value of the energy as

Putting in the expression for , you get

Now, the most important thing to notice about this is that *all the constants cancel out*. That's why it didn't matter what the Jacobian determinant was, and why it didn't matter that there were a bunch of infinite integrals involved in computing the constant , and in turn why it didn't matter what those other five position variables were. (If the infinite-ness of the integrals really bothers you, consider that they are really improper integrals, , and just defer taking the limit until *after* you calculate the ratio ; this keeps the integrals finite until all the unbounded factors have canceled out.) Because we were able to treat the Hamiltonian as a sum of quadratic terms, and to split the partition function into a separate factor for each quadratic term, we wound up with just a sum of a constant value, namely , for each of those terms.

The formula

can be used for any sort of Hamiltonian, by the way. For example, if you put in a Hamiltonian with a *linear* term, like , you'll find that that term contributes to the energy, not . Or you could put in some other Hamiltonian with a more complicated form, and in principle, as long as you can do the integral (or at least take its derivative with respect to , which may not even require doing the integral at all in some cases), you can determine its specific heat. In these more complicated cases, you have to get more creative as to how you define "thermodynamic degrees of freedom," because you can't split the Hamiltonian into terms each of which contributes to the energy — so the equipartition theorem, at least as stated at the top of this post, doesn't hold true anymore. But that's okay, because degrees of freedom aren't a physically measurable quantity. You can always calculate the relationship between the quantities you can actually measure, the energy and the temperature.