I've read that considering a quantum system with Hamiltonian $H$ and propagator
$$K(x,t;x',t')=\langle x|U(t,t')|x'\rangle$$
if we define
$$Z=\int d^3x' K(x',-i\hbar\beta;x',0)$$
then the fundamental state energy can be derived from $Z$ as
$$E=\lim_{\beta\to \infty}-\dfrac{1}{Z}\dfrac{\partial Z}{\partial \beta}$$
I've tried to show this in the following way: if we use time-independent $H$ we can write $U(t,t')=e^{-iH(t-t')/\hbar}$. Thus we have by the definitions
$$Z=\int d^3 x' \langle x'|e^{-\beta H}|x'\rangle,$$
thus if $|\varphi_n\rangle$ are the eigenstates of $H$ with eigenvalues $E_n$ we have
$$Z=\int d^3 x'\langle x'|e^{-\beta H}|x'\rangle=\sum_{n} \int d^3 x'\langle x'|\varphi_n\rangle \langle \varphi_n | e^{-\beta H}|x'\rangle=\sum_n \int d^3 x' e^{-\beta E_n}|\langle x'|\varphi_n\rangle|^2$$
in other words, assuming the basis of $H$ to be normalized
$$Z=\sum_n e^{-\beta E_n}$$
thus we can find
$$\dfrac{\partial Z}{\partial \beta}=-\sum_n E_n e^{-\beta E_n}$$
That is all fine, but how from this we can conclude that the ground state energy is that limit? It should be the smalest energy, but then what? I'm really not getting it.