Last time I ended with a formula for the ‘Gibbs distribution’: the probability distribution that maximizes entropy subject to constraints on the expected values of some observables.
This formula is well-known, but I’d like to derive it here. My argument won’t be up to the highest standards of rigor: I’ll do a bunch of computations, and it would take more work to state conditions under which these computations are justified. But even a nonrigorous approach is worthwhile, since the computations will give us more than the mere formula for the Gibbs distribution.
I’ll start by reminding you of what I claimed last time. I’ll state it in a way that removes all unnecessary distractions, so go back to Part 20 if you want more explanation.
The Gibbs distribution
Take a measure space with measure Suppose there is a probability distribution on that maximizes the entropy
subject to the requirement that some integrable functions on have expected values equal to some chosen list of numbers
(Unlike last time, now I’m writing and with superscripts rather than subscripts, because I’ll be using the Einstein summation convention: I’ll sum over any repeated index that appears once as a a superscript and once as a subscript.)
Furthermore, suppose depends smoothly on I’ll call it to indicate its dependence on Then, I claim is the so-called Gibbs distribution
where
and
is the entropy of
Let’s show this is true!
Finding the Gibbs distribution
So, we are trying to find a probability distribution that maximizes entropy subject to these constraints:
We can solve this problem using Lagrange multipliers. We need one Lagrange multiplier, say for each of the above constraints. But it’s easiest if we start by letting range over all of that is, the space of all integrable functions on Then, because we want to be a probability distribution, we need to impose one extra constraint
To do this we need an extra Lagrange multiplier, say
So, that’s what we’ll do! We’ll look for critical points of this function on
Here I’m using some tricks to keep things short. First, I’m dropping the dummy variable x which appeared in all of the integrals we had: I’m leaving it implicit. Second, all my integrals are over so I won’t say that. And third, I’m using the Einstein summation convention, so there’s a sum over i implicit here.
Okay, now let’s do the variational derivative required to find a critical point of this function. When I was a math major taking physics classes, the way physicists did variational derivatives seemed like black magic to me. Then I spent months reading how mathematicians rigorously justified these techniques. I don’t feel like a massive digression into this right now, so I’ll just do the calculations—and if they seem like black magic, I’m sorry!
We need to find obeying
or in other words
First we need to simplify this expression. The only part that takes any work, if you know how to do variational derivatives, is the first term. Since the derivative of is we have
The second and third terms are easy, so we get
Thus, we need to solve this equation:
That’s easy to do:
Good! It’s starting to look like the Gibbs distribution!
We now need to choose the Lagrange multipliers and to make the constraints hold. To satisfy this constraint
we must choose so that
or in other words
Plugging this into our earlier formula
we get this:
Great! Even more like the Gibbs distribution!
By the way, you must have noticed the “1” that showed up here:
It buzzed around like an annoying fly in the otherwise beautiful calculation, but eventually went away. This is the same irksome “1” that showed up in Part 19. Someday I’d like to say a bit more about it.
Now, where were we? We were trying to show that
minimizes entropy subject to our constraints. So far we’ve shown
is a critical point. It’s clear that
so really is a probability distribution. We should show it actually maximizes entropy subject to our constraints, but I will skip that. Given that, will be our claimed Gibbs distribution if we can show
This is interesting! It’s saying our Lagrange multipliers actually equal the so-called conjugate variables given by
where is the entropy of
There are two ways to show this: the easy way and the hard way. The easy way is to reflect on the meaning of Lagrange multipliers, and I’ll sketch that way first. The hard way is to use brute force: just compute and show it equals This is a good test of our computational muscle—but more importantly, it will help us discover some interesting facts about the Gibbs distribution.
The easy way
Consider a simple Lagrange multiplier problem where you’re trying to find a critical point of a smooth function
subject to the constraint
for some smooth function
and constant c. (The function f here has nothing to do with the f in the previous sections.) To answer this we introduce a Lagrange multiplier and seek points where
This works because the above equation says
Geometrically this means we’re at a point where the gradient of points at right angles to the level surface of
Thus, to first order we can’t change by moving along the level surface of
But also, if we start at a point where
and we begin moving in any direction, the function will change at a rate equal to times the rate of change of . That’s just what the equation says! And this fact gives a conceptual meaning to the Lagrange multiplier
Our situation is more complicated, since our functions are defined on the infinite-dimensional space and we have an n-tuple of constraints with an n-tuple of Lagrange multipliers. But the same principle holds.
So, when we are at a solution of our constrained entropy-maximization problem, and we start moving the point by changing the value of the ith constraint, namely the rate at which the entropy changes will be times the rate of change of So, we have
But this is just what we needed to show!
The hard way
Here’s another way to show
We start by solving our constrained entropy-maximization problem using Lagrange multipliers. As already shown, we get
Then we’ll compute the entropy
Then we’ll differentiate this with respect to and show we get
Let’s try it! The calculation is a bit heavy, so let’s write for the so-called partition function
so that
and the entropy is
This is the sum of two terms. The first term
is times the expected value of with respect to the probability distribution all summed over But the expected value of is so we get
The second term is easier:
since integrates to 1 and the partition function doesn’t depend on
Putting together these two terms we get an interesting formula for the entropy:
This formula is one reason this brute-force approach is actually worthwhile! I’ll say more about it later.
But for now, let’s use this formula to show what we’re trying to show, namely
For starters,
where we played a little Kronecker delta game with the second term.
Now we just need to compute the third term:
Ah, you don’t know how good it feels, after years of category theory, to be doing calculations like this again!
Now we can finish the job we started:
Voilà!
Conclusions
We’ve learned the formula for the probability distribution that maximizes entropy subject to some constraints on the expected values of observables. But more importantly, we’ve seen that the anonymous Lagrange multipliers that show up in this problem are actually the partial derivatives of entropy! They equal
Thus, they are rich in meaning. From what we’ve seen earlier, they are ‘surprisals’. They are analogous to momentum in classical mechanics and have the meaning of intensive variables in thermodynamics:
Classical Mechanics | Thermodynamics | Probability Theory | |
q | position | extensive variables | probabilities |
p | momentum | intensive variables | surprisals |
S | action | entropy | Shannon entropy |
Furthermore, by showing the hard way we discovered an interesting fact. There’s a relation between the entropy and the logarithm of the partition function:
(We proved this formula with replacing but now we know those are equal.)
This formula suggests that the logarithm of the partition function is important—and it is! It’s closely related to the concept of free energy—even though ‘energy’, free or otherwise, doesn’t show up at the level of generality we’re working at now.
This formula should also remind you of the tautological 1-form on the cotangent bundle namely
It should remind you even more of the contact 1-form on the contact manifold namely
Here is a coordinate on the contact manifold that’s a kind of abstract stand-in for our entropy function
So, it’s clear there’s a lot more to say: we’re seeing hints of things here and there, but not yet the full picture.
For all my old posts on information geometry, go here:
There’s a generalization of the KL-divergence to non-probability measures that goes
This solves a lot of annoying constant factors when varying. Since the KL-divergence with gives the entropy, presumably the generalization of entropy is:
which would solve your extra one. But I can’t say I’ve really understood how to think of this generalization.
I’ve used this generalization of the Kullback–Leibler divergence myself—see equation (21) in this paper:
• John Baez and Blake Pollard, Relative information in biological systems.
(I call the Kullback–Leibler divergence ‘relative information’.)
And yes, it helps! But this generalization is still somewhat mysterious to me. It’s sometimes used in mathematical chemistry where instead of normalized probability distributions we have ‘populations’, e.g. numbers of molecules—I believe it was introduced there by Horn and Jackson. Have you seen it somewhere else?
I first saw it referred to in some work by Csiszar. A little googling gives this as maybe the origin, but I haven’t read it yet.
It occurs to me that this form of the KL-divergence is also what arises when you calculate the Bergman divergence of the usual entropy formula, but I can’t say I really understand Bregman divergences either :).
Okay, thanks—that’s interesting. Horn and Jackson introduced it in chemistry in 1972 and called it the “pseudo-Helmholtz function”:
• F. Horn and R. Jackson, General mass action kinetics,
Arch. Ration. Mech. An. 47 (1972), 81–116.
It plays an important role as a Lyapunov function in chemical reaction networks that are ‘complex balanced’.
If you also have a timescale measuring something like the growth rate of orbits or a mixing time to go along with the probability setup (say, in the case that the distribution arises from a Markov process), then you do have energy at this level of generality: see section 3 of https://arxiv.org/abs/2104.00753. The caveat here is that the precise nature of the timescale to generically reproduce physics isn’t completely nailed down, but it’s very highly constrained. Moreover, a “minimum channel capacity” Ansatz in the case of a Markov process (unpublished, but I have a writeup) suggests a general principle for determining this timescale.
I feel like maybe I didn’t make myself clear.
There’s no concept of “time” in what I’m talking about, and no Markov process. I’ve just got a probability distribution maximizing entropy subject to constraints on expected values of some finite list of random variables (aka observables).
But this subsumes the case where we call one those observables “energy”. In this case the conjugate intensive variable is where is the temperature and is Boltzmann’s constant, and then is free energy.
So, I was trying to say we can easily specialize the framework described here to relate to free energy, but that deserves some other name when we’re working at the level of generality described here.
I believe in quantum field theory people sometimes call “free energy” even in contexts where it deserves some other name.
Re your comment that
Is there a half-way decent textbook that explains that?
Thanks.
There must be a bunch, but I forget where I learned this stuff—probably here and there. It can’t hurt too much to start here:
• Wikipedia, Functional derivative.
They recommend a bunch of textbooks, starting with Courant and Hilbert and working on up to Gelfan’d and Fomin, which is a Dover book—so fairly cheap, I imagine. All four of these folks are famous.
Very interesting.
Courant and Hilbert? How classical can you get :-) Looks like the DWM haven’t been made obsolete quite yet.
I’m kind of amazed this isn’t covered by a more modern, mainstream textbook from some place like Springer. Maybe it is. Hopefully someone can make a suggestion.
Oh wait, I see it is … The text
Giaquinta, Mariano; Hildebrandt, Stefan (1996), Calculus of Variations 1. The Lagrangian Formalism.
Geometric Structures of Information Geometry is adressed in GSI conferences:
https://franknielsen.github.io/GSI/
Thanks!
It would be nice to some women. Can’t you figure out an excuse to, at least, get Emmy Noether in there.