The Ising model has this partition function
\begin{equation} Z= \sum_{states}e^{-\beta E}= \sum_{\{\sigma \}}e^{\beta J \sum_{<i,j>}\sigma_i\sigma_j} \end{equation}
The internal energy can be calculated as:
\begin{equation} U=\frac{1}{Z}\sum_{states}Ee^{-\beta E} = -\frac{\partial}{\partial \beta} ln(Z) \end{equation}
If I want to calculate the mean two-spin correlation $<\sigma_i\sigma_j>$ where $i$ and $j$ are neibouring sites I would do this:
\begin{equation} <\sigma_i\sigma_j>=\frac{1}{Z}\sum_{states}\sigma_i\sigma_j\ e^{-\beta E} = \frac{1}{Z}\sum_{\{\sigma \}}\sigma_i\sigma_j\ e^{\beta J \sum_{<i,j>}\sigma_i\sigma_j} \end{equation}
Isn't this the same as this?
\begin{equation} <\sigma_i\sigma_j>=\frac{1}{N^2}\frac{1}{J}\frac{\partial}{\partial \beta} ln(Z) \end{equation}
where the $N^2$ accounts for the summation over $<i,j>$ that drops with the derivative. If this is true, then:
\begin{equation} U= -J N^2 <\sigma_i\sigma_j> \end{equation}
Is this true?