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