The energy of a quantum harmonic oscillator is given by: $$E(n)=\hbar\omega\left(n+\frac{1}{2}\right)$$
The canonical partition function is given by: $$Z(T)=\sum_{n=o}^\infty e^{-\beta E(n)}=\sum_{n=o}^\infty e^{\frac{-\beta \hbar\omega}{2}} e^{-\beta\hbar\omega n}=\sum_{n=o}^\infty e^\frac{-\beta \hbar\omega}{2} \left(e^{-\beta\hbar\omega}\right)^n=\sum_{n=o}^\infty \frac{e^{\frac{-\beta \hbar\omega}{2}}}{1-e^{-\beta\hbar\omega}}$$
The mean energy is given by $$U(T)=\left\langle E \right\rangle=\frac{1}{Z}\sum_{n=o}^\infty E(n) e^{-\beta E(n)}$$
The professor (Solid State Physics) asked us to calculate the mean energy.
For me the $Z$ and the $e^{-\beta E(n)}$ terms cancel each other, which leaves us only with $\sum_{n=o}^\infty E(n)$ which for me is equal to: $$\sum_{n=o}^\infty E(n)= \hbar\omega\left(\frac{1}{2}+\left\langle n \right\rangle\right) $$
The professor got to the same result but he wrote on the board: $$U(T)=\frac{\hbar\omega}{2}+\frac{\hbar\omega e^{-\beta\hbar\omega}}{1-e^{-\beta\hbar\omega}}=\hbar\omega\left(\frac{1}{2}+\left\langle n \right\rangle\right)$$
I would like to know where the $\frac{e^{-\beta\hbar\omega}}{1-e^{-\beta\hbar\omega}}$ term is coming from
Thanks