Correlation function in statistical mechanics