# How to reproduce free energy in canonical ensemble in stat mech

Given a quantum mechanical density matrix $$\rho$$, the internal energy and entropy of the system is given by:

\begin{align} E &= \text{Tr}[H \rho] \\ S &= -k_B \, \text{Tr}[\rho \ln \rho] \end{align}

where $$H$$ is the quantum mechanical Hamiltonian.

Then, I can minimize the Free Energy $$F = E - TS$$ to deduce the form of $$\rho$$:

\begin{align} \delta F &= \text{Tr}(\delta \rho (H+ k_B T \ln\rho+k_BT)) = 0\\ &\Rightarrow \rho = \mathcal{N}e^{-H/k_B T} \end{align}

But then, when I insert this back into $$F$$, I don't get the usual formula

$$F = -T \ln(\text{Tr}[e^{-H/k_B T}])$$

Instead I get zero. Can someone help me out with what went wrong? Thanks

• Did you get term $k_BT\rho \ln N$ there? This should not be cancelled by any other term. – Ján Lalinský Aug 2 at 22:33

You've probably forgotten about $$\cal{N}$$ in $$\ln \rho$$.
$$\rho = {\cal{N}} e^{- H /k_B T}\ \longrightarrow\ \ln\rho = -H/k_BT + \ln{\cal{N}}\ \longrightarrow\ TS = \mbox{Tr}[\rho H] -k_BT\ln{\cal N}\ \longrightarrow$$ $$F = k_BT\ln{\cal N}.$$ Here $${\cal N}$$ is the normalization constant $${\cal N} = \left(\mbox{Tr} e^{-H/k_BT} \right)^{-1}.$$ The usual formula follows from two last equations