I am studying density functional theory and I am currently dealing with manipulating the intrinsic free energy, $\mathcal{F}$, which is defined as $$\mathcal{F} = F - \int dr \rho ^{(1)}(r)\phi (r) $$ which can be expressed in it's differential form as $$\delta \mathcal{F} = -S\delta T+ \int dr \delta \rho ^{(1)}(r) \psi (r)$$ In the above equations, $F$ is the Helmholtz free energy, $\phi (r)$ is some external field, $\psi$ is the intrinsic chemical potential defined as $\psi (r) = \mu - \phi (r)$, where $\mu$ is the chemical potential, and $\rho ^{(1)}$ is the single-particle density given in terms of the local activity as
$$\rho ^{(1)} (r_1)=\Xi ^{-1} \sum _{N=1}^{\infty} \frac{1}{(N-1)!} \int dr^{(N-1)} \exp [-\beta U(r^N)] \prod _{i=1}^N \left\{ z^{*}(r_i) \right\}$$ which can be generalized to $$\rho ^{(n)} (r_1)=\Xi ^{-1} \sum _{N=n}^{\infty} \frac{1}{(N-n)!} \int dr^{(N-n)} \exp [-\beta U(r^N)] \prod _{i=1}^N \left\{ z^{*}(r_i) \right\} $$ where $z^{*}(r) = z\exp [-\beta \phi (r)]$, where $z$ is the fugacity.
Defining the grand potential $$\Omega = \mathcal{F} - N\mu + \int dr \rho ^{(1)}(r) \phi (r)$$ we obtain $$\delta \Omega = -S\delta T - \int dr \rho ^{(1)}(r) \delta \psi (r)$$.
This is all fine so far. Now, in the notes I have been provided, they calculate the second derivative of $\Omega$, we take the $\psi$ derivative of $\rho ^{(1)}$, $$\frac{\delta ^2 \Omega}{\delta \psi (r_1) \delta \psi (r_2)} = -\frac{\delta \rho ^{(1)}(r_1)}{\delta \psi (r_2)}$$.
The first derivative makes sense, but now, they claim that \begin{align*} -\frac{\delta \rho ^{(1)}(r_1)}{\delta \psi (r_2)} &= \beta [\rho^{(1)}(r_1)\rho ^{(1)}(r_2) - \rho ^{(1)}(r_1) \delta (r_1-r_2) -\rho ^{(2)}(r_1,r_2)] \\ &= -\beta[\rho ^{(1)}(r_1) \rho ^{(1)}(r_2) h^{(2)}(r_1,r_2)+\rho ^{(1)}(r_1) \delta (r_1-r_2)] \end{align*}
Where $h(r_1,r_2)$ is the total correlation function.
I have no idea how they performed these derivatives and used the correlations. How did they simplify $d\rho ^{(1)}(r_1)/d\psi (r_2)$? I do not understand how the chain rule leads to the terms on the RHS. Nor how they managed to get $\rho ^{(2)}$ in the mix.
Any help with these functional derivatives would be appreciated!