# Canonical partition function and counting

That's a silly silly question, so my apologies, but in this moment I could not reach out!

Let's have a system made of a particle reservoir $R$, and a subsystem $S$. The total particle number is $N$. The total hamiltonian is $H$, the hamiltonian of the reservoir is $H_R$, and that of the subsystem is $H_S$, so that $H = H_S + H_R$.

The canonical function of the whole system could be written as:

$\mathscr Z = 1/ N! h^{3N} \int e^{\beta H_S+H_R} dp dq$

Now suppose that the subsystem contains $0$ particles, so $H=H_R$: what is the difference between the partition function for the system as a whole, and the function $\mathscr Q = 1/ N! h^{3N} \int e^{\beta H_R} dp_R dq_R$?

Hint: could it be that in fact $H$, $H_S$ and $H_R$ are the same function, just with different constants, i.e. $H_S=H(V_S)$ and $H_R=H(V_R)$, where $V_S$ is the system volume, and the other the reservoir's? But in which way it could affect the integrals above?

Statistical mechanics offers us different tools for different types of systems. The microcanonical ensemble describes a system $S$ with fixed energy $U$, particle number $N$, and volume $V$. The canonical ensemble consists of a reservoir $R$ with fixed volume $V_R$, particle number $N_R$, and temperature $T_R$ and a system $S$ with fixed volume $V_S$ and particle number $N_S$. The two are separated by a stiff barrier that allows energy transfer. Thus, typically in canonical ensembles we're interested in the average energy, $\bar{E}$ of the system. The grand canonical ensemble is similar to the canonical ensemble except that it allows particle transfer, so the overall particle number $N$ is fixed but the number in the reservoir is not--here, the chemical potential $\mu_R$ is fixed for the reservoir. Typically, we're interested in the average particle number $\bar{N}$ of a grand canonical ensemble.
Your question is not quite fully formed because you're asking about the partition function of a system that allows particle transfer. As such a system is actually a grand canonical ensemble, it's described by a grand partition function $\mathscr{Z} = \sum_se^{-\beta(\epsilon_s - \mu N_s)}$, where $s$ is the index of states of the system, $\epsilon_s$ is the energy of the state, and $N_s$ is the number of particles in the state. Gibbs statistics doesn't describe the dynamics of the reservoir, which is assumed to be large enough that small energy fluctuations don't affect its temperature or chemical potential.
Finally, you ask about the grand partition function of the reservoir + system, which doesn't make so much sense because if you combine the two then you have a microcanonical ensemble of fixed energy $U$.
I'll answer my own question. The hint I've added in the end brings on the right path: in fact, even in the situation in which all the system's particles are stored in the reservoir, the integral $\mathscr Q = 1/ N! h^{3N} \int e^{\beta H_R} dp_R dq_R$ is performed just on the volume $V_R$, so the proper way to write the equation above is $\mathscr Q = 1/ N! h^{3N} \int_{V_R} e^{\beta H_R} dp_R dq_R$, so in general $\mathscr Z \neq \mathscr Q$