Alternate definitions of Thermal states The definition of thermal states I'm used to is:
$$\tau_{\beta} = \frac{1}{Z}\,e^{-\beta H}$$
where $Z$ is the partition function defined as $Z= \mathrm{Tr}(e^{-\beta H})$, $\beta$ the inverse temperature and H the system's Hamiltonian. I think if the Hamiltonian is not time dependent $H=\sum_n \varepsilon_n |n\rangle\langle n|$ I can rewrite the thermal state
$$\tau_{\beta_1} = \frac{1}{Z}e^{-\beta H} = \frac{1}{Z}\exp\left(-\beta \sum_n \varepsilon_n |n\rangle\langle n|\right) = \frac{1}{Z}\sum_ne^{-\beta  \varepsilon_n} |n\rangle\langle n| .$$
Is this calculation correct?
In case it is correct, I just came across another version of it (I believe) 
$$\tau_{\beta_2} = (1-e^{-\beta \omega}) \sum_n e^{-n\beta\omega}| n\rangle\langle n|$$
where $\omega$ is the frequency of some harmonic oscillator.
Can someone explain to me how these two definitions $(\tau_{\beta_1}$ and $\tau_{\beta_2})$ relate to each other? 
 A: Your second version of the density operator is the specific case in which the Hamiltonian is that of a simple quantum harmonic oscillator, namely
$$H=\hbar\omega\left(a^{\dagger}a+\frac{1}{2}\right).$$
In terms of this Hamiltonian, the energy levels are (setting $\hbar=1$) $\varepsilon_n=\omega(n+1/2)$. Thus, the partition function is
$$Z=\sum_{n\geq 0}e^{-\beta\omega(n+1/2)}=\frac{e^{-\beta\omega/2}}{1-e^{-\beta\omega}}.$$
Thus, the density operator is given by
$$\tau_{\beta}=\frac{1}{Z}\sum_{n\geq 0}e^{-\beta\omega(n+1/2)}\,|n\rangle\langle n|=(1-e^{-\beta\omega})\sum_{n\geq 0}e^{-\beta\omega n}\,|n\rangle\langle n|,$$
as stated.
A: I would call this the (normalized) density operator (or density matrix), in which case, yes, I think the expressions are correct.
For the quantum harmonic oscillator, in units where $\hbar=1$, and measuring energies from the ground state energy, the energy levels are $\varepsilon_n=n\omega$ for $n=0,1,2,\ldots$ and the partition function is 
$$
Z=\sum_{n=0}^\infty \exp(-n\beta\omega) = \frac{1}{1-\exp(-\beta\omega)} .
$$
So everything is fine: the second formula is a particular example of the first.
