I am reading Blundell's Quantum field theory for the Gifted Amateur and stuck at some calculation. In his book p.197, 21.2 Sources in statistical physics, he defined the partition function with the source term by
$$Z(J)=\operatorname{Tr}[e^{-\beta\hat{H}}] := \operatorname{Tr}[e^{-\beta\hat{H_0}+\Sigma_kJ_k \hat{\phi_k}}]$$
Then he calculated the thermal average $\langle \hat{\phi_i} \rangle_t$ (c.f. his book p.197) by
$$\langle \hat{\phi_i} \rangle_t = \frac{1}{Z(J=0)}\frac{\partial Z(J)}{\partial(J_i)}|_{J_i=0} = \frac{\operatorname{Tr}[\hat{\phi_i}e^{-\beta\hat{H_0}}]}{Z(J=0)} $$
And why is the second equality true?
Perhaps,
$$\frac{\partial Z(J)}{\partial(J_i)}|_{J_i=0}=\operatorname{Tr}[e^{-\beta \hat{H_0}} \cdot e^{\Sigma_{k} J_k \hat{\phi_k}} \cdot \frac{\partial}{\partial(J_i)}(\Sigma_k J_k \hat{\phi_k})]|_{J_i=0} = \operatorname{Tr}[e^{-\beta \hat{H_0}} \cdot e^{\Sigma_{k} J_k \hat{\phi_k}} \cdot \hat{\phi_i} ]|_{J_i=0}~? $$
True? If so, how about next step? Can anyone help?