# Need verification for the entropy equation in statistical thermodynamics

The relationship between entropy $$S$$, the total number of particles $$N$$, the available energy levels $$E_j$$ and a yet to be defined parameter $$\beta$$ is: $$S(\beta)=k_B \cdot N \cdot \ln\bigg(\sum_{j=1}^n[e^{\beta E_j}]\bigg) - k_B\cdot \beta \sum_{j=1}^n\bigg[\frac{N}{\sum_{i=1}^n [e^{\beta E_i}]}\cdot e^{\beta E_j}\cdot E_j\bigg]$$ The partition function $$Z$$ and the total energy $$U$$ as functions of $$\beta$$ are: $$\sum_{j=1}^n[e^{\beta E_j}] = Z(\beta) \tag{1}$$ $$\sum_{j=1}^n\bigg[\frac{N}{\sum_{i=1}^n [e^{\beta E_i}]}\cdot e^{\beta E_j}\cdot E_j\bigg]=U(\beta) \tag{2}$$

I need to first derive $$\frac{dS}{d\beta}$$ and then substitute parameters within $$\frac{dS}{d\beta}$$ with $$\frac{dZ}{d\beta}$$ and $$\frac{dU}{d\beta}$$ if there are any. I came up with the following: $$\frac{dS}{d\beta}=k_B\cdot \beta \cdot \bigg(\frac{d\big(\ln(Z)\big)}{d\beta}\cdot U - \frac{dU}{d\beta}\bigg)$$ However, I am not sure if this derivation is correct and would really appreciate a verification on this.

$$S(\beta) = k_B \cdot N \cdot \ln(Z(\beta)) - k_B\cdot \beta \cdot U(\beta).$$ $$U(\beta) = \sum_{j=1}^n\bigg[\frac{N}{\sum_{i=1}^n [e^{\beta E_i}]}\cdot e^{\beta E_j}\cdot E_j\bigg] = \frac{N}{\sum_{i=1}^n [e^{\beta E_i}]}\,\sum_{j=0}^{n} e^{\beta\,E_j}\cdot E_j = \frac{N}{Z(\beta)} \sum_{j=0}^{n} e^{\beta\,E_j}\cdot E_j$$ $$\frac{dZ}{d\beta} = \sum_{j=0}^{n} e^{\beta\,E_j}\cdot E_j = \frac{U(\beta)\cdot Z(\beta)}{N}$$ $$\frac{dS}{d\beta}=k_B\cdot \left( N\cdot\frac{d\left(\ln(Z)\right)}{d\beta} - U - \beta \cdot \frac{dU}{d\beta}\right)$$ $$\frac{dS}{d\beta}=k_B\cdot \left( \frac{N}{Z}\cdot\frac{dZ}{d\beta}-U-\beta\cdot\frac{dU}{d\beta} \right)$$ $$\frac{dS}{d\beta}= k_B\cdot \left( \frac{N}{Z}\cdot\frac{U\cdot Z}{N}-U-\beta\cdot\frac{dU}{d\beta} \right) = -\beta\cdot k_B\cdot \frac{dU}{d\beta}$$

Your first term vanished somewhere in my solution. I cannot tell where either of us did a mistake without comparing solutions.

## Part II

Counting in degeneracy: $$S=k_B\bigg(N \cdot \ln(Z(\beta)) - \beta U(\beta) + \ln(\frac{N}{Z(\beta)}) \cdot N - \frac{N^2}{Z(\beta)}\bigg)$$ which has the last two terms in addition to the non-degenerate solution. So let's just solve for these two (using the fact that $$\ln(a/b)=\ln(a)-\ln(b)$$): $$\frac{d}{d\beta}\left( k_B\cdot\left[ N \cdot \ln(\frac{N}{Z(\beta)}) - \frac{N^2}{Z(\beta)} \right] \right) = k_B\cdot\left( - N \cdot\frac{1}{Z}\frac{dZ}{d\beta} + \frac{N^2}{Z^2}\cdot\frac{dZ}{d\beta} \right)$$ $$= k_B \cdot\frac{dZ}{d\beta}\cdot\frac{N}{Z}\cdot\left( \frac{N}{Z} - 1 \right) = k_B \cdot\frac{U\cdot Z}{N}\cdot\frac{N}{Z}\cdot\left( \frac{N}{Z} - 1 \right)$$ $$= k_B \cdot U(\beta) \cdot\left( \frac{N}{Z(\beta)} - 1 \right)$$

Therefore, overall derivative considering degeneracy is: $$\frac{dS}{d\beta} = k_B\cdot\left( - \beta\cdot\frac{dU}{d\beta} + \frac{U(\beta)\cdot N}{Z(\beta)} - U(\beta) \right)$$

So, no, unless you have a partition function of constant value $$N$$, factoring in degeneracy changes the outcome.

• Thank you so much. The error was at my end and your answer makes sense to me. One last question though. This formula does not take the degeneracy of quantums states into account. If it did, then the entropy $S$ would be $S=k_B\bigg(N \cdot \ln(Z(\beta)) - \beta U(\beta) + \ln(\frac{N}{Z(\beta)}) \cdot N - \frac{N^2}{Z(\beta)}\bigg)$. Will $\frac{dS}{d\beta}$ in this case give the exact same formula? Looking forward to your reply regarding this. – JohnnyGui May 27 at 20:06
• @JohnnyGui There you go, spoilers: Not always. – acarturk May 27 at 21:42
• Once again, thanks a ton. If I understand you correctly, you're saying that degeneracy won't change the outcome if $N$ is constant? If so, I can not see how the formula then simplifies to the previous one when degeneracy is not taken into account. – JohnnyGui May 27 at 22:29
• @JohnnyGui No problem. No, not if $N$ is a constant, but rather if $Z(\beta)$, i.e. the partition function, always equals $N$, a constant itself. I don't know how this condition can be satisfied, I am not well-rehearsed in stat mech that much, but if we get this, the 2nd and 3rd terms cancel each other out. – acarturk May 27 at 22:46
• Ah I got you now. From what I know, $Z(\beta)$ will never be $N$. I find this derivation when degeneracy is taken into account rather peculiar because in this case $\beta$ is not equal to $-\frac{1}{k_BT}$ while it should, based on the equation $dS = \frac{dU}{T}$ – JohnnyGui May 27 at 22:59