# Doubt in the expression of partition function of a general canonical ensemble

Suppose we have a system $$S$$ connected to a bath $$B$$. The combined system forms a microcanonical ensemble.
Suppose the energy of the combined system is $$E_T$$.
So, $$E_S+E_B=E_T$$.
The probability of finding the system $$S$$ in energy $$E$$ (or probability of finding a microstate of system corresponding to energy E) is
$$\rho(E)=$$ Probability of finding the bath in energy $$(E_T-E)\;\alpha\;\Omega_B(E_T-E)$$
$$\displaystyle\implies \rho(E)\;\alpha\;\Omega_B(E_T-E)\tag{1}$$
We consider bath to be huge and the system $$S$$ forms a tiny part of the combined system. So, $$E<. This means $$E_T\approx E_B$$
So, $$(1)$$ becomes
$$\displaystyle\rho(E)\;\alpha\;\Omega_B(E_B-E)\tag{2}$$
As $$E$$ is small, so we can do the Taylor expansion of the above expression around $$E_B$$ and retain only the first order terms.
Finally we get, $$\displaystyle\rho(E)=Ce^{-\frac{E}{k_BT}}\tag{3}$$
Here $$C$$ is the normalization constant.
We can find $$C$$ as follows
$$\displaystyle\sum_E\rho(E)=1=\sum_{\text{(All possible microstates)}}e^{-\frac{E}{k_BT}}=C\sum_E\Big(\sum_{\text{(All possible microstates with energy E)}}e^{-\frac{E}{k_BT}}\Big)=C\sum_E\Omega(E)e^{-\frac{E}{k_BT}}\tag{4}$$
We can define the partition function as
$$\displaystyle Z=\frac{1}{\sum_E\Omega(E)e^{-\frac{E}{k_BT}}}\tag{5}$$
So, $$\displaystyle\rho(E)=\frac{e^{-\frac{E}{k_BT}}}{Z}\tag{6}$$

Doubt

1. $$\rho(E)$$ by definition is $$\frac{\Omega(E)}{\sum_E\Omega(E)}$$
This is the probability of finding the sytem in macrostate $$E$$ or in other words, we can say that it is the probability of finding the system in a microstate corresponding to energy $$E$$ out of all the possible microstates that corresponds to different energies.
In $$(4)$$, on the $$RHS$$ why we are summing over all the possible microstates. I think that by the definition it should be just summing over all the energies E (macrostates).
Then $$\displaystyle Z=\frac{1}{\sum_{E}e^{-\frac{E}{k_BT}}}$$
I don't know what am I missing. Because in all the books, in partition function there is summing over all the possible microstates.

The probability of finding the system $$S$$ in a particular microstate $$\mu$$ which has energy $$\epsilon(\mu)$$ is $$\mathrm{Prob}(\mu) = \frac{\Omega_B\big(E-\epsilon(\mu)\big)}{\Omega_{tot}}$$ where $$\Omega_B(E)$$ is the number of microstates of the bath with energy $$E$$ and $$\Omega_{tot}$$ is the total number of microstates of the system+bath. We then have $$\log\big[\mathrm{Prob}(\mu)\big] = \log\big[\Omega_B\big(E-\epsilon(\mu)\big)\big] - \log\big[\Omega_{tot}\big]$$ $$\approx \log\big[\Omega_B(E)/\Omega_{tot}\big] - \underbrace{\frac{\Omega_B'(E)}{\Omega_B(E)}}_{\equiv 1/kT} \epsilon(\mu)$$ $$\implies \mathrm{Prob}(\mu) = C e^{-\epsilon(\mu)/kT}$$
That is, the probability of the microstate $$\mu$$ is equal to some constant $$C$$ times the usual Boltzmann factor. To determine the constant $$C$$, we require that the sum of the probabilities of all of the microstates is equal to $$1$$, yielding $$C = 1/Z, \qquad Z= \sum_{\mu} e^{-\epsilon(\mu)/kT}$$
It is true that for many of those microstates, $$\epsilon(\mu)$$ will be the same. As a result, we could re-write this by summing over all system energies $$\mathcal E$$ and weighting each factor by the number of microstates with that energy $$g(\mathcal E)$$: $$Z = \underbrace{\sum_\mu e^{-\epsilon(\mu)/kT}}_{\text{sum over microstates}} = \underbrace{\sum_\mathcal E g(\mathcal E) e^{-\mathcal E/kT}}_{\text{sum over energies}}$$
• "Now, probability of finding the system in energy 𝐸 is same as probability of finding that microstate of system that is associated with energy E out of all the possible microstates." This incorrect. The probability of finding the system with energy $E$ is equal to the probability of finding the system in any of the microstates with energy $E$ - which is given by the probability of finding the system in one of those microstates ($e^{-\mathcal E/kT}$) multiplied by the number of microstates with that energy ($g(\mathcal E)$). Commented Oct 19, 2022 at 13:37
• In my answer, probabilities are associated with microstates, not with energies. If you want to compute the probability of a particular energy, then you can simply add up the probabilities of all of the microstates with that energy as said above to yield $g(\mathcal E)e^{-\mathcal E/kT}=e^{-(\mathcal E-TS)/kT} = e^{-F/kT}$, where $g \equiv e^{S/k}$ and $F=\mathcal E-TS$ is the Helmholtz energy. Commented Oct 19, 2022 at 13:41
• "$\rho(E)$ by definition is $\frac{\Omega(E)}{\sum_E\Omega(E)}$ This is the probability of finding the sytem in macrostate $E$" This is wrong. You are appealing to the microcanonical probability distribution, but that no longer applies to the system alone. You need to include the microstates of the bath. The probability of finding the system with energy $E$ is $\Omega_{sys}(E)\Omega_B(E_T-E)/\Omega_{tot}$. Commented Oct 19, 2022 at 13:46
• @Iti I don't know how to explain it more clearly than I already have. You are saying that $\rho(E) = \Omega(E)/\sum_{E'}\Omega(E')$. The denominator of that expression is simply the total number of microstates of any energy which are accessible to the system, while $\Omega(E)$ is the number of microstates of the system with energy $E$. This is not true. That probability distribution comes from the microcanonical ensemble, where the probability is simply proportional to the number of microstates. In the canonical ensemble, the probability that the system occupies any particular [...] Commented Oct 20, 2022 at 6:27
• [...] microstate is proportional to $e^{-E/kT}$, where $E$ is the energy of that microstate. The exact probability is $e^{-E/kT}/ Z$, where $Z= \sum_{microstates} e^{-E/kT}$ and the sum over microstates (not energies!) is necessary in order for the total probability of all of the microstates to add up to 1. Commented Oct 20, 2022 at 6:30