The Grand Partition Function
We let particles flow freely and ask what happens to the partition function — turns out there's a grand version Z_G derived straight from entropy!
Lots of state functions do differ between when particle inflow/outflow isn’t allowed and when it is, and the difference turned out to be $\mu\,dN$. So now I want to talk about the partition function too.
Wouldn’t the partition function also be different when particle inflow/outflow isn’t allowed and when it is??
We touched on the meaning of $Z$ back in chapter 21, and that meaning was “the size of the probability distribution.”

When particle inflow/outflow isn’t allowed, the partition function was defined like this. Now let’s allow particles to flow in and out.

When particles can flow in and out, how will the partition function be defined??
It’s called the Grand Partition Function,
, and it turns out this
is derived using entropy?? Let’s follow along!!

When only energy is exchanged, the thing that moves is energy, so with $\Omega$, the number of possible microstates for that energy, we drew the picture above and derived the probability of the system being in a state with energy $\varepsilon$: Temperature (Thermal & Statistical Mechanics I Studied #4). But from now on particles can flow in and out too, so both $E$ and $N$ can be exchanged.

So this time we draw it like this, and instead of the variable $\Omega$ we use the variable $S$!! We are finding the probability of one particular microstate. To get the probability of an energy-and-particle-number pair, we would sum over all microstates with that pair. But $\Omega$ will definitely depend on the variables $E$ and $N$, so surely the probability that the system is in a state with $E = \varepsilon$ and $N = N$,
, is proportional to the number of microstates the reservoir has at
,
?! That is,
![]()
it should be.
Okay, and now back to the main point: which way maximizes $S$~~ Let’s gogo and develop it with this logic. To do that, there’s some background knowledge we need to have in hand first.
Two-variable Taylor series expansion

Now when we use this as an approximation, we just throw away the dot-dot-dot at the end, right?

Expanding the reservoir’s entropy
With this laid down as background, I’ll go with the same logic as Temperature (Thermal & Statistical Mechanics I Studied #4), so it might be a good idea to look at that part for reference and then come back.
I’m going to set up the reservoir’s $S$, and approximate
to get the approximation for the situation
. Here the system’s energy and particle number are small compared with the reservoir totals — not literally zero. To make it easier to follow,


I’ll approximate only this far. And now I’ll put the red substituted variables back the way they were.



That’s what we’ve tidied up so far?! Alriiight.
Now let’s play a few tricks on what we’ve tidied up.


Then let me write it out again.

Why did I derive this relation?
Because now I want to define the partition function in the Grand canonical ensemble!! The definition of the partition function is

where $\alpha$ labels the energy states… anyway, that’s what it was. But now that the variables $\mu$ and $N$ that determine the energy have been added, the statistical weight now involves $E_\alpha-\mu N_\alpha$, rather than $E_\alpha$ alone. The physical energy is still $E_\alpha$.
(Actually you’ve a~~~ll caught on already from earlier, lol: that form is what goes in.)
But first, let me nail down some, uh.. terminology before we go in. A collection of “systems that can exchange energy and particles” is called the grand canonical ensemble, right? The partition function for those systems gets the special name Grand Partition Function.
So, where are we going to put the relation above,

to use?
![]()
Right here.
If it’s not clear how this relation holds, please check out Temperature (Thermal & Statistical Mechanics I Studied #4)~
Slam it into that relation:

So

Phew, all derived~
This distribution works on the same principle as the Boltzmann distribution, but it gets its own name: the Gibbs distribution.
The Grand Partition Function
Now that we’ve got the probability distribution, we’ve taken a big step toward the partition function!! Let’s keep going!!
To say it once more: the partition function was all about the size of the probability distribution. It is the sum of the statistical weights, the factor that makes all the probabilities add up to one — not a count of coin-toss trials. And what we tidied up above is exactly the probability distribution for a system that can exchange both energy and particles!!
Now let me change the notation.

And writing it as an equation,

What does it mean?! The probability that, at temperature $T$, the system is in a state with energy $E$ and, at that moment, $N$ particles!!
Okay, now we can define the partition function. The probability that the energy is
and the number of particles is
can be written like this.

So that guy down there in the denominator is what we can call the partition function, right?! The size of the probability distribution!!
That is,

the Grand Partition Function.
Tying in the internal energy
Now that we know the partition function, there’s so, so much we can do!! Once you nail down the partition function~ you can derive lots of state functions!!
First, shall we tie the internal energy of a system with particle inflow/outflow to the partition function? In these thermodynamic formulas, $N$ means the mean $\langle N\rangle$; the actual particle number fluctuates. First, here’s how we tied them together when particle inflow/outflow wasn’t allowed:

That’s how we tied them.
So in a system with particle inflow/outflow, will simply saying
do the job?!
Nope… it doesn’t work. Doesn’t work. It’s actually
![]()
though.
This one seems kind of hard to interpret in terms of meaning. Because the rate of change of the partition function, and a partition function with a log taken on top of that… I think it’s a form that’s hard to take in as meaning.
So I’m thinking I’ll prove the formula above mathematically. Pulling the right side apart and differentiating with respect to $\beta$ isn’t that hard, right?! Then let’s gogo.


The other free-energy state functions for when particles flow in and out, I’ll derive in the next post!!~~
Heads-up. The figures here are the original notes, slips and all. A few things to watch for:
- In the step-by-step derivation of $\Omega(U_G - \varepsilon, N_G - N)$, the fifth line should read $k_B\ln\left(\Omega(U_G, N_G)\,e^{-(\varepsilon - \mu N)/k_BT}\right)$, with the $\ln$ in front of the whole product; the final line is right.
- In the formula for $p(E_j, N_j)$, every exponent should read $(E_j - \mu N_j)$, not $(E_j - \mu E_j)$, as in $Z_G = \sum_j e^{-(E_j - \mu N_j)/k_BT}$ right after it.
- In the reminder of $U = -\frac{d\ln Z}{d\beta}$, the exponents carry the index $i$: $e^{-E_i/k_BT}$ and $e^{-\beta E_i}$.
- The last line of the internal-energy proof has both signs flipped: it should read $U_G = \mu N - \left(\frac{\partial \ln Z_G}{\partial \beta}\right)_\mu$, as stated just before the proof (since $-\left(\frac{\partial \ln Z_G}{\partial \beta}\right)_\mu = U - \mu N$).
Comments
Discussion happens via GitHub Discussions. You'll need a GitHub account to comment.