Defining the local activity by
![{\displaystyle z(r)=z\exp[-\beta \psi (r)]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/15e4366ba5664e1af5402b07e6aa112fa4214c2f) where
where  , and
, and  is the Boltzmann constant.
Using those definitions the grand canonical partition function can be written as
 is the Boltzmann constant.
Using those definitions the grand canonical partition function can be written as
Failed to parse (unknown function "\b"): {\displaystyle \Xi=\sum_N^\infty{1\over N!}\int\dots\int \prod_i^Nz({\b f r}_i)\exp(-\beta U_N){\rm d}{\bf r}_1\dots{\rm d}{\bf r}_N.}
By functionally-differentiating  with respect to
  with respect to  , and utilizing the mathematical theorem concerning the functional derivative,
, and utilizing the mathematical theorem concerning the functional derivative,
 
we get the following equations with respect to the density pair correlation functions.
 
 
A relation between  and
 and  can be obtained after some manipulation as,
 can be obtained after some manipulation as,
 
Now, we define the direct correlation function by an inverse relation of Eq. (\ref{deltarho}),
Failed to parse (unknown function "\label"): {\displaystyle {\delta \ln z({\bf r})\over{\delta\rho({\bf r'})}}={\delta({\bf r}-{\bf r'})\over{\rho({\bf r'})}}  \label{deltalnz}-c({\bf r,r'}).}
Inserting Eqs. (\ref{deltarho}) and (\ref{deltalnz}) into the chain-rule theorem of functional derivatives,
 
one obtains the Ornstein-Zernike equation.
Thus the Ornstein-Zernike equation is,
in a sense, a differential form of the partition function.