I have been working through the derivation of the partition function expressed as a path integral in terms of coherent states, following the many-body condensed-matter field theory books of Altland & Simons and Piers Coleman, and while I can follow the mathematical arguments, I am struggling with some of the concepts involved. I would very much appreciate some help with several points, which I have been unable to clarify to my satisfaction, despite referring to numerous other textbooks. I apologize in advance if these questions seem too basic.
Question: Starting from the very first step of the derivation, where the partition function is expressed as the trace of the operator $\exp[-\beta(\hat{H}-\mu\hat{N})]$, firstly in terms of a complete set of Fock space states and then coherent states, is it necessary for the basis to be chosen such that the Hamiltonian is diagonal in this basis? I know that the trace, and hence the partition function, is the sum of the diagonal matrix elements, but does the matrix need to be diagonal for this to be evaluated and make sense?