For two N particle systems 0 and 1 with partition function  and  ,  
from 
get the thermodynamic free energy difference is 
For every configuration visited during this sampling of system 1 we can compute the potential energy U as a function of the configuration space, and the potential energy difference is 
Now construct a probability density of the potential energy from the above equation:
where in  is a configurational part of a partition function
since 
now define two functions:
thus that 
and can be obtained by fitting  and