I derived the averaged energy for phonon mode with frequency $\omega$ in canonical ensemble and in grand canonical ensemble.
Averaged energy derived in canonical ensemble is $E_c=\frac{1}{2}\hbar\omega+\frac{\hbar\omega}{e^{\hbar\omega\beta}-1}$.
Averaged energy derived in grand canonical ensemble is $E_g=\sum_{n=0}^{\infty}\frac{\hbar\omega(n+1/2)}{e^{\hbar\omega\beta(n+1/2)-1}}$.
I believe they should be the same, since observable quantity should be independent of the ensemble we choose. But how to show they are the same??
(In the following, I provide my derivation of the averaged energy.
The partition function in canonical ensemble is
$Z_c=\sum_{n=0}^{\infty}e^{-\hbar\omega\beta(n+1/2)}=\frac{e^{-\hbar\beta\omega/2}}{1-e^{\hbar\omega\beta}}$, so $E_c=-\frac{\partial}{\partial\beta}\ln Z_c=\frac{1}{2}\hbar\omega+\frac{\hbar\omega}{e^{\hbar\omega\beta}-1}$.
The partition function in grand canonical ensemble is
$Z_g=\Pi_{n=0}^{\infty}\sum_{a=0}^{\infty}e^{-\beta\omega\hbar(n+1/2)a}=\Pi_{n=0}^{\infty}\frac{1}{1-e^{-\hbar\omega\beta(n+1/2)}}$, so $E_g=-\frac{\partial}{\partial\beta}\ln Z_g=\sum_{n=0}^{\infty}\frac{\hbar\omega(n+1/2)}{e^{\hbar\omega\beta(n+1/2)-1}}$. Where a is the occupation number for each energy level.)
Thank you in advance.